Skip to main content
Glama

create_goose_recipe

Generate reusable Goose recipes for AI-driven subagents, specifying roles, instructions, and extensions to streamline specialized task execution for developer teams.

Instructions

Create a reusable Goose recipe for specialized subagents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
extensionsNoList of Goose extensions to enable
instructionsYesDetailed instructions for the agent
parametersNoRecipe parameters
recipe_nameYesName of the recipe
roleYesAgent role (e.g., code_reviewer, security_auditor)

Implementation Reference

  • The primary handler function for the 'create_goose_recipe' tool. It constructs a recipe object from input args, serializes it to YAML using objectToYaml, writes it to 'goose-recipes/[recipe_name].yaml', and returns a success message.
    async createGooseRecipe(args) { const { recipe_name, role, instructions, extensions = [], parameters = {} } = args; const recipe = { id: recipe_name, version: '1.0.0', title: `${role.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())} Recipe`, description: `Specialized subagent for ${role}`, instructions: instructions, activities: [ `Perform ${role} tasks`, 'Analyze and provide feedback', 'Generate deliverables' ], extensions: extensions.map(ext => ({ type: 'builtin', name: ext, display_name: ext.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()), timeout: 300, bundled: true })), parameters: Object.entries(parameters).map(([key, value]) => ({ key, input_type: typeof value, requirement: 'optional', description: `Parameter for ${key}`, default: value })), prompt: instructions }; // Create recipes directory if it doesn't exist const recipesDir = path.join(process.cwd(), 'goose-recipes'); await fs.mkdir(recipesDir, { recursive: true }); // Write recipe file const recipeFile = path.join(recipesDir, `${recipe_name}.yaml`); const yamlContent = this.objectToYaml(recipe); await fs.writeFile(recipeFile, yamlContent); return { content: [ { type: 'text', text: `Successfully created Goose recipe "${recipe_name}" at ${recipeFile}\n\nRecipe details:\n- Role: ${role}\n- Extensions: ${extensions.join(', ') || 'none'}\n- Parameters: ${Object.keys(parameters).join(', ') || 'none'}\n\nTo use this recipe, set GOOSE_RECIPE_PATH environment variable to the recipes directory or place the recipe in your working directory.` } ] }; }
  • Input schema for the 'create_goose_recipe' tool, defining required fields (recipe_name, role, instructions) and optional fields (extensions, parameters).
    inputSchema: { type: 'object', properties: { recipe_name: { type: 'string', description: 'Name of the recipe' }, role: { type: 'string', description: 'Agent role (e.g., code_reviewer, security_auditor)' }, instructions: { type: 'string', description: 'Detailed instructions for the agent' }, extensions: { type: 'array', items: { type: 'string' }, description: 'List of Goose extensions to enable' }, parameters: { type: 'object', description: 'Recipe parameters' } }, required: ['recipe_name', 'role', 'instructions'] }
  • src/index.js:87-117 (registration)
    Registration of the 'create_goose_recipe' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    { name: 'create_goose_recipe', description: 'Create a reusable Goose recipe for specialized subagents', inputSchema: { type: 'object', properties: { recipe_name: { type: 'string', description: 'Name of the recipe' }, role: { type: 'string', description: 'Agent role (e.g., code_reviewer, security_auditor)' }, instructions: { type: 'string', description: 'Detailed instructions for the agent' }, extensions: { type: 'array', items: { type: 'string' }, description: 'List of Goose extensions to enable' }, parameters: { type: 'object', description: 'Recipe parameters' } }, required: ['recipe_name', 'role', 'instructions'] } },
  • src/index.js:151-152 (registration)
    Switch case in CallToolRequestSchema handler that dispatches 'create_goose_recipe' calls to the createGooseRecipe method.
    case 'create_goose_recipe': return await this.createGooseRecipe(args);
  • Recursive helper function to convert JavaScript objects to YAML string format, used by createGooseRecipe to generate the recipe YAML file.
    objectToYaml(obj, indent = 0) { let yaml = ''; const spaces = ' '.repeat(indent); for (const [key, value] of Object.entries(obj)) { if (value === null || value === undefined) continue; if (Array.isArray(value)) { yaml += `${spaces}${key}:\n`; for (const item of value) { if (typeof item === 'object') { yaml += `${spaces}- \n${this.objectToYaml(item, indent + 1).split('\n').map(line => line ? `${spaces} ${line}` : '').join('\n')}\n`; } else { yaml += `${spaces}- ${item}\n`; } } } else if (typeof value === 'object') { yaml += `${spaces}${key}:\n${this.objectToYaml(value, indent + 1)}`; } else if (typeof value === 'string' && value.includes('\n')) { yaml += `${spaces}${key}: |\n${value.split('\n').map(line => `${spaces} ${line}`).join('\n')}\n`; } else { yaml += `${spaces}${key}: ${value}\n`; } } return yaml; }

Other Tools

Related 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