MCPcopy
hub / github.com/github/github-mcp-server / PushFiles

Function PushFiles

pkg/github/repositories.go:1296–1528  ·  view source on GitHub ↗

PushFiles creates a tool to push multiple files in a single commit to a GitHub repository.

(t translations.TranslationHelperFunc)

Source from the content-addressed store, hash-verified

1294
1295// PushFiles creates a tool to push multiple files in a single commit to a GitHub repository.
1296func PushFiles(t translations.TranslationHelperFunc) inventory.ServerTool {
1297 return NewTool(
1298 ToolsetMetadataRepos,
1299 mcp.Tool{
1300 Name: "push_files",
1301 Description: t("TOOL_PUSH_FILES_DESCRIPTION", "Push multiple files to a GitHub repository in a single commit"),
1302 Annotations: &mcp.ToolAnnotations{
1303 Title: t("TOOL_PUSH_FILES_USER_TITLE", "Push files to repository"),
1304 ReadOnlyHint: false,
1305 },
1306 InputSchema: &jsonschema.Schema{
1307 Type: "object",
1308 Properties: map[string]*jsonschema.Schema{
1309 "owner": {
1310 Type: "string",
1311 Description: "Repository owner",
1312 },
1313 "repo": {
1314 Type: "string",
1315 Description: "Repository name",
1316 },
1317 "branch": {
1318 Type: "string",
1319 Description: "Branch to push to",
1320 },
1321 "files": {
1322 Type: "array",
1323 Description: "Array of file objects to push, each object with path (string) and content (string)",
1324 Items: &jsonschema.Schema{
1325 Type: "object",
1326 AdditionalProperties: &jsonschema.Schema{Not: &jsonschema.Schema{}},
1327 Properties: map[string]*jsonschema.Schema{
1328 "path": {
1329 Type: "string",
1330 Description: "path to the file",
1331 },
1332 "content": {
1333 Type: "string",
1334 Description: "file content",
1335 },
1336 },
1337 Required: []string{"path", "content"},
1338 },
1339 },
1340 "message": {
1341 Type: "string",
1342 Description: "Commit message",
1343 },
1344 },
1345 Required: []string{"owner", "repo", "branch", "files", "message"},
1346 },
1347 },
1348 []scopes.Scope{scopes.Repo},
1349 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
1350 owner, err := RequiredParam[string](args, "owner")
1351 if err != nil {
1352 return utils.NewToolResultError(err.Error()), nil, nil
1353 }

Callers 2

AllToolsFunction · 0.85
Test_PushFilesFunction · 0.85

Calls 8

NewToolResultErrorFunction · 0.92
NewToolResultTextFunction · 0.92
NewToolFunction · 0.85
initializeRepositoryFunction · 0.85
CloseMethod · 0.80
GetClientMethod · 0.65
ErrorMethod · 0.45

Tested by 1

Test_PushFilesFunction · 0.68