Skip to main content
Glama

create_goose_recipe

Create reusable Goose recipes for specialized subagents like code reviewers and security auditors, enabling AI clients to delegate tasks to autonomous developer teams with custom instructions and extensions.

Instructions

Create a reusable Goose recipe for specialized subagents

Input Schema

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

Implementation Reference

  • The handler function that implements the create_goose_recipe tool. It constructs a recipe object from input args, serializes it to YAML using objectToYaml helper, writes it to a file in goose-recipes directory, 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.` } ] }; }
  • src/index.js:87-117 (registration)
    Registration of the create_goose_recipe tool in the ListToolsRequestSchema handler, including name, description, and input schema definition.
    { 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'] } },
  • Input schema definition for the create_goose_recipe tool, specifying properties and required fields.
    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'] }
  • Helper function used by the handler to convert the recipe object to YAML format for file writing.
    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; }

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