diff options
| author | Harold Mciver <[email protected]> | 2025-08-13 19:31:24 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-13 19:31:24 +0000 |
| commit | 8fae227e8d53b962f8b7db3abff51906fad1d181 (patch) | |
| tree | 1bf42ec8896ca5d1b6a310a89d36e52028ccd393 /packages/core/src | |
| parent | c0c0e9b7a0a768515181e6ae7defe9f06199ea18 (diff) | |
fix: Prevent duplicate or inactive tools/prompts after server refresh (#5850)
Diffstat (limited to 'packages/core/src')
| -rw-r--r-- | packages/core/src/tools/tool-registry.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/core/src/tools/tool-registry.ts b/packages/core/src/tools/tool-registry.ts index 02f77727..b3625285 100644 --- a/packages/core/src/tools/tool-registry.ts +++ b/packages/core/src/tools/tool-registry.ts @@ -159,6 +159,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. * This will discover tools from the command line and from MCP servers. |
