From 6b6eef5b80f2cb01ba7b5b94074f8f56937ad04d Mon Sep 17 00:00:00 2001 From: olcan Date: Sat, 3 May 2025 19:57:28 -0700 Subject: support for discovered tools using project settings for discovery and call commands --- packages/server/src/config/config.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'packages/server/src/config') diff --git a/packages/server/src/config/config.ts b/packages/server/src/config/config.ts index 82b31902..de70144d 100644 --- a/packages/server/src/config/config.ts +++ b/packages/server/src/config/config.ts @@ -32,6 +32,8 @@ export class Config { private readonly debugMode: boolean, private readonly question: string | undefined, // Keep undefined possibility private readonly fullContext: boolean = false, // Default value here + private readonly toolDiscoveryCommand: string | undefined, + private readonly toolCallCommand: string | undefined, ) { // toolRegistry still needs initialization based on the instance this.toolRegistry = createToolRegistry(this); @@ -67,6 +69,14 @@ export class Config { getFullContext(): boolean { return this.fullContext; } + + getToolDiscoveryCommand(): string | undefined { + return this.toolDiscoveryCommand; + } + + getToolCallCommand(): string | undefined { + return this.toolCallCommand; + } } function findEnvFile(startDir: string): string | null { @@ -100,6 +110,8 @@ export function createServerConfig( debugMode: boolean, question: string, fullContext?: boolean, + toolDiscoveryCommand?: string, + toolCallCommand?: string, ): Config { return new Config( apiKey, @@ -109,11 +121,13 @@ export function createServerConfig( debugMode, question, fullContext, + toolDiscoveryCommand, + toolCallCommand, ); } function createToolRegistry(config: Config): ToolRegistry { - const registry = new ToolRegistry(); + const registry = new ToolRegistry(config); const targetDir = config.getTargetDir(); const tools: Array> = [ @@ -137,5 +151,6 @@ function createToolRegistry(config: Config): ToolRegistry { for (const tool of tools) { registry.registerTool(tool); } + registry.discoverTools(); return registry; } -- cgit v1.2.3