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(),
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but provides minimal behavioral insight. It mentions generating a template with documentation context but doesn't disclose what the template includes, how it's structured, whether it overwrites files, or any permissions/rate limits. This is inadequate for a tool with 4 parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters with 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain what the generated template contains, how parameters interact, or what the output looks like, leaving too many gaps for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate but adds no parameter details. It doesn't explain what 'doc_context', 'output_dir', etc., mean or how they're used. With 4 undocumented parameters, this is a significant gap, scoring below the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Generate') and resource ('MCP server template'), specifying it uses 'context from the documentation'. It distinguishes from siblings like 'generate_mcp_boilerplate' by mentioning documentation context, but doesn't explicitly contrast with all siblings like 'create_tool_template'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives is provided. The description implies usage when documentation context is needed, but doesn't specify scenarios, prerequisites, or exclusions compared to sibling tools like 'create_resource_template' or 'generate_mcp_boilerplate'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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