Skip to main content
Glama

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"

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