Custom tools let you define TypeScript functions that work side-by-side with Composio’s built-in integrations. Your custom tools are passed to a tool router session and exposed to agents with the same interface as native Composio tools — no extra wiring required. You can call other Composio tools from inside a custom tool’sDocumentation 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.
execute function using the injected SessionContext.
The
experimental_ prefix indicates these APIs may evolve in future releases. Breaking changes will be documented in the changelog.Import
experimental_createTool()
Define a single custom tool. The returnedCustomTool object is passed to composio.create() inside experimental.customTools.
Unique tool identifier. Alphanumeric characters, underscores, and hyphens only. Must not start with
LOCAL_ (reserved) or COMPOSIO_ (reserved). The SDK automatically prepends LOCAL_ when exposing the tool to agents — so 'GREP' becomes LOCAL_GREP.Human-readable tool name.
Tool description shown to agents to help them decide when to call the tool.
Zod schema for input parameters. Must be a
z.object(). Field descriptions in the schema are surfaced to agents as parameter documentation.Async function that implements the tool’s logic. Receives
(input, ctx) where input is the validated Zod-inferred type and ctx is a SessionContext. Return a plain object — the SDK wraps it into the standard response format. Throw an error to signal failure.Composio toolkit slug to inherit authentication from (e.g.
'gmail'). When set, the tool’s final slug becomes LOCAL_GMAIL_TOOLNAME and the execute function can call ctx.execute() to invoke other Gmail tools. Leave empty for tools that don’t need Composio-managed auth.Zod schema for the output. Used for documentation — not enforced at runtime.
When
true, include this tool in session.tools() so agents can call it without a search step. Defaults to false.experimental_createToolkit()
Group related custom tools into a named toolkit. Tools inside a toolkit must not haveextendsToolkit set — they inherit the toolkit identity instead.
Unique toolkit identifier. The toolkit slug is included in each tool’s final slug — for example, a toolkit
'DEV_TOOLS' with a tool 'GREP' produces LOCAL_DEV_TOOLS_GREP.Human-readable toolkit name.
Toolkit description.
Array of tools created by
experimental_createTool(). Must contain at least one tool. Tools must not have extendsToolkit set.Default
preload value for all tools in this toolkit. Individual tool-level preload values override this default.SessionContext
Thectx parameter injected into every execute function at runtime.
The user ID for the current session.
(toolSlug: string, arguments_: Record<string, unknown>) => Promise<ToolRouterSessionExecuteResponse>Execute any Composio native tool from within your custom tool. Returns { data, error, logId }. Throws on error.(params: SessionProxyExecuteParams) => Promise<ToolRouterSessionProxyExecuteResponse>Proxy an HTTP request through Composio’s auth layer for the session’s connected account. Useful for calling toolkit APIs not covered by existing tools.Slug naming rules
| Context | Final slug format | Example |
|---|---|---|
| Standalone tool | LOCAL_{SLUG} | LOCAL_GREP |
| Tool extending a toolkit | LOCAL_{TOOLKIT}_{SLUG} | LOCAL_GMAIL_GET_IMPORTANT |
| Tool inside a custom toolkit | LOCAL_{TOOLKIT}_{SLUG} | LOCAL_DEV_TOOLS_GREP |
Using custom tools in a session
Pass custom tools and toolkits tocomposio.create() via experimental.customTools and experimental.customToolkits: