@@ -70,8 +70,7 @@ class GitShow(BaseModel):
70
70
repo_path : str
71
71
revision : str
72
72
73
- class GitInit (BaseModel ):
74
- repo_path : str
73
+
75
74
76
75
class GitBranch (BaseModel ):
77
76
repo_path : str = Field (
@@ -104,7 +103,7 @@ class GitTools(str, Enum):
104
103
CREATE_BRANCH = "git_create_branch"
105
104
CHECKOUT = "git_checkout"
106
105
SHOW = "git_show"
107
- INIT = "git_init"
106
+
108
107
BRANCH = "git_branch"
109
108
110
109
def git_status (repo : git .Repo ) -> str :
@@ -183,12 +182,7 @@ def git_checkout(repo: git.Repo, branch_name: str) -> str:
183
182
repo .git .checkout (branch_name )
184
183
return f"Switched to branch '{ branch_name } '"
185
184
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
+
192
186
193
187
def git_show (repo : git .Repo , revision : str ) -> str :
194
188
commit = repo .commit (revision )
@@ -308,11 +302,7 @@ async def list_tools() -> list[Tool]:
308
302
description = "Shows the contents of a commit" ,
309
303
inputSchema = GitShow .model_json_schema (),
310
304
),
311
- Tool (
312
- name = GitTools .INIT ,
313
- description = "Initialize a new Git repository" ,
314
- inputSchema = GitInit .model_json_schema (),
315
- ),
305
+
316
306
Tool (
317
307
name = GitTools .BRANCH ,
318
308
description = "List Git branches" ,
@@ -354,15 +344,7 @@ def by_commandline() -> Sequence[str]:
354
344
async def call_tool (name : str , arguments : dict ) -> list [TextContent ]:
355
345
repo_path = Path (arguments ["repo_path" ])
356
346
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
366
348
repo = git .Repo (repo_path )
367
349
368
350
match name :
0 commit comments