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
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| pull_number | Yes | Pull request number | |
| repo | Yes | Repository name |
Implementation Reference
- src/tools/files.ts:260-284 (handler)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'); }
- src/server.ts:905-926 (schema)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, }, },
- src/server.ts:1204-1206 (registration)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';