Skip to main content
Glama

generate_spec

Create detailed specification documents using OpenAI's O3 model with customizable prompts, context, and output formats like markdown or structured text.

Instructions

Generate a specification document using OpenAI O3 model

Input Schema

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

Implementation Reference

  • The exported `generateSpec` function is the entry point handler for the MCP 'generate_spec' tool, delegating to the tool instance's execute method.
    export async function generateSpec(args: SpecGenerationOptions): Promise<CallToolResult> { return tool.execute(args); }
  • The `GenerateSpecTool` class contains the core implementation logic for the 'generate_spec' tool, including custom system and user prompts for AI-based specification generation.
    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}` : ''}`; } }
  • Type definition for input parameters to the generate_spec tool.
    export interface SpecGenerationOptions { prompt: string; context?: string; format?: 'markdown' | 'structured'; }
  • Shared `execute` method in BaseAITool that orchestrates the AI call for all AI-based tools, including generate_spec.
    async execute(args: T): Promise<CallToolResult> { try { const systemPrompt = this.getSystemPrompt(args); const userPrompt = this.getUserPrompt(args); const response = await callAI(systemPrompt, userPrompt); return createSuccessResult(response); } catch (error) { return createErrorResult(this.getActionName(), error); } }

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

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