Skip to content

Commit c69f65a

Browse files
committed
feat: Enhance ToolOverrideOptions interface with additional properties and remove deprecated callInternalTool method
1 parent f73aeee commit c69f65a

File tree

9 files changed

+22
-896
lines changed

9 files changed

+22
-896
lines changed

packages/core/src/compose.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ interface ComposedTool extends Tool {
2727
const ALL_TOOLS_PLACEHOLDER = "__ALL__";
2828

2929
export interface ToolOverrideOptions {
30+
/** Override the tool's description */
3031
description?: string;
32+
/** Hide the tool from composed tools context (tool will not appear in agentic/workflow execution) */
3133
hide?: boolean;
34+
/** Register the tool as a global tool in the server's public tool list (available server-wide) */
35+
global?: boolean;
36+
/** Transform the arguments before passing to the tool handler */
3237
args?: (originalArgs: unknown) => unknown;
38+
/** Custom handler to replace the original tool execution */
3339
handler?: ToolCallback;
3440
}
3541

@@ -165,16 +171,6 @@ export class ComposableMCPServer extends Server {
165171
return await callback(processedArgs);
166172
}
167173

168-
/**
169-
* @deprecated Use callTool() instead. This method will be removed in a future version.
170-
*/
171-
callInternalTool(name: string, args: unknown): Promise<unknown> {
172-
console.warn(
173-
`callInternalTool() is deprecated. Use callTool() instead for: ${name}`,
174-
);
175-
return this.callTool(name, args);
176-
}
177-
178174
/**
179175
* Get all available tool names (including internal tools)
180176
*/
@@ -234,11 +230,13 @@ export class ComposableMCPServer extends Server {
234230
const toolName = toolEl.attribs.name;
235231
const toolDescription = toolEl.attribs.description;
236232
const isHidden = toolEl.attribs.hide !== undefined;
233+
const isGlobal = toolEl.attribs.global !== undefined;
237234

238-
if (toolName && (toolDescription || isHidden)) {
235+
if (toolName && (toolDescription || isHidden || isGlobal)) {
239236
this.toolOverrides.set(toolName, {
240237
description: toolDescription,
241238
hide: isHidden,
239+
global: isGlobal,
242240
});
243241
}
244242
});
@@ -343,15 +341,26 @@ export class ComposableMCPServer extends Server {
343341
tool.execute = override.handler;
344342
}
345343
if (override.hide) {
346-
// Move to hidden tools instead of internal tools
344+
// Hide from composed tools context - tool won't be available in agentic/workflow execution
345+
// but can still be called directly via callTool()
347346
const finalHandler = override.handler || tool.execute;
348347
this.hiddenTools.set(toolId, finalHandler);
349348
delete tools[toolId];
349+
} else if (override.global) {
350+
// Register as a global tool in the server's public tool list
351+
// This makes the tool available server-wide via MCP protocol, not just in composed tool context
352+
const globalTool: Tool = {
353+
name: toolId,
354+
description: tool.description,
355+
inputSchema: tool.inputSchema as Tool["inputSchema"],
356+
};
357+
this.tools = [...this.tools, globalTool];
358+
this.nameToCb.set(toolId, tool.execute);
350359
}
351360
}
352361
});
353362

354-
// Store composed tools for callInternalTool access
363+
// Store composed tools for callTool access
355364
Object.entries(tools).forEach(([toolId, tool]) => {
356365
this.composedTools.set(toolId, tool.execute);
357366
});

packages/core/tests/ai_test.ts

Lines changed: 0 additions & 249 deletions
This file was deleted.

0 commit comments

Comments
 (0)