Skip to main content
Glama
PhialsBasement

GitHub MCP Server Plus

push_files_from_path

Push multiple files from local paths to a GitHub repository in one commit. Upload files to a specified branch with a commit message.

Instructions

Push multiple files from filesystem paths 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 from filesystem paths
messageYesCommit message

Implementation Reference

  • The primary handler function for the 'push_files_from_path' tool. It validates local file existence, reads their contents, converts to FileContent format, and pushes to GitHub repository using pushFilesContent.
    export async function pushFilesFromPath(
      owner: string,
      repo: string,
      branch: string,
      files: FilePath[],
      message: string
    ) {
      try {
        // First verify all files exist before attempting any operations
        await Promise.all(
          files.map(async (file) => {
            try {
              await fs.access(file.filepath);
            } catch (err) {
              const error = err as Error;
              throw new Error(`File not accessible: ${file.filepath} - ${error.toString()}`);
            }
          })
        );
    
        // Convert FilePath objects to FileContent objects by reading the files
        const fileContents: FileContent[] = await Promise.all(
          files.map(async (file) => {
            try {
              const content = await fs.readFile(file.filepath, 'utf8');
              return {
                path: file.path,
                content,
              };
            } catch (err) {
              const error = err as Error;
              throw new Error(`Failed to read file ${file.filepath}: ${error.toString()}`);
            }
          })
        );
    
        if (!fileContents.length) {
          throw new Error('No files were successfully read');
        }
    
        // Use the existing pushFilesContent function with the read content
        return pushFilesContent(owner, repo, branch, fileContents, message);
      } catch (err) {
        const error = err as Error;
        throw new Error(`Failed to push files: ${error.toString()}`);
      }
    }
  • Zod schema defining the input parameters for the push_files_from_path tool, including owner, repo, branch, files array (with path and filepath), and commit message.
    export const PushFilesFromPathSchema = 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(FilePathSchema).describe("Array of files to push from filesystem paths"),
      message: z.string().describe("Commit message"),
    });
  • index.ts:253-265 (registration)
    Registration and dispatching in the CallToolRequestHandler switch statement: parses arguments using the schema and invokes the pushFilesFromPath handler.
    case "push_files_from_path": {
      const args = files.PushFilesFromPathSchema.parse(request.params.arguments);
      const result = await files.pushFilesFromPath(
        args.owner,
        args.repo,
        args.branch,
        args.files,
        args.message
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
  • index.ts:94-97 (registration)
    Tool metadata registration in the ListToolsRequestHandler: defines name, description, and input schema for discovery.
      name: "push_files_from_path",
      description: "Push multiple files from filesystem paths to a GitHub repository in a single commit",
      inputSchema: zodToJsonSchema(files.PushFilesFromPathSchema),
    },
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the batch operation and single-commit behavior, which is useful. However, it lacks details on permissions required, error handling (e.g., if files don't exist), rate limits, or whether it overwrites existing files. For a mutation tool with zero annotation coverage, this leaves gaps in behavioral understanding.

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 with no wasted words. It clearly communicates the tool's function without redundancy or unnecessary elaboration, making it easy to parse quickly.

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

Completeness3/5

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

For a mutation tool with 5 parameters and no annotations or output schema, the description is adequate but incomplete. It covers the basic operation but lacks details on behavioral aspects (e.g., side effects, error cases) and doesn't hint at return values. Given the complexity, more context would be beneficial for safe and effective use.

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 the schema already documents all 5 parameters clearly. The description adds minimal value beyond the schema by implying 'multiple files' and 'filesystem paths,' but doesn't explain parameter interactions (e.g., how 'files' array works) or provide examples. Baseline 3 is appropriate when the 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 ('from filesystem paths to a GitHub repository'), and scope ('in a single commit'). It distinguishes itself from sibling tools like 'push_files_content' (which likely pushes content directly rather than from filesystem paths) and 'create_or_update_file' (which handles individual files).

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'multiple files from filesystem paths' and 'single commit,' suggesting it's for batch operations rather than individual file updates. However, it doesn't explicitly state when to use this tool versus alternatives like 'push_files_content' or 'create_or_update_file,' nor does it mention prerequisites (e.g., authentication, file existence).

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/PhialsBasement/mcp-github-server-plus'

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