@measey/mycoder-agent
Version:
Agent module for mycoder - an AI-powered software development assistant
63 lines • 2.59 kB
JavaScript
// Import tools
import { agentDoneTool } from './agent/agentDone.js';
import { agentExecuteTool } from './agent/agentExecute.js';
import { agentMessageTool } from './agent/agentMessage.js';
import { agentStartTool } from './agent/agentStart.js';
import { listAgentsTool } from './agent/listAgents.js';
import { fetchTool } from './fetch/fetch.js';
import { userMessageTool } from './interaction/userMessage.js';
import { userPromptTool } from './interaction/userPrompt.js';
import { createMcpTool } from './mcp.js';
import { listSessionsTool } from './session/listSessions.js';
import { sessionMessageTool } from './session/sessionMessage.js';
import { sessionStartTool } from './session/sessionStart.js';
import { listShellsTool } from './shell/listShells.js';
import { shellMessageTool } from './shell/shellMessage.js';
import { shellStartTool } from './shell/shellStart.js';
import { waitTool } from './sleep/wait.js';
import { textEditorTool } from './textEditor/textEditor.js';
import { thinkTool } from './think/think.js';
export function getTools(options) {
const userPrompt = options?.userPrompt !== false; // Default to true if not specified
const mcpConfig = options?.mcpConfig || { servers: [], defaultResources: [] };
const subAgentMode = options?.subAgentMode || 'disabled'; // Default to disabled mode
// Force cast to Tool type to avoid TypeScript issues
const tools = [
textEditorTool,
fetchTool,
shellStartTool,
shellMessageTool,
listShellsTool,
sessionStartTool,
sessionMessageTool,
listSessionsTool,
waitTool,
thinkTool,
];
// Add agent tools based on the configured mode
if (subAgentMode === 'sync') {
// For sync mode, include only agentExecute and agentDone
tools.push(agentExecuteTool);
tools.push(agentDoneTool);
}
else if (subAgentMode === 'async') {
// For async mode, include all async agent tools
tools.push(agentStartTool);
tools.push(agentMessageTool);
tools.push(listAgentsTool);
tools.push(agentDoneTool);
}
// For 'disabled' mode, no agent tools are added
// Only include user interaction tools if enabled
if (userPrompt) {
tools.push(userPromptTool);
tools.push(userMessageTool);
}
// Add MCP tool if we have any servers configured
if (mcpConfig.servers && mcpConfig.servers.length > 0) {
const mcpTool = createMcpTool(mcpConfig);
tools.push(mcpTool);
}
return tools;
}
//# sourceMappingURL=getTools.js.map