Skip to main content
Glama
pc-style

MCP Goose Subagents Server

delegate_to_subagents

Delegate development tasks to specialized autonomous agents for parallel or sequential execution, enabling team-based AI development workflows.

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 that implements the delegate_to_subagents tool. It parses input arguments, generates a delegation prompt, spawns Goose CLI processes for the specified subagents, tracks the session, and returns a response 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 defining the parameters for the delegate_to_subagents tool, including task, agents array, 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)
    Registration of the delegate_to_subagents tool in the ListTools response, including name, description, and full input schema.
    {
      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']
      }
    },
  • src/index.js:144-169 (registration)
    Tool call request handler registration with switch case dispatching 'delegate_to_subagents' to its handler function.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      try {
        switch (name) {
          case 'delegate_to_subagents':
            return await this.delegateToSubagents(args);
          case 'create_goose_recipe':
            return await this.createGooseRecipe(args);
          case 'list_active_subagents':
            return await this.listActiveSubagents();
          case 'get_subagent_results':
            return await this.getSubagentResults(args);
          default:
            throw new McpError(
              ErrorCode.MethodNotFound,
              `Unknown tool: ${name}`
            );
        }
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Error executing ${name}: ${error.message}`
        );
      }
    });
  • Helper function that generates the prompt sent to Goose CLI for delegating the task to specified subagents.
      createDelegationPrompt(task, agents, execution_mode) {
        const agentDescriptions = agents.map(agent => {
          let description = `${agent.role} with instructions: "${agent.instructions}"`;
          if (agent.recipe) {
            description += ` using recipe "${agent.recipe}"`;
          }
          return description;
        }).join(', ');
    
        const executionPhrase = execution_mode === 'parallel' 
          ? 'in parallel simultaneously' 
          : 'sequentially one after another';
    
        return `Use ${agents.length} subagents working ${executionPhrase} to complete this task: "${task}".
    
    Create these specialized subagents: ${agentDescriptions}.
    
    Each subagent should work independently on their assigned part of the task. Provide a comprehensive summary of all results when complete.`;
      }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but only mentions delegation for autonomous development. It omits critical details such as whether this is a read-only or mutating operation, authentication requirements, rate limits, error handling, or what happens after delegation (e.g., asynchronous execution). The description is insufficient for a tool with complex parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality without unnecessary words. It earns its place by clearly stating the tool's purpose, making it appropriately sized and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (4 parameters, no output schema, no annotations), the description is incomplete. It fails to explain behavioral traits, return values, or usage context, leaving significant gaps for an agent to understand how to invoke it correctly and what to expect, despite the schema covering parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond implying delegation involves tasks and subagents, which aligns with the schema but doesn't enhance understanding of parameter usage or interactions. Baseline 3 is appropriate as the schema handles parameter documentation adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as delegating tasks to Goose CLI subagents for autonomous development, specifying both the action (delegate) and target (subagents). It distinguishes from siblings like create_goose_recipe (recipe creation) and get_subagent_results (result retrieval), but doesn't explicitly contrast with list_active_subagents (listing agents).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like get_subagent_results for checking outcomes or list_active_subagents for monitoring. It lacks context about prerequisites, appropriate scenarios, or exclusions, offering only a basic functional statement without usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/pc-style/goose-mcp'

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