@devries-cameron20 / composio-1 / commits / 153afd7a4
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.

refactor: rename local tool internals to custom tool

- LocalToolsMap → CustomToolsMap, LocalToolsMapEntry → CustomToolsMapEntry - LocalToolDefinition → CustomToolDefinition - findLocalTool → findCustomTool, executeLocalTool → executeCustomTool - buildLocalToolsMap → buildCustomToolsMap, serializeLocalTools → serializeCustomTools - hasLocalTools → hasCustomTools, localToolsMap → customToolsMap - localToolExecution.ts → customToolExecution.ts - API payload: local_tools → custom_tools - Error messages now say "Custom tool" and hint about COMPOSIO_MULTI_EXECUTE_TOOL - LOCAL_ prefix and localTools() method stay as agent-facing terminology Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Dhawal Upadhyay committed Mar 10, 2026 at 21:32 UTC 153afd7a4550943829964724a3791f82aa9224bc
7 files changed +89 -89
ts/packages/core/src/models/CustomTool.ts
+11 -11
@@ -21,9 +21,9 @@ import {
21 type CreateCustomToolParams,
22 type CustomTool,
23 type CustomToolExecuteFn,
24 - type LocalToolsMap,
25 - type LocalToolsMapEntry,
26 - type LocalToolDefinition,
24 + type CustomToolsMap,
25 + type CustomToolsMapEntry,
26 + type CustomToolDefinition,
27 type InputParamsSchema,
28 } from '../types/customTool.types';
29
@@ -128,7 +128,7 @@ export function createCustomTool<T extends z.ZodType>(
128 }
129
130 /**
131 - * Build a LocalToolsMap from an array of custom tools.
131 + * Build a CustomToolsMap from an array of custom tools.
132 * Used internally by ToolRouter.create() to construct the per-session routing map.
133 *
134 * @internal
@@ -136,9 +136,9 @@ export function createCustomTool<T extends z.ZodType>(
136 * @returns Maps for O(1) lookup by both prefixed and original slug
137 * @throws If duplicate slugs are detected
138 */
139 -export function buildLocalToolsMap(tools: CustomTool[]): LocalToolsMap {
140 - const byPrefixed = new Map<string, LocalToolsMapEntry>();
141 - const byOriginal = new Map<string, LocalToolsMapEntry>();
139 +export function buildCustomToolsMap(tools: CustomTool[]): CustomToolsMap {
140 + const byPrefixed = new Map<string, CustomToolsMapEntry>();
141 + const byOriginal = new Map<string, CustomToolsMapEntry>();
142
143 for (const handle of tools) {
144 const upperSlug = handle.slug.toUpperCase();
@@ -148,7 +148,7 @@ export function buildLocalToolsMap(tools: CustomTool[]): LocalToolsMap {
148 throw new Error(`createCustomTool: duplicate slug "${handle.slug}"`);
149 }
150
151 - const entry: LocalToolsMapEntry = { handle, prefixedSlug };
151 + const entry: CustomToolsMapEntry = { handle, prefixedSlug };
152 byPrefixed.set(prefixedSlug, entry);
153 byOriginal.set(upperSlug, entry);
154 }
@@ -161,11 +161,11 @@ export function buildLocalToolsMap(tools: CustomTool[]): LocalToolsMap {
161 *
162 * @internal
163 * @param tools - The custom tools to serialize
164 - * @returns Array of LocalToolDefinition for the API payload
164 + * @returns Array of CustomToolDefinition for the API payload
165 */
166 -export function serializeLocalTools(
166 +export function serializeCustomTools(
167 tools: CustomTool[]
168 -): LocalToolDefinition[] {
168 +): CustomToolDefinition[] {
169 return tools.map(handle => ({
170 slug: handle.slug,
171 name: handle.name,
ts/packages/core/src/models/ToolRouter.ts
+10 -10
@@ -38,8 +38,8 @@ import {
38 transformToolRouterToolkitsParams,
39 } from '../lib/toolRouterParams';
40 import { ToolRouterSession } from './ToolRouterSession';
41 -import { buildLocalToolsMap, serializeLocalTools } from './CustomTool';
42 -import type { LocalToolsMap, LocalToolDefinition } from '../types/customTool.types';
41 +import { buildCustomToolsMap, serializeCustomTools } from './CustomTool';
42 +import type { CustomToolsMap, CustomToolDefinition } from '../types/customTool.types';
43
44 export class ToolRouter<
45 TToolCollection,
@@ -96,11 +96,11 @@ export class ToolRouter<
96 ): Promise<Session<TToolCollection, TTool, TProvider>> {
97 const routerConfig = ToolRouterCreateSessionConfigSchema.parse(config ?? {});
98
99 - // Build local tools map and backend payload from custom tool handles
100 - let localToolsMap: LocalToolsMap | undefined;
99 + // Build custom tools map and backend payload from custom tool handles
100 + let customToolsMap: CustomToolsMap | undefined;
101 const customTools = routerConfig.customTools;
102
103 - const payload: SessionCreateParams & { local_tools?: LocalToolDefinition[] } = {
103 + const payload: SessionCreateParams & { custom_tools?: CustomToolDefinition[] } = {
104 user_id: userId,
105 auth_configs: routerConfig.authConfigs,
106 connected_accounts: routerConfig.connectedAccounts,
@@ -121,10 +121,10 @@ export class ToolRouter<
121 };
122
123 if (customTools?.length) {
124 - localToolsMap = buildLocalToolsMap(customTools);
125 - // Send definitions to backend for BM25 search indexing
126 - // Type assertion: @composio/client doesn't have local_tools yet (Hermes PR #8453)
127 - payload.local_tools = serializeLocalTools(customTools);
124 + customToolsMap = buildCustomToolsMap(customTools);
125 + // Send definitions to backend for search indexing
126 + // Type assertion: @composio/client doesn't have custom_tools yet
127 + payload.custom_tools = serializeCustomTools(customTools);
128 }
129
130 const session = await this.client.toolRouter.session.create(
@@ -140,7 +140,7 @@ export class ToolRouter<
140 session.session_id,
141 this.createMCPServerConfig(session.mcp),
142 { assistivePrompt },
143 - localToolsMap,
143 + customToolsMap,
144 userId
145 );
146 }
ts/packages/core/src/models/ToolRouterSession.ts
+23 -23
@@ -25,10 +25,10 @@ import { ToolkitConnectionStateSchema } from '../types/toolRouter.types';
25 import { ValidationError } from '../errors';
26 import { Tools } from './Tools';
27 import { ToolRouterSessionFilesMount } from './ToolRouterSessionFileMount';
28 -import type { LocalToolsMap, LocalToolsMapEntry, SessionContext } from '../types/customTool.types';
28 +import type { CustomToolsMap, CustomToolsMapEntry, SessionContext } from '../types/customTool.types';
29 import type { Tool, ToolExecuteResponse } from '../types/tool.types';
30 import { SessionContextImpl } from './SessionContext';
31 -import { findLocalTool, executeLocalTool } from './localToolExecution';
31 +import { findCustomTool, executeCustomTool } from './customToolExecution';
32
33 const COMPOSIO_MULTI_EXECUTE_TOOL = 'COMPOSIO_MULTI_EXECUTE_TOOL';
34 const COMPOSIO_EXECUTE_LOCAL_TOOL = 'COMPOSIO_EXECUTE_LOCAL_TOOL';
@@ -48,10 +48,10 @@ export class ToolRouterSession<
48 sessionId: string,
49 mcp: ToolRouterMCPServerConfig,
50 experimentalOverrides?: Pick<SessionExperimental, 'assistivePrompt'>,
51 - private readonly localToolsMap?: LocalToolsMap,
51 + private readonly customToolsMap?: CustomToolsMap,
52 private readonly userId?: string
53 ) {
54 - if (localToolsMap && !userId) {
54 + if (customToolsMap && !userId) {
55 throw new Error('userId is required when custom tools are bound to a session.');
56 }
57 this.sessionId = sessionId;
@@ -77,7 +77,7 @@ export class ToolRouterSession<
77 modifiers?.modifySchema ? { modifySchema: modifiers.modifySchema } : undefined
78 );
79
80 - if (this.hasLocalTools()) {
80 + if (this.hasCustomTools()) {
81 // Create an execute function that splits local/remote tools in COMPOSIO_MULTI_EXECUTE_TOOL
82 const routingExecuteFn = async (
83 toolSlug: string,
@@ -89,15 +89,15 @@ export class ToolRouterSession<
89 if (toolSlug === COMPOSIO_EXECUTE_LOCAL_TOOL) {
90 const slug = String(input.tool_slug ?? '');
91 const args = (input.arguments as Record<string, unknown> | undefined) ?? {};
92 - const entry = findLocalTool(this.localToolsMap, slug);
92 + const entry = findCustomTool(this.customToolsMap, slug);
93 if (!entry) {
94 return {
95 data: {},
96 - error: `Local tool "${slug}" not found`,
96 + error: `Custom tool "${slug}" not found. If this is a remote tool, execute it via COMPOSIO_MULTI_EXECUTE_TOOL.`,
97 successful: false,
98 };
99 }
100 - return executeLocalTool(entry, args, this.buildSessionContext());
100 + return executeCustomTool(entry, args, this.buildSessionContext());
101 }
102 // Non-multi-execute meta tools always go to backend
103 return ToolsModel.executeMetaTool(
@@ -143,7 +143,7 @@ export class ToolRouterSession<
143 * ```
144 */
145 async localTools(): Promise<ReturnType<TProvider['wrapTools']>> {
146 - if (!this.hasLocalTools()) {
146 + if (!this.hasCustomTools()) {
147 throw new Error('No custom tools are bound to this session.');
148 }
149 if (!this.config?.provider) {
@@ -154,7 +154,7 @@ export class ToolRouterSession<
154 }
155
156 // Collect local tool slugs and descriptions for the schema
157 - const toolEntries = Array.from(this.localToolsMap!.byOriginal.entries());
157 + const toolEntries = Array.from(this.customToolsMap!.byOriginal.entries());
158 const slugDescriptions = toolEntries
159 .map(([slug, entry]) => `- ${entry.prefixedSlug}: ${entry.handle.description}`)
160 .join('\n');
@@ -190,16 +190,16 @@ export class ToolRouterSession<
190 const slug = String(input.tool_slug ?? '');
191 const args = (input.arguments as Record<string, unknown> | undefined) ?? {};
192
193 - const entry = findLocalTool(this.localToolsMap, slug);
193 + const entry = findCustomTool(this.customToolsMap, slug);
194 if (!entry) {
195 return {
196 data: {},
197 - error: `Local tool "${slug}" not found. Available: ${toolEntries.map(([, e]) => e.prefixedSlug).join(', ')}`,
197 + error: `Custom tool "${slug}" not found. Available: ${toolEntries.map(([, e]) => e.prefixedSlug).join(', ')}. If this is a remote tool, execute it via COMPOSIO_MULTI_EXECUTE_TOOL.`,
198 successful: false,
199 };
200 }
201
202 - return executeLocalTool(entry, args, this.buildSessionContext());
202 + return executeCustomTool(entry, args, this.buildSessionContext());
203 };
204
205 return this.config.provider.wrapTools([tool], executeFn) as ReturnType<
@@ -312,9 +312,9 @@ export class ToolRouterSession<
312 arguments_?: Record<string, unknown>
313 ): Promise<ToolRouterSessionExecuteResponse> {
314 // Check if this is a local tool (by original or prefixed slug)
315 - const entry = findLocalTool(this.localToolsMap, toolSlug);
315 + const entry = findCustomTool(this.customToolsMap, toolSlug);
316 if (entry) {
317 - const result = await executeLocalTool(entry, arguments_ ?? {}, this.buildSessionContext());
317 + const result = await executeCustomTool(entry, arguments_ ?? {}, this.buildSessionContext());
318 return {
319 data: result.data,
320 error: result.error,
@@ -333,9 +333,9 @@ export class ToolRouterSession<
333
334 // ── Private helpers ──────────────────────────────────────────
335
336 - /** Check if this session has any local tools bound. */
337 - private hasLocalTools(): boolean {
338 - return (this.localToolsMap?.byPrefixed.size ?? 0) > 0;
336 + /** Check if this session has any custom tools bound. */
337 + private hasCustomTools(): boolean {
338 + return (this.customToolsMap?.byPrefixed.size ?? 0) > 0;
339 }
340
341 /**
@@ -349,9 +349,9 @@ export class ToolRouterSession<
349 this.userId!,
350 this.sessionId,
351 (slug, args) => {
352 - const entry = findLocalTool(this.localToolsMap, slug);
352 + const entry = findCustomTool(this.customToolsMap, slug);
353 if (!entry) return undefined;
354 - return executeLocalTool(entry, args, this.buildSessionContext());
354 + return executeCustomTool(entry, args, this.buildSessionContext());
355 }
356 );
357 }
@@ -391,10 +391,10 @@ export class ToolRouterSession<
391 const parsed = toolItems.map(item => this.parseToolItem(item));
392
393 // Partition into local (with resolved entry) and remote
394 - const localItems: Array<{ index: number; entry: LocalToolsMapEntry }> = [];
394 + const localItems: Array<{ index: number; entry: CustomToolsMapEntry }> = [];
395 const remoteIndices: number[] = [];
396 for (let i = 0; i < parsed.length; i++) {
397 - const entry = findLocalTool(this.localToolsMap, parsed[i].tool_slug);
397 + const entry = findCustomTool(this.customToolsMap, parsed[i].tool_slug);
398 if (entry) {
399 localItems.push({ index: i, entry });
400 } else {
@@ -413,7 +413,7 @@ export class ToolRouterSession<
413
414 // Execute local tools in parallel
415 const localPromises = localItems.map(async ({ index, entry }) => {
416 - const result = await executeLocalTool(entry, parsed[index].arguments, this.buildSessionContext());
416 + const result = await executeCustomTool(entry, parsed[index].arguments, this.buildSessionContext());
417 return { index, result };
418 });
419
ts/packages/core/src/models/customToolExecution.ts renamed
+10 -10
@@ -1,32 +1,32 @@
1 /**
2 - * @fileoverview Standalone functions for local tool lookup and execution.
2 + * @fileoverview Standalone functions for custom tool lookup and execution.
3 * Extracted from ToolRouterSession for reuse in SessionContextImpl (sibling routing).
4 */
5 -import type { LocalToolsMap, LocalToolsMapEntry, SessionContext } from '../types/customTool.types';
5 +import type { CustomToolsMap, CustomToolsMapEntry, SessionContext } from '../types/customTool.types';
6 import type { ToolExecuteResponse } from '../types/tool.types';
7
8 /**
9 - * Find a local tool entry by slug.
9 + * Find a custom tool entry by slug.
10 * Checks both the prefixed map (LOCAL_X — agent path) and original map (X — programmatic path).
11 */
12 -export function findLocalTool(
13 - map: LocalToolsMap | undefined,
12 +export function findCustomTool(
13 + map: CustomToolsMap | undefined,
14 slug: string
15 -): LocalToolsMapEntry | undefined {
15 +): CustomToolsMapEntry | undefined {
16 if (!map) return undefined;
17 const upper = slug.toUpperCase();
18 return map.byPrefixed.get(upper) ?? map.byOriginal.get(upper);
19 }
20
21 /**
22 - * Execute a local tool in-process.
22 + * Execute a custom tool in-process.
23 * Validates input via the Zod schema, calls the user's execute function,
24 * and wraps the result into the standard response format.
25 *
26 - * Callers provide a pre-built SessionContext (which may include sibling local routing).
26 + * Callers provide a pre-built SessionContext (which may include sibling routing).
27 */
28 -export async function executeLocalTool(
29 - entry: LocalToolsMapEntry,
28 +export async function executeCustomTool(
29 + entry: CustomToolsMapEntry,
30 arguments_: Record<string, unknown>,
31 sessionContext: SessionContext
32 ): Promise<ToolExecuteResponse> {
ts/packages/core/src/types/customTool.types.ts
+8 -8
@@ -147,8 +147,8 @@ export interface CustomTool {
147 readonly execute: CustomToolExecuteFn<z.ZodType>;
148 }
149
150 -/** Serialized tool definition sent to backend for BM25 search indexing. */
151 -export interface LocalToolDefinition {
150 +/** Serialized tool definition sent to backend for search indexing. */
151 +export interface CustomToolDefinition {
152 slug: string;
153 name: string;
154 description: string;
@@ -156,16 +156,16 @@ export interface LocalToolDefinition {
156 toolkit?: string;
157 }
158
159 -/** @internal Entry in the per-session local tools routing map. */
160 -export type LocalToolsMapEntry = {
159 +/** @internal Entry in the per-session custom tools routing map. */
160 +export type CustomToolsMapEntry = {
161 handle: CustomTool;
162 prefixedSlug: string;
163 };
164
165 -/** @internal Lookup maps used by ToolRouterSession for routing. */
166 -export type LocalToolsMap = {
165 +/** @internal Lookup maps used by ToolRouterSession for routing custom tools. */
166 +export type CustomToolsMap = {
167 /** Lookup by prefixed slug (e.g. LOCAL_GET_USER_CONTEXT) — used for agent execution path */
168 - byPrefixed: Map<string, LocalToolsMapEntry>;
168 + byPrefixed: Map<string, CustomToolsMapEntry>;
169 /** Lookup by original slug (e.g. GET_USER_CONTEXT) — used for programmatic session.execute() */
170 - byOriginal: Map<string, LocalToolsMapEntry>;
170 + byOriginal: Map<string, CustomToolsMapEntry>;
171 };
ts/packages/core/test/models/customTool.test.ts
+10 -10
@@ -1,6 +1,6 @@
1 import { describe, it, expect, vi, beforeEach } from 'vitest';
2 import { z } from 'zod/v3';
3 -import { createCustomTool, buildLocalToolsMap, serializeLocalTools, LOCAL_TOOL_PREFIX } from '../../src/models/CustomTool';
3 +import { createCustomTool, buildCustomToolsMap, serializeCustomTools, LOCAL_TOOL_PREFIX } from '../../src/models/CustomTool';
4 import { SessionContextImpl } from '../../src/models/SessionContext';
5 import type { CustomTool, SessionContext } from '../../src/types/customTool.types';
6
@@ -154,10 +154,10 @@ describe('createCustomTool', () => {
154 });
155
156 // ────────────────────────────────────────────────────────────────
157 -// buildLocalToolsMap()
157 +// buildCustomToolsMap()
158 // ────────────────────────────────────────────────────────────────
159
160 -describe('buildLocalToolsMap', () => {
160 +describe('buildCustomToolsMap', () => {
161 const makeTool = (slug: string): CustomTool => ({
162 slug,
163 name: `Tool ${slug}`,
@@ -169,7 +169,7 @@ describe('buildLocalToolsMap', () => {
169
170 it('should create maps with both prefixed and original slug keys', () => {
171 const tools = [makeTool('MY_TOOL'), makeTool('OTHER_TOOL')];
172 - const map = buildLocalToolsMap(tools);
172 + const map = buildCustomToolsMap(tools);
173
174 expect(map.byPrefixed.size).toBe(2);
175 expect(map.byOriginal.size).toBe(2);
@@ -185,7 +185,7 @@ describe('buildLocalToolsMap', () => {
185
186 it('should handle case-insensitive slugs (uppercased internally)', () => {
187 const tool = makeTool('my_tool');
188 - const map = buildLocalToolsMap([tool]);
188 + const map = buildCustomToolsMap([tool]);
189
190 expect(map.byOriginal.has('MY_TOOL')).toBe(true);
191 expect(map.byPrefixed.has('LOCAL_MY_TOOL')).toBe(true);
@@ -193,16 +193,16 @@ describe('buildLocalToolsMap', () => {
193
194 it('should throw on duplicate slugs', () => {
195 const tools = [makeTool('DUPE'), makeTool('DUPE')];
196 - expect(() => buildLocalToolsMap(tools)).toThrow('duplicate slug "DUPE"');
196 + expect(() => buildCustomToolsMap(tools)).toThrow('duplicate slug "DUPE"');
197 });
198
199 });
200
201 // ────────────────────────────────────────────────────────────────
202 -// serializeLocalTools()
202 +// serializeCustomTools()
203 // ────────────────────────────────────────────────────────────────
204
205 -describe('serializeLocalTools', () => {
205 +describe('serializeCustomTools', () => {
206 it('should serialize tools into backend format', () => {
207 const tool: CustomTool = {
208 slug: 'GET_DATA',
@@ -214,7 +214,7 @@ describe('serializeLocalTools', () => {
214 execute: vi.fn(),
215 };
216
217 - const result = serializeLocalTools([tool]);
217 + const result = serializeCustomTools([tool]);
218
219 expect(result).toEqual([
220 {
@@ -237,7 +237,7 @@ describe('serializeLocalTools', () => {
237 execute: vi.fn(),
238 };
239
240 - const result = serializeLocalTools([tool]);
240 + const result = serializeCustomTools([tool]);
241 expect(result[0]).not.toHaveProperty('toolkit');
242 });
243 });
ts/packages/core/test/models/customToolRouting.test.ts
+17 -17
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
2 import { z } from 'zod/v3';
3 import { ToolRouter } from '../../src/models/ToolRouter';
4 import { ToolRouterSession } from '../../src/models/ToolRouterSession';
5 -import { createCustomTool, buildLocalToolsMap } from '../../src/models/CustomTool';
5 +import { createCustomTool, buildCustomToolsMap } from '../../src/models/CustomTool';
6 import { MockProvider } from '../utils/mocks/provider.mock';
7 import ComposioClient from '@composio/client';
8 import { Tools } from '../../src/models/Tools';
@@ -99,7 +99,7 @@ const createSessionWithProvider = (
99 'sess_123',
100 { type: 'http' as const, url: 'https://mcp.example.com/sess_123' },
101 undefined,
102 - buildLocalToolsMap(customTools),
102 + buildCustomToolsMap(customTools),
103 'user_1'
104 );
105 };
@@ -129,14 +129,14 @@ describe('ToolRouter.create() with customTools', () => {
129 });
130 });
131
132 - it('should send local_tools in the create payload', async () => {
132 + it('should send custom_tools in the create payload', async () => {
133 await router.create('user_1', {
134 toolkits: ['gmail'],
135 customTools: [customToolHandle],
136 });
137
138 const payload = mockClient.toolRouter.session.create.mock.calls[0][0];
139 - expect(payload.local_tools).toEqual([
139 + expect(payload.custom_tools).toEqual([
140 {
141 slug: 'GET_USER_CONTEXT',
142 name: 'Get user context',
@@ -146,22 +146,22 @@ describe('ToolRouter.create() with customTools', () => {
146 ]);
147 });
148
149 - it('should include toolkit in local_tools when toolkit is present', async () => {
149 + it('should include toolkit in custom_tools when toolkit is present', async () => {
150 await router.create('user_1', {
151 customTools: [sessionToolHandle],
152 });
153
154 const payload = mockClient.toolRouter.session.create.mock.calls[0][0];
155 - expect(payload.local_tools[0].toolkit).toBe('meta_ads');
155 + expect(payload.custom_tools[0].toolkit).toBe('meta_ads');
156 });
157
158 - it('should not send local_tools when customTools is omitted or empty', async () => {
158 + it('should not send custom_tools when customTools is omitted or empty', async () => {
159 await router.create('user_1', { toolkits: ['gmail'] });
160 - expect(mockClient.toolRouter.session.create.mock.calls[0][0].local_tools).toBeUndefined();
160 + expect(mockClient.toolRouter.session.create.mock.calls[0][0].custom_tools).toBeUndefined();
161
162 vi.clearAllMocks();
163 await router.create('user_1', { customTools: [] });
164 - expect(mockClient.toolRouter.session.create.mock.calls[0][0].local_tools).toBeUndefined();
164 + expect(mockClient.toolRouter.session.create.mock.calls[0][0].custom_tools).toBeUndefined();
165 });
166
167 it('should return a session with the correct sessionId', async () => {
@@ -184,7 +184,7 @@ describe('ToolRouterSession execution routing', () => {
184 client: ReturnType<typeof createMockClient>,
185 customTools: CustomTool[] = []
186 ) => {
187 - const localToolsMap = customTools.length ? buildLocalToolsMap(customTools) : undefined;
187 + const customToolsMap = customTools.length ? buildCustomToolsMap(customTools) : undefined;
188
189 return new ToolRouterSession(
190 client as unknown as ComposioClient,
@@ -192,7 +192,7 @@ describe('ToolRouterSession execution routing', () => {
192 'sess_123',
193 { type: 'http' as const, url: 'https://mcp.example.com/sess_123' },
194 undefined,
195 - localToolsMap,
195 + customToolsMap,
196 'user_1'
197 );
198 };
@@ -506,7 +506,7 @@ describe('ToolRouterSession execution routing', () => {
506 { apiKey: 'key', provider: new MockProvider() },
507 'sess_123',
508 { type: 'http' as const, url: 'https://mcp.example.com/sess_123' }
509 - // No localToolsMap, no userId
509 + // No customToolsMap, no userId
510 );
511
512 const result = await session.tools();
@@ -884,7 +884,7 @@ describe('ToolRouterSession execution routing', () => {
884
885 describe('provider guard — session.tools() throws without provider', () => {
886 it('should throw when provider is not configured but local tools exist', async () => {
887 - const localToolsMap = buildLocalToolsMap([customToolHandle]);
887 + const customToolsMap = buildCustomToolsMap([customToolHandle]);
888
889 const session = new ToolRouterSession(
890 mockClient as unknown as ComposioClient,
@@ -892,7 +892,7 @@ describe('ToolRouterSession execution routing', () => {
892 'sess_123',
893 { type: 'http' as const, url: 'https://mcp.example.com/sess_123' },
894 undefined,
895 - localToolsMap,
895 + customToolsMap,
896 'user_1'
897 );
898
@@ -953,7 +953,7 @@ describe('ToolRouterSession execution routing', () => {
953 });
954
955 expect(result.successful).toBe(false);
956 - expect(result.error).toContain('Local tool "NON_EXISTENT_TOOL" not found');
956 + expect(result.error).toContain('Custom tool "NON_EXISTENT_TOOL" not found');
957 expect(result.data).toEqual({});
958 });
959
@@ -963,7 +963,7 @@ describe('ToolRouterSession execution routing', () => {
963 { apiKey: 'key', provider: new MockProvider() },
964 'sess_123',
965 { type: 'http' as const, url: 'https://mcp.example.com/sess_123' }
966 - // No localToolsMap, no userId
966 + // No customToolsMap, no userId
967 );
968
969 await expect(session.localTools()).rejects.toThrow(
@@ -1010,7 +1010,7 @@ describe('ToolRouterSession execution routing', () => {
1010 });
1011
1012 expect(result.successful).toBe(false);
1013 - expect(result.error).toContain('Local tool "DOES_NOT_EXIST" not found');
1013 + expect(result.error).toContain('Custom tool "DOES_NOT_EXIST" not found');
1014 expect(result.data).toEqual({});
1015 });
1016 });