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
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Additional context or requirements | |
| format | No | Output format for the specification | markdown |
| prompt | Yes | Description of what specification to generate |
Implementation Reference
- src/tools/generateSpec.ts:31-33 (handler)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); }
- src/tools/generateSpec.ts:5-27 (handler)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}` : ''}`; } }
- src/types/index.ts:33-37 (schema)Type definition for input parameters to the generate_spec tool.export interface SpecGenerationOptions { prompt: string; context?: string; format?: 'markdown' | 'structured'; }
- src/tools/ai-base.ts:10-20 (helper)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); } }