@devries-cameron20 / composio Mirror · read-only / commits / b99753de2
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 02:00 UTC

docs: auto-generate TypeScript SDK reference

dhawal1 committed Mar 18, 2026 at 20:39 UTC b99753de2dfc301025f3cae77e840dbb534a1a70
4 files changed +132 -27
docs/content/reference/sdk-reference/typescript/index.mdx
+1
@@ -37,6 +37,7 @@ bun add @composio/core
37 | [`ConnectedAccounts`](/reference/sdk-reference/typescript/connected-accounts) | ConnectedAccounts class |
38 | [`MCP`](/reference/sdk-reference/typescript/mcp) | MCP (Model Control Protocol) class |
39 | [`RemoteFile`](/reference/sdk-reference/typescript/remote-file) | Represents a file stored in a tool router session's file mount. |
40 +| [`SessionContextImpl`](/reference/sdk-reference/typescript/session-context-impl) | Concrete implementation of SessionContext. |
41 | [`Toolkits`](/reference/sdk-reference/typescript/toolkits) | Toolkits class |
42 | [`ToolRouterSession`](/reference/sdk-reference/typescript/tool-router-session) | ToolRouterSession API |
43 | [`ToolRouterSessionFilesMount`](/reference/sdk-reference/typescript/tool-router-session-files-mount) | ToolRouterSessionFilesMount API |
docs/content/reference/sdk-reference/typescript/meta.json
+1
@@ -6,6 +6,7 @@
6 "connected-accounts",
7 "mcp",
8 "remote-file",
9 + "session-context-impl",
10 "toolkits",
11 "tool-router-session",
12 "tool-router-session-files-mount",
docs/content/reference/sdk-reference/typescript/session-context-impl.mdx new
+65
@@ -0,0 +1,65 @@
1 +---
2 +title: SessionContextImpl
3 +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.
4 +---
5 +
6 +## Usage
7 +
8 +Access this class through the `composio.sessionContextImpl` property:
9 +
10 +```typescript
11 +const composio = new Composio({ apiKey: 'your-api-key' });
12 +const result = await composio.sessionContextImpl.list();
13 +```
14 +
15 +## Properties
16 +
17 +| Name | Type | Description |
18 +|------|------|-------------|
19 +| `userId` | `string` | The user ID for this session |
20 +
21 +## Methods
22 +
23 +### execute()
24 +
25 +Execute any tool from within a custom tool.
26 +Routes to sibling local tools in-process when available,
27 +otherwise delegates to the backend API.
28 +
29 +```typescript
30 +async execute(toolSlug: string, arguments_: Record<string, unknown>): Promise<...>
31 +```
32 +
33 +**Parameters**
34 +
35 +| Name | Type |
36 +|------|------|
37 +| `toolSlug` | `string` |
38 +| `arguments_` | `Record<string, unknown>` |
39 +
40 +**Returns**
41 +
42 +`Promise<...>`
43 +
44 +---
45 +
46 +### proxyExecute()
47 +
48 +Proxy API calls through Composio's auth layer.
49 +The backend resolves the connected account from the toolkit within the session.
50 +
51 +```typescript
52 +async proxyExecute(params: object): Promise<ToolRouterSessionProxyExecuteResponse>
53 +```
54 +
55 +**Parameters**
56 +
57 +| Name | Type |
58 +|------|------|
59 +| `params` | `object` |
60 +
61 +**Returns**
62 +
63 +`Promise<ToolRouterSessionProxyExecuteResponse>`
64 +
65 +---
docs/content/reference/sdk-reference/typescript/tool-router-session.mdx
+65 -27
@@ -44,10 +44,50 @@ async authorize(toolkit: string, options?: { callbackUrl?: string }): Promise<Co
44
45 ---
46
47 +### customToolkits()
48 +
49 +List all custom toolkits registered in this session.
50 +Returns toolkits with their tools showing final slugs.
51 +
52 +```typescript
53 +customToolkits(): RegisteredCustomToolkit[]
54 +```
55 +
56 +**Returns**
57 +
58 +`RegisteredCustomToolkit[]` — Array of registered custom toolkits
59 +
60 +---
61 +
62 +### customTools()
63 +
64 +List all custom tools registered in this session.
65 +Returns tools with their final slugs, schemas, and resolved toolkit.
66 +
67 +```typescript
68 +customTools(options?: { toolkit?: string }): RegisteredCustomTool[]
69 +```
70 +
71 +**Parameters**
72 +
73 +| Name | Type |
74 +|------|------|
75 +| `options?` | `object` |
76 +
77 +**Returns**
78 +
79 +`RegisteredCustomTool[]` — Array of registered custom tools
80 +
81 +---
82 +
83 ### execute()
84
85 Execute a tool within the session.
86
87 +For custom tools, accepts the original slug (e.g. "GREP") or the
88 +full slug (e.g. "LOCAL_GREP"). Custom tools are executed in-process;
89 +remote tools are sent to the Composio backend.
90 +
91 ```typescript
92 async execute(toolSlug: string, arguments_?: Record<string, unknown>): Promise<{ data: Record<string, unknown>; error: string | null; logId: string }>
93 ```
@@ -56,29 +96,34 @@ async execute(toolSlug: string, arguments_?: Record<string, unknown>): Promise<{
96
97 | Name | Type | Description |
98 |------|------|-------------|
59 -| `toolSlug` | `string` | The tool slug to execute (e.g. "GMAIL_SEND_EMAIL") |
60 -| `arguments_?` | `Record<string, unknown>` | Optional tool arguments. Defaults to empty object if omitted. |
99 +| `toolSlug` | `string` | The tool slug to execute |
100 +| `arguments_?` | `Record<string, unknown>` | Optional tool arguments |
101
102 **Returns**
103
104 `Promise<...>` — The tool execution result
105
66 -**Example**
106 +---
107 +
108 +### proxyExecute()
109
68 -```typescript
69 -const session = await composio.toolRouter.use('session_123');
70 -const result = await session.execute('GMAIL_SEND_EMAIL', {
71 - to: 'user@example.com',
72 - subject: 'Hello',
73 - body: 'Hi!',
74 -});
75 -```
110 +Proxy an API call through Composio's auth layer using the session's connected account.
111 +The backend resolves the connected account from the toolkit within the session.
112
113 ```typescript
78 -// Execute with no arguments
79 -const result = await session.execute('HACKERNEWS_GET_USER');
114 +async proxyExecute(params: object): Promise<ToolRouterSessionProxyExecuteResponse>
115 ```
116
117 +**Parameters**
118 +
119 +| Name | Type | Description |
120 +|------|------|-------------|
121 +| `params` | `object` | Proxy request parameters (toolkit, endpoint, method, body, headers/query params) |
122 +
123 +**Returns**
124 +
125 +`Promise<ToolRouterSessionProxyExecuteResponse>` — The proxied API response with status, data, headers
126 +
127 ---
128
129 ### search()
@@ -92,23 +137,13 @@ async search(params: { query: string; toolkits?: string[] }): Promise<...>
137
138 **Parameters**
139
95 -| Name | Type | Description |
96 -|------|------|-------------|
97 -| `params` | `object` | Search parameters |
140 +| Name | Type |
141 +|------|------|
142 +| `params` | `object` |
143
144 **Returns**
145
101 -`Promise<...>` — Search results with matching tools and schemas
102 -
103 -**Example**
104 -
105 -```typescript
106 -const session = await composio.toolRouter.use('session_123');
107 -const results = await session.search({
108 - query: 'send emails and notify Slack',
109 - toolkits: ['gmail', 'slack'],
110 -});
111 -```
146 +`Promise<...>`
147
148 ---
149
@@ -138,6 +173,9 @@ async toolkits(options?: { isConnected?: boolean; limit?: number; nextCursor?: s
173 Get the tools available in the session, formatted for your AI framework.
174 Requires a provider to be configured in the Composio constructor.
175
176 +When custom tools are bound to the session, execution of COMPOSIO_MULTI_EXECUTE_TOOL
177 +is intercepted: local tools are executed in-process, remote tools are sent to the backend.
178 +
179 ```typescript
180 async tools(modifiers?: SessionMetaToolOptions): Promise<ReturnType>
181 ```