SDK ReferenceTypeScript SDK

ToolRouterSession

Markdown

Usage

Access this class through the composio.toolRouterSession property:

const composio = new Composio({ apiKey: 'your-api-key' });
const result = await composio.toolRouterSession.list();

Properties

NameType
experimentalSessionExperimental
mcpobject
sessionIdstring

Methods

authorize()

Initiate an authorization flow for a toolkit. Returns a ConnectionRequest with a redirect URL for the user.

async authorize(toolkit: string, options?: { callbackUrl?: string }): Promise<ConnectionRequest>

Parameters

NameType
toolkitstring
options?object

Returns

Promise<ConnectionRequest>


customToolkits()

List all custom toolkits registered in this session. Returns toolkits with their tools showing final slugs.

customToolkits(): RegisteredCustomToolkit[]

Returns

RegisteredCustomToolkit[] — Array of registered custom toolkits


customTools()

List all custom tools registered in this session. Returns tools with their final slugs, schemas, and resolved toolkit.

customTools(options?: { toolkit?: string }): RegisteredCustomTool[]

Parameters

NameType
options?object

Returns

RegisteredCustomTool[] — Array of registered custom tools


execute()

Execute a tool within the session.

For custom tools, accepts the original slug (e.g. "GREP") or the full slug (e.g. "LOCAL_GREP"). Custom tools are executed in-process; remote tools are sent to the Composio backend.

async execute(toolSlug: string, arguments_?: Record<string, unknown>): Promise<{ data: Record<string, unknown>; error: string | null; logId: string }>

Parameters

NameTypeDescription
toolSlugstringThe tool slug to execute
arguments_?Record<string, unknown>Optional tool arguments

Returns

Promise<...> — The tool execution result


proxyExecute()

Proxy an API call through Composio's auth layer using the session's connected account. The backend resolves the connected account from the toolkit within the session.

async proxyExecute(params: object): Promise<ToolRouterSessionProxyExecuteResponse>

Parameters

NameTypeDescription
paramsobjectProxy request parameters (toolkit, endpoint, method, body, headers/query params)

Returns

Promise<ToolRouterSessionProxyExecuteResponse> — The proxied API response with status, data, headers


Search for tools by semantic use case. Returns relevant tools for the given query with schemas and guidance.

async search(params: { query: string; toolkits?: string[] }): Promise<...>

Parameters

NameType
paramsobject

Returns

Promise<...>


toolkits()

Query the connection state of toolkits in the session. Supports pagination and filtering by toolkit slugs.

async toolkits(options?: { isConnected?: boolean; limit?: number; nextCursor?: string; search?: string; toolkits?: string[] }): Promise<...>

Parameters

NameType
options?object

Returns

Promise<...>


tools()

Get the tools available in the session, formatted for your AI framework. Requires a provider to be configured in the Composio constructor.

When custom tools are bound to the session, execution of COMPOSIO_MULTI_EXECUTE_TOOL is intercepted: local tools are executed in-process, remote tools are sent to the backend.

async tools(modifiers?: SessionMetaToolOptions): Promise<ReturnType>

Parameters

NameType
modifiers?SessionMetaToolOptions

Returns

Promise<ReturnType>