Skip to main content
Glama

generate_doc_enriched_template

Create MCP server templates enriched with documentation context for streamlined project scaffolding. Define project name, description, and output directory to generate structured templates efficiently.

Instructions

Generate an MCP server template with context from the documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYes
doc_contextYes
output_dirYes
project_nameYes

Implementation Reference

  • src/server.ts:184-200 (registration)
    Registers the MCP tool 'generate_doc_enriched_template' including input schema and handler that calls the implementation.
    // Register the generate_doc_enriched_template tool server.tool( "generate_doc_enriched_template", "Generate an MCP server template with context from the documentation", { project_name: z.string().min(1), description: z.string().min(1), doc_context: z.string().min(1), output_dir: z.string(), }, async (params: DocEnrichedTemplateOptions) => { const result = await generateDocEnrichedTemplate(params); return { content: [{ type: "text", text: result.message }], }; } );
  • Executes the core logic: validates input with schema, searches documentation based on doc_context, decides on prompts/resources, generates boilerplate, handles errors.
    export async function generateDocEnrichedTemplate( options: DocEnrichedTemplateOptions ): Promise<{ success: boolean; message: string }> { try { // Validate options const validatedOptions = docEnrichedTemplateSchema.parse(options); // Initialize docs storage if it doesn't exist yet await initDocsStorage(); // Search for relevant documentation console.log( chalk.blue( `Searching for documentation about: ${validatedOptions.doc_context}` ) ); const searchResults = await searchDocumentation( validatedOptions.doc_context ); if (searchResults.length === 0) { return { success: false, message: `No documentation found for context: ${validatedOptions.doc_context}. Please save documentation first or use a different context.`, }; } // Determine if we need prompts or resources based on the documentation context const contextLower = validatedOptions.doc_context.toLowerCase(); const includePrompts = contextLower.includes("prompt"); const includeResources = contextLower.includes("resource"); // Generate the boilerplate with the appropriate options console.log( chalk.blue( `Generating MCP server with${includePrompts ? "" : "out"} prompts and ${ includeResources ? "" : "without" } resources` ) ); const result = await generateMcpBoilerplate({ project_name: validatedOptions.project_name, description: validatedOptions.description, output_dir: validatedOptions.output_dir, include_prompts: includePrompts, include_resources: includeResources, }); if (!result.success) { return result; } console.log( chalk.green( `Document-enriched MCP server template generated successfully` ) ); return { success: true, message: `Document-enriched MCP server template generated successfully. Used ${searchResults.length} documentation entries for context.`, }; } catch (error: any) { console.error( chalk.red("Error generating document-enriched template:"), error ); return { success: false, message: `Error generating document-enriched template: ${ error.message || String(error) }`, }; } }
  • Zod schema for input validation of DocEnrichedTemplateOptions, matching the registered schema.
    export const docEnrichedTemplateSchema = z.object({ project_name: z.string().min(1), description: z.string().min(1), doc_context: z.string().min(1), output_dir: z.string(), });

Other Tools

Related Tools

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/CaptainCrouton89/mcp-maker'

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