Skip to main content
Glama

generate_spec

Create specification documents using AI to define requirements and structure for development projects based on user prompts and context.

Instructions

Generate a specification document using OpenAI O3 model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesDescription of what specification to generate
contextNoAdditional context or requirements
formatNoOutput format for the specificationmarkdown

Implementation Reference

  • Core handler implementation for 'generate_spec' tool. The GenerateSpecTool class defines the AI prompts and action name. The exported generateSpec function executes the tool.
    class GenerateSpecTool extends BaseAITool<SpecGenerationOptions> {
      protected getActionName(): string {
        return 'generating specification';
      }
    
      protected getSystemPrompt(args: SpecGenerationOptions): string {
        const { format = 'markdown' } = args;
        return `You are a technical specification writer. Generate detailed, clear, and actionable specifications based on the requirements provided. 
    ${format === 'structured' ? 'Output in a structured format with clear sections, requirements, and acceptance criteria.' : 'Output in clean markdown format.'}
    Focus on:
    - Clear objectives and goals
    - Detailed requirements (functional and non-functional)
    - Technical architecture and design decisions
    - Implementation approach
    - Success criteria and testing requirements
    - Edge cases and error handling`;
      }
    
      protected getUserPrompt(args: SpecGenerationOptions): string {
        const { prompt, context } = args;
        return `Generate a specification for: ${prompt}${context ? `\n\nAdditional context: ${context}` : ''}`;
      }
    }
    
    const tool = new GenerateSpecTool();
    
    export async function generateSpec(args: SpecGenerationOptions): Promise<CallToolResult> {
      return tool.execute(args);
    }
  • src/index.ts:29-41 (registration)
    Registers the 'generate_spec' MCP tool with input schema and handler reference.
    // Register generate_spec tool
    server.registerTool(
      'generate_spec',
      {
        description: 'Generate a specification document using OpenAI O3 model',
        inputSchema: {
          prompt: z.string().describe('Description of what specification to generate'),
          context: z.string().optional().describe('Additional context or requirements'),
          format: z.enum(['markdown', 'structured']).optional().default('markdown').describe('Output format for the specification'),
        },
      },
      async (args) => generateSpec(args)
    );
  • Type definition for input parameters of the generate_spec tool, matching the Zod schema.
    export interface SpecGenerationOptions {
      prompt: string;
      context?: string;
      format?: 'markdown' | 'structured';
    }

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/jaggederest/mcp_reviewer'

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