mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
fix: Prevent duplicate or inactive tools/prompts after server refresh (#5850)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user