generate_document_template
Create structured document templates for READMEs, API docs, meeting notes, technical specs, user guides, and project proposals with customizable project context and AI-optimization options.
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 for the generate_document_template tool. It parses input using the schema, logs the action, generates the template content using a helper, and returns structured template data including content, frontmatter, sections, AI instructions, and usage tips.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 for validating input parameters to the generate_document_template tool, including template_type (required enum), optional project_context object, and flags for ai_optimized and include_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 name, description, and inputSchema for the generate_document_template tool.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:1234-1254 (helper)Helper function that generates the template content based on type, context, and options. Currently implements README template with frontmatter, sections, AI instructions, and tips; falls back to README for unsupported types.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 }
- src/tools/documents.ts:1346-1358 (registration)Registration of the handler function in the documentHandlers export object, mapping 'generate_document_template' to generateDocumentTemplate.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:1361-1373 (registration)Export of all document tools including generateDocumentTemplateTool.export const documentTools = { listDocumentsTool, createDocumentTool, getDocumentTool, updateDocumentTool, searchDocumentsTool, getDocumentContextTool, addDocumentCollaboratorTool, analyzeDocumentContentTool, getDocumentCollaborationTool, generateDocumentTemplateTool, bulkDocumentOperationsTool }