Skip to main content
Glama
bsreeram08

Git Repo Browser MCP

git_read_files

Read specific files from a Git repository to access their contents directly without cloning the entire repository locally.

Instructions

Read the contents of specified files in a given git repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_urlYesThe URL of the Git repository
file_pathsYesList of file paths to read (relative to repository root)

Implementation Reference

  • Core handler function that implements the git_read_files tool logic: clones the repository, reads specified files, and returns their contents as JSON.
    export async function handleGitReadFiles({ repo_url, file_paths }) {
      try {
        const repoPath = await cloneRepo(repo_url);
        const results = {};
    
        for (const filePath of file_paths) {
          const fullPath = path.join(repoPath, filePath);
          try {
            if (await fs.pathExists(fullPath)) {
              results[filePath] = await fs.readFile(fullPath, "utf8");
            } else {
              results[filePath] = "Error: File not found";
            }
          } catch (error) {
            results[filePath] = `Error reading file: ${error.message}`;
          }
        }
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(results, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                { error: `Failed to process repository: ${error.message}` },
                null,
                2
              ),
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the git_read_files tool, specifying parameters repo_url and file_paths.
    {
      name: "git_read_files",
      description:
        "Read the contents of specified files in a given git repository.",
      inputSchema: {
        type: "object",
        properties: {
          repo_url: {
            type: "string",
            description: "The URL of the Git repository",
          },
          file_paths: {
            type: "array",
            items: { type: "string" },
            description:
              "List of file paths to read (relative to repository root)",
          },
        },
        required: ["repo_url", "file_paths"],
      },
    },
  • src/server.js:901-901 (registration)
    Maps the tool name 'git_read_files' to its handler function handleGitReadFiles in the central handlersMap.
    git_read_files: handleGitReadFiles,
  • Re-exports the handleGitReadFiles function from directory-operations.js for use in server.js.
    handleGitReadFiles,
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool reads file contents but doesn't mention critical behaviors like error handling (e.g., for non-existent files), authentication needs, rate limits, or output format. For a read operation with zero annotation coverage, this is a significant gap in transparency.

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 directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. Every part of the sentence earns its place by conveying essential information.

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 the tool's moderate complexity (reading files from a Git repository), lack of annotations, and absence of an output schema, the description is incomplete. It doesn't address behavioral aspects like error cases, authentication, or what the return values look like (e.g., file contents as strings). For a tool with 2 parameters and no structured safety hints, more context is needed.

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?

The input schema has 100% description coverage, clearly documenting both parameters (repo_url and file_paths). The description adds no additional semantic context beyond what's in the schema, such as examples or constraints (e.g., URL formats, path syntax). With high schema coverage, the baseline score of 3 is appropriate.

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 action ('Read the contents') and resource ('specified files in a given git repository'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like git_search_code or git_directory_structure that might also involve reading repository content, 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. It doesn't mention prerequisites (e.g., repository accessibility), exclusions (e.g., binary files), or comparisons to siblings like git_search_code for content searching or git_directory_structure for browsing. This leaves the agent without contextual usage direction.

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/bsreeram08/git-commands-mcp'

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