Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

get-pull-request-files

Retrieve the list of files modified in a GitHub pull request to review changes, track modifications, and assess code impact.

Instructions

Get the list of files changed in a pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
pull_numberYesPull request number
repoYesRepository name

Implementation Reference

  • Implements the core logic of the 'get-pull-request-files' tool by calling GitHub's pulls.listFiles API and mapping the response.
    export async function getPullRequestFiles(args: unknown): Promise<any> {
      const { owner, repo, pull_number } = args as { owner: string; repo: string; pull_number: number };
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().pulls.listFiles({
          owner,
          repo,
          pull_number,
        });
    
        return data.map((file) => ({
          sha: file.sha,
          filename: file.filename,
          status: file.status,
          additions: file.additions,
          deletions: file.deletions,
          changes: file.changes,
          blob_url: file.blob_url,
          raw_url: file.raw_url,
          contents_url: file.contents_url,
          patch: file.patch,
        }));
      }, 'Failed to get pull request files');
    }
  • Defines the input schema and metadata for the 'get-pull-request-files' tool in the list of available tools.
      name: 'get-pull-request-files',
      description: 'Get the list of files changed in a pull request',
      inputSchema: {
        type: 'object',
        properties: {
          owner: {
            type: 'string',
            description: 'Repository owner (username or organization)',
          },
          repo: {
            type: 'string',
            description: 'Repository name',
          },
          pull_number: {
            type: 'number',
            description: 'Pull request number',
          },
        },
        required: ['owner', 'repo', 'pull_number'],
        additionalProperties: false,
      },
    },
  • Registers the 'get-pull-request-files' tool handler in the switch statement for CallToolRequestSchema.
    case 'get-pull-request-files':
      result = await getPullRequestFiles(parsedArgs);
      break;
  • src/server.ts:25-32 (registration)
    Imports the getPullRequestFiles handler function from './tools/files.js'.
    import {
      createOrUpdateFile,
      pushFiles,
      getFileContents,
      forkRepository,
      getPullRequestFiles,
    } from './tools/files.js';

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/piyushgIITian/github-enterprice-mcp'

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