fix: Prevent duplicate or inactive tools/prompts after server refresh (#5850)

This commit is contained in:
Harold Mciver
2025-08-13 19:31:24 +00:00
committed by GitHub
parent c0c0e9b7a0
commit 8fae227e8d
5 changed files with 36 additions and 1 deletions

View File

@@ -158,6 +158,18 @@ export class ToolRegistry {
}
}
/**
* Removes all tools from a specific MCP server.
* @param serverName The name of the server to remove tools from.
*/
removeMcpToolsByServer(serverName: string): void {
for (const [name, tool] of this.tools.entries()) {
if (tool instanceof DiscoveredMCPTool && tool.serverName === serverName) {
this.tools.delete(name);
}
}
}
/**
* Discovers tools from project (if available and configured).
* Can be called multiple times to update discovered tools.