Skip to main content
Glama
martinsky999

MCP Git Server

by martinsky999

git_add

Stage file changes in a Git repository to prepare them for committing. Specify the repository path and files to add to the staging area.

Instructions

Adds file contents to the staging area

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
filesYes

Implementation Reference

  • The core handler function that stages the specified files using the Git repository's index.
    def git_add(repo: git.Repo, files: list[str]) -> str:
        repo.index.add(files)
        return "Files staged successfully"
  • Pydantic model defining the input schema for the git_add tool, including repo_path and list of files.
    class GitAdd(BaseModel):
        repo_path: str
        files: list[str]
  • Registration of the git_add tool in the list_tools handler, specifying name, description, and input schema.
    Tool(
        name=GitTools.ADD,
        description="Adds file contents to the staging area",
        inputSchema=GitAdd.schema(),
    ),
  • Dispatcher logic in call_tool that invokes the git_add handler with parsed arguments and formats the response.
    case GitTools.ADD:
        result = git_add(repo, arguments["files"])
        return [TextContent(
            type="text",
            text=result
        )]
  • Enum constant defining the tool name 'git_add' in GitTools.
    ADD = "git_add"
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 mentions adding to the staging area, implying a mutation, but doesn't cover permissions, reversibility, error handling, or what happens if files don't exist. This is a significant gap for a tool that modifies state.

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 with zero waste. It's appropriately sized and front-loaded, making it easy to scan and understand the core purpose quickly.

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, 0% schema coverage, no output schema, and 2 parameters, the description is incomplete. It lacks details on behavior, parameters, and usage context, making it inadequate for a mutation tool in a complex domain like git.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It mentions 'file contents' and 'staging area', which loosely relates to the 'files' parameter, but doesn't explain 'repo_path' or provide details on file paths, wildcards, or format. The description adds minimal value beyond the schema.

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 ('adds file contents') and target ('to the staging area'), which is specific and distinguishes it from siblings like git_commit or git_reset. However, it doesn't explicitly differentiate from all siblings (e.g., git_diff_staged might be related), so it's not a perfect 5.

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 like git_commit or git_reset, nor does it mention prerequisites (e.g., needing a git repository). It only states what it does, not when or why to use it.

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/martinsky999/mcp-git-py'

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