@@ -393,7 +393,7 @@ func CreateOrUpdateFile(getClient GetClientFn, t translations.TranslationHelperF
393
393
// CreateRepository creates a tool to create a new GitHub repository.
394
394
func CreateRepository (getClient GetClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
395
395
return mcp .NewTool ("create_repository" ,
396
- mcp .WithDescription (t ("TOOL_CREATE_REPOSITORY_DESCRIPTION" , "Create a new GitHub repository in your account" )),
396
+ mcp .WithDescription (t ("TOOL_CREATE_REPOSITORY_DESCRIPTION" , "Create a new GitHub repository in your account or specified organization " )),
397
397
mcp .WithToolAnnotation (mcp.ToolAnnotation {
398
398
Title : t ("TOOL_CREATE_REPOSITORY_USER_TITLE" , "Create repository" ),
399
399
ReadOnlyHint : ToBoolPtr (false ),
@@ -405,6 +405,9 @@ func CreateRepository(getClient GetClientFn, t translations.TranslationHelperFun
405
405
mcp .WithString ("description" ,
406
406
mcp .Description ("Repository description" ),
407
407
),
408
+ mcp .WithString ("organization" ,
409
+ mcp .Description ("Organization to create the repository in (omit to create in your personal account)" ),
410
+ ),
408
411
mcp .WithBoolean ("private" ,
409
412
mcp .Description ("Whether repo should be private" ),
410
413
),
@@ -421,6 +424,10 @@ func CreateRepository(getClient GetClientFn, t translations.TranslationHelperFun
421
424
if err != nil {
422
425
return mcp .NewToolResultError (err .Error ()), nil
423
426
}
427
+ organization , err := OptionalParam [string ](request , "organization" )
428
+ if err != nil {
429
+ return mcp .NewToolResultError (err .Error ()), nil
430
+ }
424
431
private , err := OptionalParam [bool ](request , "private" )
425
432
if err != nil {
426
433
return mcp .NewToolResultError (err .Error ()), nil
@@ -441,7 +448,7 @@ func CreateRepository(getClient GetClientFn, t translations.TranslationHelperFun
441
448
if err != nil {
442
449
return nil , fmt .Errorf ("failed to get GitHub client: %w" , err )
443
450
}
444
- createdRepo , resp , err := client .Repositories .Create (ctx , "" , repo )
451
+ createdRepo , resp , err := client .Repositories .Create (ctx , organization , repo )
445
452
if err != nil {
446
453
return ghErrors .NewGitHubAPIErrorResponse (ctx ,
447
454
"failed to create repository" ,
0 commit comments