Skip to main content
Glama

delegate_to_subagents

Delegate development tasks to specialized autonomous subagents for parallel or sequential execution across roles like backend developers and QA engineers.

Instructions

Delegate tasks to Goose CLI subagents for autonomous development

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYesThe development task to delegate to subagents
agentsYesArray of subagents to create
execution_modeNoHow to execute the subagentsparallel
working_directoryNoWorking directory for the subagents (defaults to current directory)

Implementation Reference

  • The primary handler function for the 'delegate_to_subagents' tool. Parses arguments, generates a delegation prompt using createDelegationPrompt, spawns a Goose CLI process via executeGoose, tracks the session in activeSubagents, and returns a success message with session ID.
    async delegateToSubagents(args) { const { task, agents, execution_mode = 'parallel', working_directory = process.cwd() } = args; const sessionId = uuidv4(); // Ensure Goose alpha features are enabled process.env.ALPHA_FEATURES = 'true'; try { // Create the delegation prompt for Goose const delegationPrompt = this.createDelegationPrompt(task, agents, execution_mode); // Execute Goose with the delegation prompt const gooseProcess = await this.executeGoose(delegationPrompt, working_directory, sessionId); this.activeSubagents.set(sessionId, { task, agents, execution_mode, status: 'running', startTime: new Date(), process: gooseProcess }); return { content: [ { type: 'text', text: `Successfully delegated task to ${agents.length} subagents in ${execution_mode} mode.\n\nSession ID: ${sessionId}\nTask: ${task}\n\nSubagents created:\n${agents.map(agent => `- ${agent.role}: ${agent.instructions}`).join('\n')}\n\nUse get_subagent_results with session_id "${sessionId}" to retrieve results when complete.` } ] }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to delegate to subagents: ${error.message}` ); } }
  • Input schema definition for the 'delegate_to_subagents' tool, specifying required task and agents, optional execution_mode and working_directory.
    inputSchema: { type: 'object', properties: { task: { type: 'string', description: 'The development task to delegate to subagents' }, agents: { type: 'array', items: { type: 'object', properties: { role: { type: 'string', description: 'Agent role (e.g., backend_developer, frontend_developer, qa_engineer)' }, instructions: { type: 'string', description: 'Specific instructions for this agent' }, recipe: { type: 'string', description: 'Optional recipe name to use for this agent' } }, required: ['role', 'instructions'] }, description: 'Array of subagents to create' }, execution_mode: { type: 'string', enum: ['parallel', 'sequential'], default: 'parallel', description: 'How to execute the subagents' }, working_directory: { type: 'string', description: 'Working directory for the subagents (defaults to current directory)' } }, required: ['task', 'agents'] }
  • src/index.js:41-86 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining name, description, and input schema for 'delegate_to_subagents'.
    { name: 'delegate_to_subagents', description: 'Delegate tasks to Goose CLI subagents for autonomous development', inputSchema: { type: 'object', properties: { task: { type: 'string', description: 'The development task to delegate to subagents' }, agents: { type: 'array', items: { type: 'object', properties: { role: { type: 'string', description: 'Agent role (e.g., backend_developer, frontend_developer, qa_engineer)' }, instructions: { type: 'string', description: 'Specific instructions for this agent' }, recipe: { type: 'string', description: 'Optional recipe name to use for this agent' } }, required: ['role', 'instructions'] }, description: 'Array of subagents to create' }, execution_mode: { type: 'string', enum: ['parallel', 'sequential'], default: 'parallel', description: 'How to execute the subagents' }, working_directory: { type: 'string', description: 'Working directory for the subagents (defaults to current directory)' } }, required: ['task', 'agents'] } },
  • Dispatch case in the CallToolRequestSchema handler that routes calls to the delegateToSubagents method.
    case 'delegate_to_subagents': return await this.delegateToSubagents(args);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lordstyled55/goose-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server