Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
docs: auto-generate TypeScript SDK reference
dhawal1b99753de2dfc
diff --git a/docs/content/reference/sdk-reference/typescript/index.mdx b/docs/content/reference/sdk-reference/typescript/index.mdxindex f878725a2..52679c5c7 100644--- a/docs/content/reference/sdk-reference/typescript/index.mdx+++ b/docs/content/reference/sdk-reference/typescript/index.mdx@@ -37,6 +37,7 @@ bun add @composio/core| [`ConnectedAccounts`](/reference/sdk-reference/typescript/connected-accounts) | ConnectedAccounts class || [`MCP`](/reference/sdk-reference/typescript/mcp) | MCP (Model Control Protocol) class || [`RemoteFile`](/reference/sdk-reference/typescript/remote-file) | Represents a file stored in a tool router session's file mount. |+| [`SessionContextImpl`](/reference/sdk-reference/typescript/session-context-impl) | Concrete implementation of SessionContext. || [`Toolkits`](/reference/sdk-reference/typescript/toolkits) | Toolkits class || [`ToolRouterSession`](/reference/sdk-reference/typescript/tool-router-session) | ToolRouterSession API || [`ToolRouterSessionFilesMount`](/reference/sdk-reference/typescript/tool-router-session-files-mount) | ToolRouterSessionFilesMount API |diff --git a/docs/content/reference/sdk-reference/typescript/meta.json b/docs/content/reference/sdk-reference/typescript/meta.jsonindex ed7f17d9d..57ad070ac 100644--- a/docs/content/reference/sdk-reference/typescript/meta.json+++ b/docs/content/reference/sdk-reference/typescript/meta.json@@ -6,6 +6,7 @@"connected-accounts","mcp","remote-file",+ "session-context-impl","toolkits","tool-router-session","tool-router-session-files-mount",diff --git a/docs/content/reference/sdk-reference/typescript/session-context-impl.mdx b/docs/content/reference/sdk-reference/typescript/session-context-impl.mdxnew file mode 100644index 000000000..a2a23c082--- /dev/null+++ b/docs/content/reference/sdk-reference/typescript/session-context-impl.mdx@@ -0,0 +1,65 @@+---+title: SessionContextImpl+description: Concrete implementation of SessionContext. One instance is created per session (or per multi-execute batch) and shared across all custom tool invocations, including sibling routing. When `customToolsMap` is provided, `execute()` checks local tools first before falling back to the backend API. This allows tool A to call tool B via `session.execute('B', ...)` without hitting the network.+---++## Usage++Access this class through the `composio.sessionContextImpl` property:++```typescript+const composio = new Composio({ apiKey: 'your-api-key' });+const result = await composio.sessionContextImpl.list();+```++## Properties++| Name | Type | Description |+|------|------|-------------|+| `userId` | `string` | The user ID for this session |++## Methods++### execute()++Execute any tool from within a custom tool.+Routes to sibling local tools in-process when available,+otherwise delegates to the backend API.++```typescript+async execute(toolSlug: string, arguments_: Record<string, unknown>): Promise<...>+```++**Parameters**++| Name | Type |+|------|------|+| `toolSlug` | `string` |+| `arguments_` | `Record<string, unknown>` |++**Returns**++`Promise<...>`++---++### proxyExecute()++Proxy API calls through Composio's auth layer.+The backend resolves the connected account from the toolkit within the session.++```typescript+async proxyExecute(params: object): Promise<ToolRouterSessionProxyExecuteResponse>+```++**Parameters**++| Name | Type |+|------|------|+| `params` | `object` |++**Returns**++`Promise<ToolRouterSessionProxyExecuteResponse>`++---diff --git a/docs/content/reference/sdk-reference/typescript/tool-router-session.mdx b/docs/content/reference/sdk-reference/typescript/tool-router-session.mdxindex 07eeef16a..2b4f4db9a 100644--- a/docs/content/reference/sdk-reference/typescript/tool-router-session.mdx+++ b/docs/content/reference/sdk-reference/typescript/tool-router-session.mdx@@ -44,10 +44,50 @@ async authorize(toolkit: string, options?: { callbackUrl?: string }): Promise<Co---+### customToolkits()++List all custom toolkits registered in this session.+Returns toolkits with their tools showing final slugs.++```typescript+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.++```typescript+customTools(options?: { toolkit?: string }): RegisteredCustomTool[]+```++**Parameters**++| Name | Type |+|------|------|+| `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.+```typescriptasync execute(toolSlug: string, arguments_?: Record<string, unknown>): Promise<{ data: Record<string, unknown>; error: string | null; logId: string }>```@@ -56,29 +96,34 @@ async execute(toolSlug: string, arguments_?: Record<string, unknown>): Promise<{| Name | Type | Description ||------|------|-------------|-| `toolSlug` | `string` | The tool slug to execute (e.g. "GMAIL_SEND_EMAIL") |-| `arguments_?` | `Record<string, unknown>` | Optional tool arguments. Defaults to empty object if omitted. |+| `toolSlug` | `string` | The tool slug to execute |+| `arguments_?` | `Record<string, unknown>` | Optional tool arguments |**Returns**`Promise<...>` — The tool execution result-**Example**+---++### proxyExecute()-```typescript-const session = await composio.toolRouter.use('session_123');-const result = await session.execute('GMAIL_SEND_EMAIL', {- to: '[email protected]',- subject: 'Hello',- body: 'Hi!',-});-```+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.```typescript-// Execute with no arguments-const result = await session.execute('HACKERNEWS_GET_USER');+async proxyExecute(params: object): Promise<ToolRouterSessionProxyExecuteResponse>```+**Parameters**++| Name | Type | Description |+|------|------|-------------|+| `params` | `object` | Proxy request parameters (toolkit, endpoint, method, body, headers/query params) |++**Returns**++`Promise<ToolRouterSessionProxyExecuteResponse>` — The proxied API response with status, data, headers+---### search()@@ -92,23 +137,13 @@ async search(params: { query: string; toolkits?: string[] }): Promise<...>**Parameters**-| Name | Type | Description |-|------|------|-------------|-| `params` | `object` | Search parameters |+| Name | Type |+|------|------|+| `params` | `object` |**Returns**-`Promise<...>` — Search results with matching tools and schemas--**Example**--```typescript-const session = await composio.toolRouter.use('session_123');-const results = await session.search({- query: 'send emails and notify Slack',- toolkits: ['gmail', 'slack'],-});-```+`Promise<...>`---@@ -138,6 +173,9 @@ async toolkits(options?: { isConnected?: boolean; limit?: number; nextCursor?: sGet 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.+```typescriptasync tools(modifiers?: SessionMetaToolOptions): Promise<ReturnType>```