create_structured_prompt
Build structured prompts with guided metadata for organization and reuse in the Prompts MCP Server.
Instructions
Create a new prompt with guided metadata structure
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the prompt | |
| title | Yes | Human-readable title for the prompt | |
| description | Yes | Brief description of what the prompt does | |
| category | No | Category (e.g., development, writing, analysis) | |
| tags | No | Array of tags for categorization | |
| difficulty | No | Difficulty level of the prompt | |
| author | No | Author of the prompt | |
| content | Yes | The actual prompt content (markdown) |
Implementation Reference
- src/tools.ts:283-325 (handler)The handler function that executes the create_structured_prompt tool. It validates required arguments, constructs YAML frontmatter metadata from optional and required fields, appends the prompt content, saves the file using fileOps, and returns a success message with key metadata.private async handleCreateStructuredPrompt(args: ToolArguments): Promise<CallToolResult> { if (!args.name || !args.content || !args.title || !args.description) { throw new Error('Name, content, title, and description are required for create_structured_prompt'); } // Build structured frontmatter with provided metadata const metadata = { title: args.title, description: args.description, category: args.category || 'general', tags: args.tags || ['general'], difficulty: args.difficulty || 'beginner', author: args.author || 'User', version: '1.0', created: new Date().toISOString().split('T')[0], }; // Create YAML frontmatter const frontmatter = `--- title: "${metadata.title}" description: "${metadata.description}" category: "${metadata.category}" tags: ${JSON.stringify(metadata.tags)} difficulty: "${metadata.difficulty}" author: "${metadata.author}" version: "${metadata.version}" created: "${metadata.created}" --- `; const fullContent = frontmatter + args.content; const fileName = await this.fileOps.savePrompt(args.name, fullContent); return { content: [ { type: 'text', text: `Structured prompt "${args.name}" created successfully as ${fileName} with metadata:\n- Title: ${metadata.title}\n- Category: ${metadata.category}\n- Tags: ${metadata.tags.join(', ')}\n- Difficulty: ${metadata.difficulty}`, } as TextContent, ], }; }
- src/tools.ts:81-124 (registration)Tool registration in the getToolDefinitions() method, specifying the name, description, and inputSchema for MCP listTools.{ name: 'create_structured_prompt', description: 'Create a new prompt with guided metadata structure', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt', }, title: { type: 'string', description: 'Human-readable title for the prompt', }, description: { type: 'string', description: 'Brief description of what the prompt does', }, category: { type: 'string', description: 'Category (e.g., development, writing, analysis)', }, tags: { type: 'array', items: { type: 'string' }, description: 'Array of tags for categorization', }, difficulty: { type: 'string', enum: ['beginner', 'intermediate', 'advanced'], description: 'Difficulty level of the prompt', }, author: { type: 'string', description: 'Author of the prompt', }, content: { type: 'string', description: 'The actual prompt content (markdown)', }, }, required: ['name', 'title', 'description', 'content'], }, },
- src/tools.ts:84-123 (schema)JSON Schema defining the input parameters, required fields, and descriptions for the create_structured_prompt tool.inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt', }, title: { type: 'string', description: 'Human-readable title for the prompt', }, description: { type: 'string', description: 'Brief description of what the prompt does', }, category: { type: 'string', description: 'Category (e.g., development, writing, analysis)', }, tags: { type: 'array', items: { type: 'string' }, description: 'Array of tags for categorization', }, difficulty: { type: 'string', enum: ['beginner', 'intermediate', 'advanced'], description: 'Difficulty level of the prompt', }, author: { type: 'string', description: 'Author of the prompt', }, content: { type: 'string', description: 'The actual prompt content (markdown)', }, }, required: ['name', 'title', 'description', 'content'], },
- src/tools.ts:146-147 (registration)Dispatch/registration in the handleToolCall switch statement, routing calls to the specific handler.case 'create_structured_prompt': return await this.handleCreateStructuredPrompt(toolArgs);
- src/types.ts:26-33 (schema)TypeScript type definitions in ToolArguments interface for the structured prompt fields.// Fields for create_structured_prompt title?: string; description?: string; category?: string; tags?: string[]; difficulty?: 'beginner' | 'intermediate' | 'advanced'; author?: string; }