diff --git a/packages/core/src/agents/local-executor.test.ts b/packages/core/src/agents/local-executor.test.ts index fb21e1093d..f7f56288e7 100644 --- a/packages/core/src/agents/local-executor.test.ts +++ b/packages/core/src/agents/local-executor.test.ts @@ -344,10 +344,9 @@ describe('LocalAgentExecutor', () => { get: () => 'test-prompt-id', configurable: true, }); - parentToolRegistry = new ToolRegistry(mockConfig, mockConfig.messageBus); - parentToolRegistry.registerTool( - new LSTool(mockConfig, mockConfig.messageBus), - ); + const { messageBus } = mockConfig as unknown as { messageBus: MessageBus }; + parentToolRegistry = new ToolRegistry(mockConfig, messageBus); + parentToolRegistry.registerTool(new LSTool(mockConfig, messageBus)); parentToolRegistry.registerTool( new MockTool({ name: READ_FILE_TOOL_NAME }), ); @@ -687,6 +686,25 @@ describe('LocalAgentExecutor', () => { // Assert that there is exactly ONE schema for this tool expect(foundSchemas).toHaveLength(1); }); + + it('should provide tools to the model when toolConfig is OMITTED (default to all tools)', async () => { + const fullDefinition = createTestDefinition(); + const { toolConfig: _, ...definition } = fullDefinition; + + const executor = await LocalAgentExecutor.create( + definition as LocalAgentDefinition, + mockConfig, + onActivity, + ); + + const toolsList = ( + executor as unknown as { prepareToolsList: () => FunctionDeclaration[] } + ).prepareToolsList(); + + // Verify that LS_TOOL_NAME is in the list (since LS was registered in beforeEach) + const toolNames = toolsList.map((t) => t.name); + expect(toolNames).toContain(LS_TOOL_NAME); + }); }); describe('run (Execution Loop and Logic)', () => { diff --git a/packages/core/src/agents/local-executor.ts b/packages/core/src/agents/local-executor.ts index ed26f634a0..47934ef170 100644 --- a/packages/core/src/agents/local-executor.ts +++ b/packages/core/src/agents/local-executor.ts @@ -1335,9 +1335,13 @@ export class LocalAgentExecutor { toolsList.push(toolRef); } } - // Add schemas from tools that were explicitly registered by name, wildcard, or instance. - toolsList.push(...this.toolRegistry.getFunctionDeclarations()); } + // Add schemas from tools that were explicitly registered by name, wildcard, or instance. + toolsList.push( + ...this.toolRegistry.getFunctionDeclarations( + this.definition.modelConfig.model, + ), + ); // Always inject complete_task. // Configure its schema based on whether output is expected.