Skip to main content
Glama

git_init

Set up a new Git repository by specifying the path. This tool simplifies repository initialization, enabling quick project setup for version control.

Instructions

Initialize a new Git repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes

Implementation Reference

  • The main handler function for git_init tool that initializes a new Git repository at the given path using gitpython Repo.init().
    def git_init(repo_path: str) -> str: try: repo = git.Repo.init(path=repo_path, mkdir=True) return f"Initialized empty Git repository in {repo.git_dir}" except Exception as e: return f"Error initializing repository: {str(e)}"
  • Pydantic BaseModel defining the input schema for the git_init tool, which requires a repo_path string.
    class GitInit(BaseModel): repo_path: str
  • Registration of the git_init tool within the list_tools() decorator, defining its name, description, and input schema.
    Tool( name=GitTools.INIT, description="Initialize a new Git repository", inputSchema=GitInit.schema(), )
  • Enum value in GitTools defining the string name 'git_init' for the tool.
    INIT = "git_init"
  • Dispatch logic in the call_tool() handler specifically for git_init, calling the handler function and returning the result as TextContent.
    if name == GitTools.INIT: result = git_init(str(repo_path)) return [TextContent( type="text", text=result )]

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