@@ -70,8 +70,7 @@ class GitShow(BaseModel):
7070 repo_path : str
7171 revision : str
7272
73- class GitInit (BaseModel ):
74- repo_path : str
73+
7574
7675class GitBranch (BaseModel ):
7776 repo_path : str = Field (
@@ -104,7 +103,7 @@ class GitTools(str, Enum):
104103 CREATE_BRANCH = "git_create_branch"
105104 CHECKOUT = "git_checkout"
106105 SHOW = "git_show"
107- INIT = "git_init"
106+
108107 BRANCH = "git_branch"
109108
110109def git_status (repo : git .Repo ) -> str :
@@ -183,12 +182,7 @@ def git_checkout(repo: git.Repo, branch_name: str) -> str:
183182 repo .git .checkout (branch_name )
184183 return f"Switched to branch '{ branch_name } '"
185184
186- def git_init (repo_path : str ) -> str :
187- try :
188- repo = git .Repo .init (path = repo_path , mkdir = True )
189- return f"Initialized empty Git repository in { repo .git_dir } "
190- except Exception as e :
191- return f"Error initializing repository: { str (e )} "
185+
192186
193187def git_show (repo : git .Repo , revision : str ) -> str :
194188 commit = repo .commit (revision )
@@ -308,11 +302,7 @@ async def list_tools() -> list[Tool]:
308302 description = "Shows the contents of a commit" ,
309303 inputSchema = GitShow .model_json_schema (),
310304 ),
311- Tool (
312- name = GitTools .INIT ,
313- description = "Initialize a new Git repository" ,
314- inputSchema = GitInit .model_json_schema (),
315- ),
305+
316306 Tool (
317307 name = GitTools .BRANCH ,
318308 description = "List Git branches" ,
@@ -354,15 +344,7 @@ def by_commandline() -> Sequence[str]:
354344 async def call_tool (name : str , arguments : dict ) -> list [TextContent ]:
355345 repo_path = Path (arguments ["repo_path" ])
356346
357- # Handle git init separately since it doesn't require an existing repo
358- if name == GitTools .INIT :
359- result = git_init (str (repo_path ))
360- return [TextContent (
361- type = "text" ,
362- text = result
363- )]
364-
365- # For all other commands, we need an existing repo
347+ # For all commands, we need an existing repo
366348 repo = git .Repo (repo_path )
367349
368350 match name :
0 commit comments