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

next
ts 29 lines 1.19 KB
Raw
1 import type { SessionExecuteMetaParams } from '@composio/client/resources/tool-router';
2
3 /**
4 * Meta tool slugs handled by `session.executeMeta` instead of `session.execute`.
5 *
6 * The `satisfies` constraint ensures this list stays in sync with the API's
7 * `SessionExecuteMetaParams['slug']` union — a compile error will surface if
8 * a slug is misspelled or if the API adds/removes a meta tool.
9 */
10 const META_TOOL_SLUG_LIST: ReadonlyArray<SessionExecuteMetaParams['slug']> = [
11 'COMPOSIO_SEARCH_TOOLS',
12 'COMPOSIO_MULTI_EXECUTE_TOOL',
13 'COMPOSIO_MANAGE_CONNECTIONS',
14 'COMPOSIO_WAIT_FOR_CONNECTIONS',
15 'COMPOSIO_REMOTE_WORKBENCH',
16 'COMPOSIO_REMOTE_BASH_TOOL',
17 'COMPOSIO_GET_TOOL_SCHEMAS',
18 ];
19
20 const META_TOOL_SLUGS: ReadonlySet<string> = new Set(META_TOOL_SLUG_LIST);
21
22 /**
23 * Meta tools belong to the session, not to any toolkit — nothing to link, and
24 * nothing to attribute them to. Their slugs shadow real toolkits
25 * (`COMPOSIO_SEARCH_TOOLS` looks like a tool of the `composio_search`
26 * toolkit), so anything deriving a toolkit from a slug must check this first.
27 */
28 export const isMetaToolSlug = (slug: string): slug is SessionExecuteMetaParams['slug'] =>
29 META_TOOL_SLUGS.has(slug.toUpperCase());