Skip to main content
Glama

git_add

Add files to the staging area in a Git repository using the MCP Git Server. Specify the repository path and files to prepare them for commit, streamlining version control workflows.

Instructions

Adds file contents to the staging area

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYes
repo_pathYes

Implementation Reference

  • The git_add handler function stages the specified files in the Git repository index.
    def git_add(repo: git.Repo, files: list[str]) -> str: repo.index.add(files) return "Files staged successfully"
  • Pydantic BaseModel 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() method, specifying name, description, and input schema.
    Tool( name=GitTools.ADD, description="Adds file contents to the staging area", inputSchema=GitAdd.schema(), ),
  • Tool dispatch logic in call_tool() that invokes the git_add handler with arguments from the tool call.
    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"

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

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