Skip to main content
Glama

push_files

Push multiple files to a GitHub repository in a single commit, simplifying batch file uploads and version control management.

Instructions

Push multiple files to a GitHub repository in a single commit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
repoYesRepository name
branchYesBranch to push to (e.g., 'main' or 'master')
filesYesArray of files to push
messageYesCommit message

Implementation Reference

  • The core handler function implementing the push_files tool logic, which creates a new Git tree, commit, and updates the branch reference on GitHub.
    export async function pushFiles(
      github_pat: string,
      owner: string,
      repo: string,
      branch: string,
      files: FileOperation[],
      message: string
    ) {
      const refResponse = await githubRequest(
        github_pat,
        `https://api.github.com/repos/${owner}/${repo}/git/refs/heads/${branch}`
      );
    
      const ref = GitHubReferenceSchema.parse(refResponse);
      const commitSha = ref.object.sha;
    
      const tree = await createTree(github_pat, owner, repo, files, commitSha);
      const commit = await createCommit(github_pat, owner, repo, message, tree.sha, [commitSha]);
      return await updateReference(github_pat, owner, repo, `heads/${branch}`, commit.sha);
    }
  • Zod schema defining the public input parameters for the push_files tool.
    export const PushFilesSchema = z.object({
      owner: z.string().describe("Repository owner (username or organization)"),
      repo: z.string().describe("Repository name"),
      branch: z.string().describe("Branch to push to (e.g., 'main' or 'master')"),
      files: z.array(FileOperationSchema).describe("Array of files to push"),
      message: z.string().describe("Commit message"),
    });
  • src/index.ts:98-102 (registration)
    Tool registration in the MCP server's listTools response, specifying name, description, and input schema.
    {
      name: "push_files",
      description: "Push multiple files to a GitHub repository in a single commit",
      inputSchema: zodToJsonSchema(files.PushFilesSchema),
    },
  • Top-level dispatch handler in the MCP CallToolRequestSchema that validates arguments with internal schema and invokes the pushFiles function.
    case "push_files": {
      const args = files._PushFilesSchema.parse(params.arguments);
      const result = await files.pushFiles(
        args.github_pat,
        args.owner,
        args.repo,
        args.branch,
        args.files,
        args.message
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
  • Helper schema for individual file operations used within PushFilesSchema's 'files' array.
    export const FileOperationSchema = z.object({
      path: z.string(),
      content: z.string(),
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the basic operation. It doesn't disclose critical behavioral traits like authentication requirements, rate limits, whether it overwrites existing files, error handling for invalid paths, or what happens on success/failure. 'Push' implies a write operation, but details are missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. Every word earns its place with no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a write operation with 5 parameters and no annotations or output schema, the description is incomplete. It lacks information about authentication, error handling, response format, and how it differs from similar tools. The context signals indicate complexity that isn't addressed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter semantics beyond what's in the schema (e.g., format of 'files' array, encoding of 'content'). Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('push multiple files'), resource ('to a GitHub repository'), and scope ('in a single commit'). It distinguishes itself from sibling tools like 'create_or_update_file' (which handles single files) by emphasizing batch operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for batch file uploads to GitHub, but doesn't explicitly state when to use this vs. alternatives like 'create_or_update_file' for single files or other sibling tools. No guidance on prerequisites, error conditions, or exclusions is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/MissionSquad/mcp-github'

If you have feedback or need assistance with the MCP directory API, please join our Discord server