Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ComposioHQ/composio/llms.txt
Use this file to discover all available pages before exploring further.
composio.tools is the primary interface for fetching and executing Composio tools. Call get() to retrieve provider-wrapped tool schemas ready to pass to your LLM, and execute() to invoke a tool directly with a dictionary of arguments. Both methods support an optional modifiers list for intercepting and transforming inputs, outputs, and tool schemas.
tools.get()
Retrieve a collection of tools wrapped for your configured provider. The return type is automatically inferred from the provider — for OpenAIProvider it is list[ChatCompletionToolParam], for AnthropicProvider it is list[ToolParam], and so on.
The external user ID to scope tool fetching to. Used by agentic providers to bind tool execution to the correct connected accounts.
Fetch a single tool by its slug (e.g.
"GITHUB_CREATE_ISSUE"). Mutually exclusive with tools, search, and toolkits.Fetch a specific set of tools by slug list. At least one of
tools, search, or toolkits must be provided.Free-text search across tool names and descriptions. Returns the most semantically relevant matches.
Fetch all tools from one or more toolkits (e.g.
["github", "gmail"]).Filter tools to those requiring specific OAuth scopes. Useful for showing only the tools a user’s connection supports.
A list of
Modifier objects produced by the @schema_modifier, @before_execute, or @after_execute decorators. Schema modifiers are applied during get(); execute modifiers are applied lazily at execution time (for agentic providers).Maximum number of tools to return. Defaults to the API’s page size.
tools.execute()
Execute a specific tool by slug with a dictionary of arguments. Returns a ToolExecutionResponse TypedDict.
The tool slug in
SCREAMING_SNAKE_CASE (e.g. "GITHUB_CREATE_ISSUE"). Custom tools use whatever slug they were registered under.Tool input arguments as a plain Python dictionary. Keys and value types must match the tool’s input schema.
The ID of the connected account (
ca_xxx) to use for authentication. When omitted, the backend selects the active connection for the given user_id.Provide custom auth parameters (headers, query params) for tools that accept bring-your-own credentials. Overridden by
custom_connection_data when both are supplied.Full custom connection data for tools that support it. Takes priority over
custom_auth_params.The external user ID. Used when
connected_account_id is not specified to look up the user’s active connection.Optional natural-language context passed to the tool alongside structured arguments.
Override the toolkit version for this execution only (e.g.
"20250906_01"). Falls back to the instance-level toolkit_versions configuration, then to "latest".Skip the version-check guard that prevents executing tools pinned to
"latest". Only safe in agentic loops where you fetched schemas and executed within the same version context.A list of
Modifier objects for @before_execute, @after_execute, and @before_file_upload hooks applied around this specific execution.ToolExecutionResponse
execute() returns a ToolExecutionResponse TypedDict with three fields:
The tool’s output data. Shape varies per tool — consult the individual tool’s output schema.
Error message string when execution failed,
None on success.True when the tool executed without an error, False otherwise.Modifiers
Modifiers intercept and transform tool schemas, inputs, and outputs. Import the decorator factories fromcomposio:
@before_execute
Called with (tool: str, toolkit: str, params: ToolExecuteParams) before each tool call. Return a modified ToolExecuteParams to override arguments, version, or connected account.
@after_execute
Called with (tool: str, toolkit: str, response: ToolExecutionResponse) after each tool call. Return a modified ToolExecutionResponse to post-process results.
@schema_modifier
Called with (tool: str, toolkit: str, schema: Tool) when schemas are fetched. Return a modified Tool to rewrite descriptions, hide parameters, or add defaults.
@before_file_upload
Called before a local file path or URL is staged for upload. The hook receives a BeforeFileUploadContext dict with path, source ("path" or "url"), tool, and toolkit. Return a new path/URL string to substitute, or False to abort.
Scoping modifiers to specific tools or toolkits
Passtools= or toolkits= to limit a modifier’s scope:
Complete example with OpenAI
For agentic providers like
OpenAIProvider, the execute loop is handled automatically when you pass user_id to tools.get(). You only need to call tools.execute() directly when building non-agentic or custom execution flows.