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