Tools
@composio/core / models/Tools / Tools
Class: Tools<TToolCollection, TTool, TProvider>
Defined in: ts/packages/core/src/models/Tools.ts:47
This class is used to manage tools in the Composio SDK. It provides methods to list, get, and execute tools.
Type Parameters
TToolCollection
TToolCollection
TTool
TTool
TProvider
TProvider
extends BaseComposioProvider
<TToolCollection
, TTool
, unknown
>
Constructors
Constructor
new Tools<
TToolCollection
,TTool
,TProvider
>(client
,provider
):Tools
<TToolCollection
,TTool
,TProvider
>
Defined in: ts/packages/core/src/models/Tools.ts:56
Parameters
client
Composio
provider
TProvider
Returns
Tools
<TToolCollection
, TTool
, TProvider
>
Methods
createCustomTool()
createCustomTool<
T
>(body
):Promise
<{ }>
Defined in: ts/packages/core/src/models/Tools.ts:780
Creates a custom tool that can be used within the Composio SDK.
Custom tools allow you to extend the functionality of Composio with your own implementations while keeping a consistent interface for both built-in and custom tools.
Type Parameters
T
T
extends CustomToolInputParameter
Parameters
body
CustomToolOptions
<T
>
The configuration for the custom tool
Returns
Promise
<{ }>
The created custom tool
Examples
get()
Get a tool or list of tools based on the provided arguments. This is an implementation method that handles both overloads.
Param
The user id to get the tool(s) for
Param
Either a slug string or filters object
Param
Optional provider options
Call Signature
get<
T
>(userId
,filters
,options?
):Promise
<ReturnType
<T
["wrapTools"
]>>
Defined in: ts/packages/core/src/models/Tools.ts:396
Get a list of tools from Composio based on filters. This method fetches the tools from the Composio API and wraps them using the provider.
Type Parameters
T
T
extends BaseComposioProvider
<TToolCollection
, TTool
, unknown
>
Parameters
userId
string
The user id to get the tools for
filters
ToolListParams
The filters to apply when fetching tools
options?
ProviderOptions
<TProvider
>
Optional provider options including modifiers
Returns
Promise
<ReturnType
<T
["wrapTools"
]>>
The tool collection
Param
The user id to get the tool(s) for
Param
Either a slug string or filters object
Param
Optional provider options
Example
Call Signature
get<
T
>(userId
,slug
,options?
):Promise
<ReturnType
<T
["wrapTools"
]>>
Defined in: ts/packages/core/src/models/Tools.ts:425
Get a specific tool by its slug. This method fetches the tool from the Composio API and wraps it using the provider.
Type Parameters
T
T
extends BaseComposioProvider
<TToolCollection
, TTool
, unknown
>
Parameters
userId
string
The user id to get the tool for
slug
string
The slug of the tool to fetch
options?
ProviderOptions
<TProvider
>
Optional provider options including modifiers
Returns
Promise
<ReturnType
<T
["wrapTools"
]>>
The tool collection
Param
The user id to get the tool(s) for
Param
Either a slug string or filters object
Param
Optional provider options
Example
getInput()
getInput(
slug
,body
):Promise
<ToolGetInputResponse
>
Defined in: ts/packages/core/src/models/Tools.ts:676
Fetches the input parameters for a given tool.
This method is used to get the input parameters for a tool before executing it.
Parameters
slug
string
The ID of the tool to find input for
body
ToolGetInputParams
The parameters to be passed to the tool
Returns
Promise
<ToolGetInputResponse
>
The input parameters schema for the specified tool
Example
getRawComposioToolBySlug()
getRawComposioToolBySlug(
slug
,modifier?
):Promise
<{ }>
Defined in: ts/packages/core/src/models/Tools.ts:337
Retrieves a tool by its Slug. This method is used to get the raw tools from the composio API.
Parameters
slug
string
The ID of the tool to be retrieved
modifier?
TransformToolSchemaModifier
Returns
Promise
<{ }>
The tool
Example
getRawComposioTools()
getRawComposioTools(
query?
,modifier?
):Promise
<ToolList
>
Defined in: ts/packages/core/src/models/Tools.ts:250
Lists all tools available in the Composio SDK including custom tools.
This method fetches tools from the Composio API in raw format and combines them with any registered custom tools. The response can be filtered and modified as needed.
Parameters
query?
ToolListParams
Optional query parameters to filter the tools
modifier?
TransformToolSchemaModifier
Optional function to transform tool schemas
Returns
Promise
<ToolList
>
List of tools matching the query criteria
Example
getToolsEnum()
getToolsEnum():
Promise
<string
>
Defined in: ts/packages/core/src/models/Tools.ts:654
Fetches the list of all available tools in the Composio SDK.
This method is mostly used by the CLI to get the list of tools. No filtering is done on the tools, the list is cached in the backend, no further optimization is required.
Returns
Promise
<string
>
The complete list of all available tools with their metadata
Example
proxyExecute()
proxyExecute(
body
):Promise
<ToolProxyResponse
>
Defined in: ts/packages/core/src/models/Tools.ts:703
Proxies a custom request to a toolkit/integration.
This method allows sending custom requests to a specific toolkit or integration when you need more flexibility than the standard tool execution methods provide.
Parameters
body
The parameters for the proxy request including toolkit slug and custom data
Returns
Promise
<ToolProxyResponse
>
The response from the proxied request