Skip to main content
Glama

analyze_project

Generate initial documentation files by analyzing project structure. Input the project root directory path to create a searchable knowledge base.

Instructions

Analyze project structure and create initial documentation files

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the project root directory

Implementation Reference

  • Executes the analyze_project tool: creates .handoff_docs directory, initializes default markdown template files if missing, resets application state, and returns initialization status.
    case "analyze_project": {
      const { projectPath } = request.params.arguments as { projectPath: string };
      const docsPath = `${projectPath}/.handoff_docs`;
    
      try {
        await fs.mkdir(docsPath, { recursive: true });
    
        // Initialize default documentation files if they don't exist
        for (const doc of DEFAULT_DOCS) {
          const filePath = `${docsPath}/${doc}`;
          try {
            await fs.access(filePath);
          } catch {
            const title = doc.replace(".md", "")
              .split(/[_-]/)
              .map(word => word.charAt(0).toUpperCase() + word.slice(1))
              .join(" ");
            await fs.writeFile(filePath, TEMPLATE_CONTENT.replace("{title}", title));
          }
        }
    
        state = {
          currentFile: null,
          completedFiles: [],
          inProgress: false,
          lastReadFile: null,
          lastReadContent: null,
          continueToNext: false,
          metadata: {},
          contextCache: {},
          templateOverrides: {}
        };
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                message: "Documentation structure initialized",
                docsPath,
                files: DEFAULT_DOCS
              }, null, 2)
            }
          ]
        };
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new McpError(
          ErrorCode.InternalError,
          `Error initializing documentation: ${errorMessage}`
        );
      }
    }
  • src/index.ts:418-432 (registration)
    Registers the analyze_project tool with MCP server, defining name, description, and input schema requiring projectPath.
    {
      name: "analyze_project",
      description: "Analyze project structure and create initial documentation files",
      inputSchema: {
        type: "object",
        properties: {
          projectPath: {
            type: "string",
            description: "Path to the project root directory"
          }
        },
        required: ["projectPath"]
      }
    },
    {
  • Input schema for analyze_project tool: requires projectPath string.
    inputSchema: {
      type: "object",
      properties: {
        projectPath: {
          type: "string",
          description: "Path to the project root directory"
        }
      },
      required: ["projectPath"]
    }

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/ryanjoachim/mcp-rtfm'

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