Skip to main content
Glama

get_project_info

Retrieve detailed project structure and file information by specifying the root directory path using this MCP server tool.

Instructions

Get information about the project structure and files

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the project root directory

Implementation Reference

  • Handler implementation for get_project_info tool. Extracts projectPath from arguments, fetches git repository information (remote URL, branch, last commit), reads and parses package.json if present, recursively builds a directory structure (up to depth 3, skipping dotfiles and node_modules), compiles docsStatus from global state, and returns a JSON-formatted text response containing all this information.
    case "get_project_info": {
      const { projectPath } = request.params.arguments as { projectPath: string };
    
      try {
        // Get git info if available
        let gitInfo = {};
        try {
          gitInfo = {
            remoteUrl: execSync("git config --get remote.origin.url", { cwd: projectPath }).toString().trim(),
            branch: execSync("git branch --show-current", { cwd: projectPath }).toString().trim(),
            lastCommit: execSync("git log -1 --format=%H", { cwd: projectPath }).toString().trim()
          };
        } catch {
          // Not a git repository or git not available
        }
    
        // Get package.json if it exists
        let packageInfo = {};
        try {
          const packageJson = await fs.readFile(`${projectPath}/package.json`, "utf8");
          packageInfo = JSON.parse(packageJson);
        } catch {
          // No package.json or invalid JSON
        }
    
        // Get directory structure
        const getDirectoryStructure = async (dir: string, depth = 3): Promise<any> => {
          if (depth === 0) return "...";
    
          const items = await fs.readdir(dir, { withFileTypes: true });
          const structure: Record<string, any> = {};
    
          for (const item of items) {
            if (item.name.startsWith(".") || item.name === "node_modules") continue;
    
            if (item.isDirectory()) {
              structure[item.name] = await getDirectoryStructure(`${dir}/${item.name}`, depth - 1);
            } else {
              structure[item.name] = null;
            }
          }
    
          return structure;
        };
    
        const projectStructure = await getDirectoryStructure(projectPath);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                gitInfo,
                packageInfo,
                projectStructure,
                docsStatus: {
                  completed: state.completedFiles,
                  current: state.currentFile,
                  inProgress: state.inProgress,
                  lastRead: state.lastReadFile,
                  remaining: DEFAULT_DOCS.filter(doc => !state.completedFiles.includes(doc))
                }
              }, null, 2)
            }
          ]
        };
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new McpError(
          ErrorCode.InternalError,
          `Error getting project info: ${errorMessage}`
        );
      }
    }
  • src/index.ts:498-510 (registration)
    Registration of the get_project_info tool in the tools array passed to server.setTools(). Includes the tool name, description, and input schema defining the required projectPath parameter.
    {
      name: "get_project_info",
      description: "Get information about the project structure and files",
      inputSchema: {
        type: "object",
        properties: {
          projectPath: {
            type: "string",
            description: "Path to the project root directory"
          }
        },
        required: ["projectPath"]
      }
  • Input schema for the get_project_info tool, specifying an object with a required string projectPath.
      type: "object",
      properties: {
        projectPath: {
          type: "string",
          description: "Path to the project root directory"
        }
      },
      required: ["projectPath"]
    }
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. It states this is a 'Get' operation, implying read-only behavior, but doesn't clarify permissions needed, rate limits, error conditions, or what format the information is returned in (e.g., structured data vs. raw files).

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 a single, efficient sentence with no wasted words. It's appropriately sized for a simple tool, though it could be more front-loaded with key details if expanded for better clarity.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'information' is returned (e.g., file list, metadata, structure details), making it hard for an agent to use effectively without trial and error.

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%, with the single parameter 'projectPath' documented as 'Path to the project root directory'. The description adds no additional meaning beyond this, such as path format examples or constraints, so it meets the baseline for high schema coverage.

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

Purpose3/5

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

The description 'Get information about the project structure and files' clearly states the verb 'Get' and resource 'project structure and files', but it's vague about what specific information is retrieved. It doesn't distinguish from siblings like 'analyze_project' or 'get_doc_content' which might overlap in functionality.

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 guidance is provided on when to use this tool versus alternatives. With siblings like 'analyze_project' and 'get_doc_content' that might retrieve similar information, the description offers no context on use cases, 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

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

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