diff --git a/packages/core/src/agents/local-executor.test.ts b/packages/core/src/agents/local-executor.test.ts index 32499bbaf1..ba2a84345a 100644 --- a/packages/core/src/agents/local-executor.test.ts +++ b/packages/core/src/agents/local-executor.test.ts @@ -348,10 +348,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 }), ); @@ -779,6 +778,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 c9e4341f03..113ee18f91 100644 --- a/packages/core/src/agents/local-executor.ts +++ b/packages/core/src/agents/local-executor.ts @@ -1329,9 +1329,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.