diff options
Diffstat (limited to 'packages/core/src')
| -rw-r--r-- | packages/core/src/tools/tool-registry.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/core/src/tools/tool-registry.ts b/packages/core/src/tools/tool-registry.ts index bce51a93..21aec687 100644 --- a/packages/core/src/tools/tool-registry.ts +++ b/packages/core/src/tools/tool-registry.ts @@ -137,10 +137,16 @@ export class ToolRegistry { // discover tools using discovery command, if configured const discoveryCmd = this.config.getToolDiscoveryCommand(); if (discoveryCmd) { - // execute discovery command and extract function declarations + // execute discovery command and extract function declarations (w/ or w/o "tool" wrappers) const functions: FunctionDeclaration[] = []; for (const tool of JSON.parse(execSync(discoveryCmd).toString().trim())) { - functions.push(...tool['function_declarations']); + if (tool['function_declarations']) { + functions.push(...tool['function_declarations']); + } else if (tool['functionDeclarations']) { + functions.push(...tool['functionDeclarations']); + } else if (tool['name']) { + functions.push(tool); + } } // register each function as a tool for (const func of functions) { |
