Skip to main content
Glama
jakedx6
by jakedx6

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
NameRequiredDescriptionDefault
template_typeYesType of template to generate
project_contextNoProject context for template customization
ai_optimizedNoWhether to include AI-optimization features
include_examplesNoWhether to include example content

Implementation Reference

  • 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 } })
  • 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) })
  • 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'] } }
  • 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 }
  • 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 }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jakedx6/helios9-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server