diff options
| author | Tommaso Sciortino <[email protected]> | 2025-07-18 14:29:09 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-18 21:29:09 +0000 |
| commit | b5f5ea2c31e296bc1f51cd315badbd4f40c99059 (patch) | |
| tree | d0ae2dc9d990869f4b33af7a42fac1eb06ff748d /packages/core/src/tools/tool-registry.ts | |
| parent | d7041a6595c1d67c19e2e94866c788b157fa9fb1 (diff) | |
Use simple name for MCP tools where possible. (#4459)
Diffstat (limited to 'packages/core/src/tools/tool-registry.ts')
| -rw-r--r-- | packages/core/src/tools/tool-registry.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/core/src/tools/tool-registry.ts b/packages/core/src/tools/tool-registry.ts index e6a4121d..d6e84de3 100644 --- a/packages/core/src/tools/tool-registry.ts +++ b/packages/core/src/tools/tool-registry.ts @@ -18,7 +18,7 @@ type ToolParams = Record<string, unknown>; export class DiscoveredTool extends BaseTool<ToolParams, ToolResult> { constructor( private readonly config: Config, - readonly name: string, + name: string, readonly description: string, readonly parameterSchema: Record<string, unknown>, ) { @@ -138,10 +138,14 @@ export class ToolRegistry { */ registerTool(tool: Tool): void { if (this.tools.has(tool.name)) { - // Decide on behavior: throw error, log warning, or allow overwrite - console.warn( - `Tool with name "${tool.name}" is already registered. Overwriting.`, - ); + if (tool instanceof DiscoveredMCPTool) { + tool = tool.asFullyQualifiedTool(); + } else { + // Decide on behavior: throw error, log warning, or allow overwrite + console.warn( + `Tool with name "${tool.name}" is already registered. Overwriting.`, + ); + } } this.tools.set(tool.name, tool); } |
