summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/tool-registry.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/core/src/tools/tool-registry.ts')
-rw-r--r--packages/core/src/tools/tool-registry.ts14
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);
}