generate_document_template
Create structured document templates for READMEs, API documentation, meeting notes, technical specifications, user guides, and project proposals. Customize with project context and optional AI-optimization features.
Instructions
Generate a document template based on type and requirements
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| template_type | Yes | Type of template to generate | |
| project_context | No | Project context for template customization | |
| ai_optimized | No | Whether to include AI-optimization features | |
| include_examples | No | Whether to include example content |
Implementation Reference
- src/tools/documents.ts:896-911 (handler)The main handler function that executes the 'generate_document_template' tool. It validates input using the schema, logs the action, generates template content using a helper function, and returns structured template data including content, frontmatter, sections, and AI instructions.export const generateDocumentTemplate = requireAuth(async (args: any) => { const { template_type, project_context, ai_optimized, include_examples } = GenerateDocumentTemplateSchema.parse(args) logger.info('Generating document template', { template_type, ai_optimized }) const template = generateTemplateContent(template_type, project_context, ai_optimized, include_examples) return { template_type, content: template.content, frontmatter: template.frontmatter, sections: template.sections, ai_instructions: ai_optimized ? template.ai_instructions : undefined, usage_tips: template.usage_tips } })
- src/tools/documents.ts:884-894 (schema)Zod schema defining the input parameters for the generate_document_template tool, including template_type (required), optional project_context, and flags for AI optimization and examples.const GenerateDocumentTemplateSchema = z.object({ template_type: z.enum(['readme', 'api_doc', 'meeting_notes', 'technical_spec', 'user_guide', 'project_proposal']), project_context: z.object({ name: z.string().optional(), description: z.string().optional(), tech_stack: z.array(z.string()).optional(), team_size: z.number().optional() }).optional(), ai_optimized: z.boolean().default(true), include_examples: z.boolean().default(true) })
- src/tools/documents.ts:848-882 (registration)MCPTool registration object defining the tool name 'generate_document_template', description, and input schema matching the Zod schema.export const generateDocumentTemplateTool: MCPTool = { name: 'generate_document_template', description: 'Generate a document template based on type and requirements', inputSchema: { type: 'object', properties: { template_type: { type: 'string', enum: ['readme', 'api_doc', 'meeting_notes', 'technical_spec', 'user_guide', 'project_proposal'], description: 'Type of template to generate' }, project_context: { type: 'object', properties: { name: { type: 'string' }, description: { type: 'string' }, tech_stack: { type: 'array', items: { type: 'string' } }, team_size: { type: 'number' } }, description: 'Project context for template customization' }, ai_optimized: { type: 'boolean', default: true, description: 'Whether to include AI-optimization features' }, include_examples: { type: 'boolean', default: true, description: 'Whether to include example content' } }, required: ['template_type'] } }
- src/tools/documents.ts:1346-1358 (registration)Registration of the handler function under the key 'generate_document_template' in the documentHandlers export object, likely used for tool routing.export const documentHandlers = { list_documents: listDocuments, create_document: createDocument, get_document: getDocument, update_document: updateDocument, search_documents: searchDocuments, get_document_context: getDocumentContext, add_document_collaborator: addDocumentCollaborator, analyze_document_content: analyzeDocumentContent, get_document_collaboration: getDocumentCollaboration, generate_document_template: generateDocumentTemplate, bulk_document_operations: bulkDocumentOperations }
- src/tools/documents.ts:1234-1254 (helper)Core helper function called by the handler to generate the actual template content, frontmatter, sections, etc., based on type and options. Currently supports 'readme' template.function generateTemplateContent(type: string, context: any, aiOptimized: boolean, includeExamples: boolean): any { const templates = { readme: { content: generateReadmeTemplate(context, includeExamples), frontmatter: { document_type: 'readme', template_version: '1.0', ...(aiOptimized && { ai_instructions: 'This README should help users quickly understand and get started with the project', ai_capabilities: ['generate', 'review', 'translate'] }) }, sections: ['Overview', 'Installation', 'Usage', 'Contributing', 'License'], ai_instructions: aiOptimized ? 'Keep content clear, structured, and actionable' : undefined, usage_tips: ['Update installation steps regularly', 'Include code examples', 'Add contribution guidelines'] } // Add more templates... } return templates[type as keyof typeof templates] || templates.readme }