import { weatherTool } from './weather.js'; import { calculatorTool } from './calculator.js'; import { guessTool } from './guess.js'; import { Tool } from '../types/index.js'; import { subAgentTools } from '../agents/tools.js'; import { knowledgeTools } from '../knowledge/search-tool.js'; const baseTools: Tool[] = [weatherTool, calculatorTool, guessTool, ...knowledgeTools]; /** 所有工具(基础工具 + sub-agent 管理工具),供主 orchestrator Agent 使用 */ const allTools: Tool[] = [...baseTools, ...subAgentTools]; /** 返回基础工具列表(供子 Agent 使用,不含 sub-agent 管理工具以防递归) */ export function getTools(): Tool[] { return baseTools; } /** 返回全部工具列表(供主 orchestrator Agent 使用) */ export function getOrchestratorTools(): Tool[] { return allTools; } export function getOpenAITools() { return baseTools.map((t) => ({ type: 'function' as const, function: { name: t.name, description: t.description, parameters: t.parameters, }, })); } export function findTool(name: string): Tool | undefined { return allTools.find((t) => t.name === name); }