Skip to main content
Glama
JojoSlice

README Generator MCP Server

by JojoSlice

generate_readme

Create professional README.md files by analyzing project directories to include badges, sections, and proper formatting.

Instructions

Generate a well-formatted, visually appealing README.md file for a project. This tool analyzes the project directory and automatically creates a comprehensive README with: badges, emojis, proper sections (description, installation, usage, project structure, dependencies, etc.), code blocks, and professional formatting. The generated README is ready to use and follows best practices.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesThe absolute path to the project directory

Implementation Reference

  • MCP tool handler for 'generate_readme': analyzes the project and calls generateReadme to produce the README content.
    case "generate_readme": {
      const { projectPath } = args as { projectPath: string };
      const analysis = await analyzeProject(projectPath);
      const readme = generateReadme(analysis.projectData);
      return {
        content: [
          {
            type: "text",
            text: readme,
          },
        ],
      };
    }
  • Core handler function that generates the formatted README.md content from analyzed project data, including badges, sections, code blocks, and structure.
    function generateReadme(projectData: any): string {
      const {
        projectName,
        description,
        version,
        author,
        license,
        homepage,
        repository,
        scripts,
        dependencies,
        devDependencies,
        detectedTechnologies,
        configFiles,
        directoryStructureFormatted,
      } = projectData;
    
      let readme = "";
    
      readme += `# ${projectName}\n\n`;
    
      const badges: string[] = [];
      if (version)
        badges.push(
          `![Version](https://img.shields.io/badge/version-${version}-blue.svg)`,
        );
      if (license)
        badges.push(
          `![License](https://img.shields.io/badge/license-${license}-green.svg)`,
        );
      if (detectedTechnologies.includes("Node.js"))
        badges.push(
          `![Node.js](https://img.shields.io/badge/node.js-✓-brightgreen.svg)`,
        );
      if (detectedTechnologies.includes("TypeScript"))
        badges.push(
          `![TypeScript](https://img.shields.io/badge/typescript-✓-blue.svg)`,
        );
      if (detectedTechnologies.includes("Python"))
        badges.push(`![Python](https://img.shields.io/badge/python-✓-yellow.svg)`);
      if (detectedTechnologies.includes("Rust"))
        badges.push(`![Rust](https://img.shields.io/badge/rust-✓-orange.svg)`);
      if (detectedTechnologies.includes("Go"))
        badges.push(`![Go](https://img.shields.io/badge/go-✓-00ADD8.svg)`);
    
      if (badges.length > 0) {
        readme += badges.join(" ") + "\n\n";
      }
    
      if (description) {
        readme += `## 📝 Description\n\n${description}\n\n`;
      }
    
      if (detectedTechnologies.length > 0) {
        readme += `## 🛠️ Technologies Used\n\n`;
        detectedTechnologies.forEach((tech: string) => {
          readme += `- ${tech}\n`;
        });
        readme += `\n`;
      }
    
      readme += `## 📦 Installation\n\n`;
      if (dependencies.length > 0 || devDependencies.length > 0) {
        readme += `\`\`\`bash\n`;
        if (detectedTechnologies.includes("Node.js")) {
          readme += `npm install\n`;
        } else if (detectedTechnologies.includes("Python")) {
          readme += `pip install -r requirements.txt\n`;
        } else if (detectedTechnologies.includes("Rust")) {
          readme += `cargo build\n`;
        } else if (detectedTechnologies.includes("Go")) {
          readme += `go mod download\n`;
        }
        readme += `\`\`\`\n\n`;
      } else {
        readme += `Clone the repository and follow the setup instructions.\n\n`;
      }
    
      const scriptKeys = Object.keys(scripts);
      if (scriptKeys.length > 0) {
        readme += `## 🚀 Usage\n\n`;
        readme += `Available scripts:\n\n`;
        scriptKeys.forEach((script) => {
          readme += `\`\`\`bash\nnpm run ${script}\n\`\`\`\n`;
          readme += `${scripts[script]}\n\n`;
        });
      }
    
      if (directoryStructureFormatted) {
        readme += `## 📁 Project Structure\n\n`;
        readme += `\`\`\`\n${directoryStructureFormatted}\`\`\`\n\n`;
      }
    
      if (dependencies.length > 0) {
        readme += `## 📚 Dependencies\n\n`;
        dependencies.forEach((dep: string) => {
          readme += `- ${dep}\n`;
        });
        readme += `\n`;
      }
    
      if (devDependencies.length > 0) {
        readme += `## 🔧 Dev Dependencies\n\n`;
        devDependencies.forEach((dep: string) => {
          readme += `- ${dep}\n`;
        });
        readme += `\n`;
      }
    
      if (configFiles) {
        readme += `## 📝 Config-files\n\n${configFiles}\n\n`;
      }
    
      if (license) {
        readme += `## 📄 License\n\n`;
        readme += `This project is licensed under the ${license} License.\n\n`;
      }
    
      if (author) {
        readme += `## 👤 Author\n\n`;
        readme += `${typeof author === "string" ? author : JSON.stringify(author)}\n\n`;
      }
    
      if (homepage || repository) {
        readme += `## 🔗 Links\n\n`;
        if (homepage) readme += `- [Homepage](${homepage})\n`;
        if (repository) {
          const repoUrl =
            typeof repository === "string" ? repository : repository.url;
          readme += `- [Repository](${repoUrl})\n`;
        }
        readme += `\n`;
      }
    
      readme += `---\n\n`;
      readme += `*Generated with ❤️ by README Generator MCP Server*\n`;
    
      return readme;
    }
  • src/index.ts:443-460 (registration)
    Registration of the 'generate_readme' tool in the ListTools response, including name, description, and input schema.
    {
      name: "generate_readme",
      description:
        "Generate a well-formatted, visually appealing README.md file for a project. " +
        "This tool analyzes the project directory and automatically creates a comprehensive README with: " +
        "badges, emojis, proper sections (description, installation, usage, project structure, dependencies, etc.), " +
        "code blocks, and professional formatting. The generated README is ready to use and follows best practices.",
      inputSchema: {
        type: "object",
        properties: {
          projectPath: {
            type: "string",
            description: "The absolute path to the project directory",
          },
        },
        required: ["projectPath"],
      },
    },
  • Input schema for the 'generate_readme' tool, requiring 'projectPath'.
    inputSchema: {
      type: "object",
      properties: {
        projectPath: {
          type: "string",
          description: "The absolute path to the project directory",
        },
      },
      required: ["projectPath"],
    },
  • Helper function called by generate_readme handler to analyze the project directory and extract data for README generation.
    async function analyzeProject(projectPath: string): Promise<any> {
      try {
        const structure = await getDirectoryStructure(projectPath);
    
        let packageJson: any = null;
        try {
          const packagePath = join(projectPath, "package.json");
          const packageContent = await readFile(packagePath, "utf-8");
          packageJson = JSON.parse(packageContent);
        } catch {
          // package.json might not exist
        }
    
        const files = await readdir(projectPath);
        const detectedTechnologies: string[] = [];
        const configFiles: string[] = [];
    
        if (files.includes("package.json")) {
          detectedTechnologies.push("Node.js");
          configFiles.push("package.json");
        }
        if (files.includes("tsconfig.json")) {
          detectedTechnologies.push("TypeScript");
          configFiles.push("tsconfig.json");
        }
        if (files.includes("requirements.txt")) {
          detectedTechnologies.push("Python");
          configFiles.push("requirements.txt");
        }
        if (files.includes("setup.py")) {
          detectedTechnologies.push("Python");
          configFiles.push("setup.py");
        }
        if (files.includes("Cargo.toml")) {
          detectedTechnologies.push("Rust");
          configFiles.push("Cargo.toml");
        }
        if (files.includes("go.mod")) {
          detectedTechnologies.push("Go");
          configFiles.push("go.mod");
        }
        if (files.includes("pom.xml")) {
          detectedTechnologies.push("Java");
          configFiles.push("pom.xml");
        }
        if (files.includes("build.gradle")) {
          detectedTechnologies.push("Java/Gradle");
          configFiles.push("build.gradle");
        }
        if (files.includes("Dockerfile")) {
          detectedTechnologies.push("Docker");
          configFiles.push("Dockerfile");
        }
        if (files.includes(".env.example") || files.includes(".env.template")) {
          configFiles.push(
            files.find((f) => f === ".env.example") || ".env.template",
          );
        }
    
        const structureString = formatDirectoryStructure(structure, 0);
    
        return {
          template: README_TEMPLATE,
          projectData: {
            projectName: packageJson?.name || parse(projectPath).base,
            description: packageJson?.description || null,
            version: packageJson?.version || null,
            author: packageJson?.author || null,
            license: packageJson?.license || null,
            homepage: packageJson?.homepage || null,
            repository: packageJson?.repository || null,
            scripts: packageJson?.scripts || {},
            dependencies: packageJson?.dependencies
              ? Object.keys(packageJson.dependencies)
              : [],
            devDependencies: packageJson?.devDependencies
              ? Object.keys(packageJson.devDependencies)
              : [],
            detectedTechnologies,
            configFiles,
            directoryStructure: structure,
            directoryStructureFormatted: structureString,
            rootFiles: files,
          },
        };
      } catch (error) {
        throw new Error(`Failed to analyze project: ${error}`);
      }
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks key behavioral details: it doesn't specify if the tool overwrites existing README files, what permissions are needed, error handling, or output format. It mentions 'analyzes the project directory' but doesn't explain how this analysis works.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core function. All sentences contribute value, though it could be slightly more concise by combining some details about README content.

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?

For a tool with no annotations, no output schema, and one parameter, the description is adequate but incomplete: it covers what the tool does but lacks behavioral context and doesn't explain what 'ready to use' means in practice (e.g., file creation location, format specifics).

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 already documents the single parameter 'projectPath'. The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score.

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

Purpose5/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 with specific verbs ('generate', 'analyzes', 'creates') and resources ('README.md file for a project'), and distinguishes it from siblings by focusing on automated documentation generation rather than analysis or reading functions.

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

Usage Guidelines3/5

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

The description implies usage for creating project documentation but doesn't explicitly state when to use this tool versus alternatives like 'analyze_project' or 'read_project_structure'. No exclusions or prerequisites are mentioned.

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/JojoSlice/README-Gen-MCP-Server'

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