Skip to main content
Glama
JojoSlice

README Generator MCP Server

by JojoSlice

analyze_project

Analyzes project directories to detect technologies, dependencies, and structure, then provides a README template for generating comprehensive documentation.

Instructions

Analyze a project directory and return structured data about the project along with a README template. Returns: (1) A template structure with recommended README sections (some required, some optional), and (2) Detailed project analysis including detected technologies, package.json data, directory structure, scripts, dependencies, and configuration files. The LLM should use this information to construct a comprehensive README following the template structure as a guide, adapting sections based on what's relevant for the specific project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesThe absolute path to the project directory

Implementation Reference

  • The core handler function that performs the project analysis: reads directory structure, parses package.json, detects technologies and config files, formats structure, and returns structured data including a README template.
    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}`);
      }
    }
  • src/index.ts:424-442 (registration)
    Tool registration in the ListTools handler, including name, detailed description, and input schema.
    {
      name: "analyze_project",
      description:
        "Analyze a project directory and return structured data about the project along with a README template. " +
        "Returns: (1) A template structure with recommended README sections (some required, some optional), " +
        "and (2) Detailed project analysis including detected technologies, package.json data, directory structure, scripts, dependencies, and configuration files. " +
        "The LLM should use this information to construct a comprehensive README following the template structure as a guide, " +
        "adapting sections based on what's relevant for the specific project.",
      inputSchema: {
        type: "object",
        properties: {
          projectPath: {
            type: "string",
            description: "The absolute path to the project directory",
          },
        },
        required: ["projectPath"],
      },
    },
  • Input schema definition for the analyze_project tool, specifying the projectPath parameter.
    inputSchema: {
      type: "object",
      properties: {
        projectPath: {
          type: "string",
          description: "The absolute path to the project directory",
        },
      },
      required: ["projectPath"],
    },
  • src/index.ts:499-510 (registration)
    Dispatch/registration in the CallToolRequestSchema switch statement that invokes the analyzeProject handler.
    case "analyze_project": {
      const { projectPath } = args as { projectPath: string };
      const analysis = await analyzeProject(projectPath);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(analysis, null, 2),
          },
        ],
      };
    }
  • Supporting helper function to recursively build the directory structure tree, used by analyzeProject.
    async function getDirectoryStructure(
      dirPath: string,
      maxDepth: number = 3,
      currentDepth: number = 0,
      ignorePatterns: string[] = [
        "node_modules",
        ".git",
        "dist",
        "build",
        ".next",
        "coverage",
      ],
    ): Promise<any> {
      if (currentDepth >= maxDepth) {
        return null;
      }
    
      try {
        const entries = await readdir(dirPath, { withFileTypes: true });
        const structure: any = {
          type: "directory",
          name: parse(dirPath).base || dirPath,
          children: [],
        };
    
        for (const entry of entries) {
          if (ignorePatterns.some((pattern) => entry.name.includes(pattern))) {
            continue;
          }
    
          const fullPath = join(dirPath, entry.name);
    
          if (entry.isDirectory()) {
            const subStructure = await getDirectoryStructure(
              fullPath,
              maxDepth,
              currentDepth + 1,
              ignorePatterns,
            );
            if (subStructure) {
              structure.children.push(subStructure);
            }
          } else {
            structure.children.push({
              type: "file",
              name: entry.name,
              path: fullPath,
            });
          }
        }
    
        return structure;
      } catch (error) {
        throw new Error(`Failed to read directory: ${error}`);
      }
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the tool's behavior by describing what it returns (structured data and README template) and how the LLM should use the output. However, it doesn't mention potential limitations like file size constraints, processing time, error conditions, or authentication requirements.

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 functionality. Most sentences earn their place by explaining the output and usage guidance, though the final sentence about LLM adaptation could be slightly more concise.

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

Completeness4/5

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

Given the tool's complexity (analyzing entire projects) and lack of output schema, the description does well by detailing the two main return components and their contents. It explains how the output should be used, though it could benefit from mentioning error scenarios or performance characteristics for a more complete picture.

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' as an absolute path. The description doesn't add any parameter-specific information beyond what's in the schema, such as path format examples or validation rules. Baseline 3 is appropriate when schema does the documentation work.

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 ('analyze', 'return') and resources ('project directory', 'structured data', 'README template'). It distinguishes from sibling tools like 'generate_readme' by focusing on analysis rather than generation, and from 'read_project_structure' by providing comprehensive analysis beyond just structure.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: to analyze a project directory and obtain structured data and a README template. It implicitly suggests using 'generate_readme' for actual README generation, but doesn't explicitly state when NOT to use this tool or compare alternatives in detail.

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