mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +00:00
Fix: Ensure MCP tools are discovered from slow-starting servers (#717)
This commit is contained in:
parent
5f6f6a95a2
commit
c71d6ddc3b
5 changed files with 95 additions and 35 deletions
|
|
@ -254,7 +254,7 @@ export function createServerConfig(params: ConfigParameters): Config {
|
|||
});
|
||||
}
|
||||
|
||||
function createToolRegistry(config: Config): Promise<ToolRegistry> {
|
||||
export function createToolRegistry(config: Config): Promise<ToolRegistry> {
|
||||
const registry = new ToolRegistry(config);
|
||||
const targetDir = config.getTargetDir();
|
||||
const tools = config.getCoreTools()
|
||||
|
|
@ -281,12 +281,8 @@ function createToolRegistry(config: Config): Promise<ToolRegistry> {
|
|||
registerCoreTool(ShellTool, config);
|
||||
registerCoreTool(MemoryTool);
|
||||
registerCoreTool(WebSearchTool, config);
|
||||
|
||||
// This is async, but we can't wait for it to finish because when we register
|
||||
// discovered tools, we need to see if existing tools already exist in order to
|
||||
// avoid duplicates.
|
||||
registry.discoverTools();
|
||||
|
||||
// Maintain an async registry return so it's easy in the future to add async behavior to this instantiation.
|
||||
return Promise.resolve(registry);
|
||||
return (async () => {
|
||||
await registry.discoverTools();
|
||||
return registry;
|
||||
})();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue