summaryrefslogtreecommitdiff
path: root/packages/server/src/config/config.ts
diff options
context:
space:
mode:
authorolcan <[email protected]>2025-05-03 19:57:28 -0700
committerOlcan <[email protected]>2025-05-05 17:10:45 -0700
commit6b6eef5b80f2cb01ba7b5b94074f8f56937ad04d (patch)
tree988149b0e2c96de4f9d9b96f2c82a30c1be518b7 /packages/server/src/config/config.ts
parent2cd976987e0a4837301df161479e44dfcca6e206 (diff)
support for discovered tools using project settings for discovery and call commands
Diffstat (limited to 'packages/server/src/config/config.ts')
-rw-r--r--packages/server/src/config/config.ts17
1 files changed, 16 insertions, 1 deletions
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<BaseTool<unknown, ToolResult>> = [
@@ -137,5 +151,6 @@ function createToolRegistry(config: Config): ToolRegistry {
for (const tool of tools) {
registry.registerTool(tool);
}
+ registry.discoverTools();
return registry;
}