Open Context Protocol is live! 🚀 Read the launch post

pullsListFiles

List pull requests files

Details

  • Method: GET
  • Path: /repos/{owner}/{repo}/pulls/{pull_number}/files
  • Operation ID: pulls/list-files

Parameters

{
  "owner": {
    "description": "The account owner of the repository. The name is not case sensitive.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "repo": {
    "description": "The name of the repository without the `.git` extension. The name is not case sensitive.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "pull_number": {
    "description": "The number that identifies the pull request.",
    "required": true,
    "location": "path",
    "type": "integer"
  },
  "per_page": {
    "description": "The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "page": {
    "description": "The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"",
    "required": false,
    "location": "query",
    "type": "integer"
  }
}

Response Schema

{
  "type": "array",
  "items": {
    "title": "Diff Entry",
    "description": "Diff Entry",
    "type": "object",
    "properties": {
      "sha": {
        "type": "string",
        "nullable": true,
        "example": "bbcd538c8e72b8c175046e27cc8f907076331401"
      },
      "filename": {
        "type": "string",
        "example": "file1.txt"
      },
      "status": {
        "type": "string",
        "enum": [
          "added",
          "removed",
          "modified",
          "renamed",
          "copied",
          "changed",
          "unchanged"
        ],
        "example": "added"
      },
      "additions": {
        "type": "integer",
        "example": 103
      },
      "deletions": {
        "type": "integer",
        "example": 21
      },
      "changes": {
        "type": "integer",
        "example": 124
      },
      "blob_url": {
        "type": "string",
        "format": "uri",
        "example": "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt"
      },
      "raw_url": {
        "type": "string",
        "format": "uri",
        "example": "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt"
      },
      "contents_url": {
        "type": "string",
        "format": "uri",
        "example": "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e"
      },
      "patch": {
        "type": "string",
        "example": "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"
      },
      "previous_filename": {
        "type": "string",
        "example": "file.txt"
      }
    },
    "required": [
      "additions",
      "blob_url",
      "changes",
      "contents_url",
      "deletions",
      "filename",
      "raw_url",
      "sha",
      "status"
    ]
  }
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('github')

# Call this tool
result = await agent.call_tool('pullsListFiles', {
    # Add required parameters here
})