summaryrefslogtreecommitdiff
path: root/packages/core/src/config/config.ts
diff options
context:
space:
mode:
authorN. Taylor Mullen <[email protected]>2025-06-03 00:40:51 -0700
committerGitHub <[email protected]>2025-06-03 07:40:51 +0000
commitc71d6ddc3b6dd68bde40cc2b208825ba173f3ba1 (patch)
treea789821be849e9a2b7debe3870a7caeb736f89a8 /packages/core/src/config/config.ts
parent5f6f6a95a2de30373665aae5472e2a5bb2bc25fb (diff)
Fix: Ensure MCP tools are discovered from slow-starting servers (#717)
Diffstat (limited to 'packages/core/src/config/config.ts')
-rw-r--r--packages/core/src/config/config.ts14
1 files changed, 5 insertions, 9 deletions
diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts
index 7b0be08d..46e5123c 100644
--- a/packages/core/src/config/config.ts
+++ b/packages/core/src/config/config.ts
@@ -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;
+ })();
}