Skip to main content
Glama

generate_readme_template

Create standardized README templates for various project types with best practices, including libraries, applications, CLI tools, APIs, and documentation.

Instructions

Generate standardized README templates for different project types with best practices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYesName of the project
descriptionYesBrief description of what the project does
templateTypeYesType of project template to generate
authorNoProject author/organization name
licenseNoProject licenseMIT
includeScreenshotsNoInclude screenshot placeholders for applications
includeBadgesNoInclude status badges
includeContributingNoInclude contributing section
outputPathNoPath to write the generated README.md file

Implementation Reference

  • Main handler function that validates the input schema, instantiates the template generator, generates the README content, handles optional file output, and returns the result with metadata.
    export async function generateReadmeTemplate(
      input: GenerateReadmeTemplateInput,
    ): Promise<{
      content: string;
      metadata: {
        templateType: TemplateType;
        estimatedLength: number;
        sectionsIncluded: number;
      };
    }> {
      const validatedInput = GenerateReadmeTemplateSchema.parse(input);
      const generator = new ReadmeTemplateGenerator();
    
      const content = generator.generateTemplate(validatedInput);
      const templateInfo = generator.getTemplateInfo(validatedInput.templateType);
    
      if (!templateInfo) {
        throw new Error(`Template type "${validatedInput.templateType}" not found`);
      }
    
      // Write to file if output path specified
      if (validatedInput.outputPath) {
        const fs = await import("fs/promises");
        await fs.writeFile(validatedInput.outputPath, content, "utf-8");
      }
    
      return {
        content,
        metadata: {
          templateType: validatedInput.templateType,
          estimatedLength: templateInfo.estimatedLength,
          sectionsIncluded: content.split("##").length - 1,
        },
      };
    }
  • Zod input schema defining parameters for the tool including project details, template type, and optional flags.
    export const GenerateReadmeTemplateSchema = z.object({
      projectName: z.string().min(1, "Project name is required"),
      description: z.string().min(1, "Project description is required"),
      templateType: TemplateType,
      author: z.string().optional(),
      license: z.string().default("MIT"),
      includeScreenshots: z.boolean().default(false),
      includeBadges: z.boolean().default(true),
      includeContributing: z.boolean().default(true),
      outputPath: z.string().optional(),
    });
  • Zod enum schema for supported README template types used in the main input schema.
    export const TemplateType = z.enum([
      "library",
      "application",
      "cli-tool",
      "api",
      "documentation",
    ]);
  • Core helper method in ReadmeTemplateGenerator class that processes the template sections, handles conditional inclusion of badges, screenshots, and contributing sections, and assembles the final README string.
    generateTemplate(input: GenerateReadmeTemplateInput): string {
      const template = this.templates.get(input.templateType);
      if (!template) {
        throw new Error(`Template type "${input.templateType}" not supported`);
      }
    
      let readme = "";
      const camelCaseName = this.toCamelCase(input.projectName);
    
      // Process each section
      for (const section of template.sections) {
        if (section.title === "Badges" && input.includeBadges) {
          readme += this.processBadges(template.badges, input) + "\n\n";
        } else if (section.title === "Screenshot" && input.includeScreenshots) {
          readme += this.processScreenshot(input) + "\n\n";
        } else if (
          section.title === "Contributing" &&
          !input.includeContributing
        ) {
          continue;
        } else {
          readme +=
            this.processSection(section.content, input, camelCaseName) + "\n\n";
        }
      }
    
      return readme.trim();
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Generate' implies a creation operation, the description doesn't specify whether this tool writes files (as suggested by the 'outputPath' parameter), requires specific permissions, has side effects, or what the output format looks like. It mentions 'best practices' but doesn't elaborate on what those entail behaviorally.

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 that front-loads the core purpose without unnecessary words. It directly states what the tool does ('Generate standardized README templates') and adds qualifying context ('for different project types with best practices') that earns its place by clarifying scope.

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

Completeness3/5

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

Given the complexity (9 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits, usage context, and output handling. The schema handles parameter documentation well, but the description doesn't add enough value to be considered complete for a tool with this many parameters and no annotations.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all 9 parameters. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain the 'templateType' enum values or how parameters interact). With high schema coverage, the baseline is 3, as the description doesn't compensate but also doesn't detract.

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 tool's purpose: 'Generate standardized README templates for different project types with best practices.' It specifies the verb ('Generate'), resource ('README templates'), and scope ('different project types with best practices'). However, it doesn't explicitly distinguish this from sibling tools like 'optimize_readme' or 'readme_best_practices,' which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'optimize_readme,' 'evaluate_readme_health,' and 'readme_best_practices,' there's no indication of when this generation tool is preferred over analysis or optimization tools. The description lacks any context about prerequisites or exclusions.

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

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/tosin2013/documcp'

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