diff options
Diffstat (limited to 'packages/core/src/tools/tool-registry.ts')
| -rw-r--r-- | packages/core/src/tools/tool-registry.ts | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/packages/core/src/tools/tool-registry.ts b/packages/core/src/tools/tool-registry.ts index a6742c06..b72ed9a5 100644 --- a/packages/core/src/tools/tool-registry.ts +++ b/packages/core/src/tools/tool-registry.ts @@ -153,8 +153,9 @@ export class ToolRegistry { /** * 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. */ - async discoverTools(): Promise<void> { + async discoverAllTools(): Promise<void> { // remove any previously discovered tools for (const tool of this.tools.values()) { if (tool instanceof DiscoveredTool || tool instanceof DiscoveredMCPTool) { @@ -174,6 +175,28 @@ export class ToolRegistry { } /** + * Discovers tools from project (if available and configured). + * Can be called multiple times to update discovered tools. + * This will NOT discover tools from the command line, only from MCP servers. + */ + async discoverMcpTools(): Promise<void> { + // remove any previously discovered tools + for (const tool of this.tools.values()) { + if (tool instanceof DiscoveredMCPTool) { + this.tools.delete(tool.name); + } + } + + // discover tools using MCP servers, if configured + await discoverMcpTools( + this.config.getMcpServers() ?? {}, + this.config.getMcpServerCommand(), + this, + this.config.getDebugMode(), + ); + } + + /** * Discover or re-discover tools for a single MCP server. * @param serverName - The name of the server to discover tools from. */ |
