Open Context Protocol is live! 🚀 Read the launch post

pullsListCommits

List commits on a pull request

Details

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

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": "Commit",
    "description": "Commit",
    "type": "object",
    "properties": {
      "url": {
        "type": "string",
        "format": "uri",
        "example": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e"
      },
      "sha": {
        "type": "string",
        "example": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
      },
      "node_id": {
        "type": "string",
        "example": "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ=="
      },
      "html_url": {
        "type": "string",
        "format": "uri",
        "example": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e"
      },
      "comments_url": {
        "type": "string",
        "format": "uri",
        "example": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments"
      },
      "commit": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e"
          },
          "author": {
            "title": "Git User",
            "description": "Metaproperties for Git author/committer information.",
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "example": "\"Chris Wanstrath\""
              },
              "email": {
                "type": "string",
                "example": "\"chris@ozmm.org\""
              },
              "date": {
                "type": "string",
                "format": "date-time",
                "example": "\"2007-10-29T02:42:39.000-07:00\""
              }
            },
            "nullable": true
          },
          "committer": {
            "title": "Git User",
            "description": "Metaproperties for Git author/committer information.",
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "example": "\"Chris Wanstrath\""
              },
              "email": {
                "type": "string",
                "example": "\"chris@ozmm.org\""
              },
              "date": {
                "type": "string",
                "format": "date-time",
                "example": "\"2007-10-29T02:42:39.000-07:00\""
              }
            },
            "nullable": true
          },
          "message": {
            "type": "string",
            "example": "Fix all the bugs"
          },
          "comment_count": {
            "type": "integer",
            "example": 0
          },
          "tree": {
            "type": "object",
            "properties": {
              "sha": {
                "type": "string",
                "example": "827efc6d56897b048c772eb4087f854f46256132"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/repos/octocat/Hello-World/tree/827efc6d56897b048c772eb4087f854f46256132"
              }
            },
            "required": [
              "sha",
              "url"
            ]
          },
          "verification": {
            "title": "Verification",
            "type": "object",
            "properties": {
              "verified": {
                "type": "boolean"
              },
              "reason": {
                "type": "string"
              },
              "payload": {
                "type": "string",
                "nullable": true
              },
              "signature": {
                "type": "string",
                "nullable": true
              },
              "verified_at": {
                "type": "string",
                "nullable": true
              }
            },
            "required": [
              "verified",
              "reason",
              "payload",
              "signature",
              "verified_at"
            ]
          }
        },
        "required": [
          "author",
          "committer",
          "comment_count",
          "message",
          "tree",
          "url"
        ]
      },
      "author": {
        "oneOf": [
          {
            "title": "Simple User",
            "description": "A GitHub user.",
            "type": "object",
            "properties": {
              "name": {
                "nullable": true,
                "type": "string"
              },
              "email": {
                "nullable": true,
                "type": "string"
              },
              "login": {
                "type": "string",
                "example": "octocat"
              },
              "id": {
                "type": "integer",
                "format": "int64",
                "example": 1
              },
              "node_id": {
                "type": "string",
                "example": "MDQ6VXNlcjE="
              },
              "avatar_url": {
                "type": "string",
                "format": "uri",
                "example": "https://github.com/images/error/octocat_happy.gif"
              },
              "gravatar_id": {
                "type": "string",
                "example": "41d064eb2195891e12d0413f63227ea7",
                "nullable": true
              },
              "url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat"
              },
              "html_url": {
                "type": "string",
                "format": "uri",
                "example": "https://github.com/octocat"
              },
              "followers_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/followers"
              },
              "following_url": {
                "type": "string",
                "example": "https://api.github.com/users/octocat/following{/other_user}"
              },
              "gists_url": {
                "type": "string",
                "example": "https://api.github.com/users/octocat/gists{/gist_id}"
              },
              "starred_url": {
                "type": "string",
                "example": "https://api.github.com/users/octocat/starred{/owner}{/repo}"
              },
              "subscriptions_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/subscriptions"
              },
              "organizations_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/orgs"
              },
              "repos_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/repos"
              },
              "events_url": {
                "type": "string",
                "example": "https://api.github.com/users/octocat/events{/privacy}"
              },
              "received_events_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/received_events"
              },
              "type": {
                "type": "string",
                "example": "User"
              },
              "site_admin": {
                "type": "boolean"
              },
              "starred_at": {
                "type": "string",
                "example": "\"2020-07-09T00:17:55Z\""
              },
              "user_view_type": {
                "type": "string",
                "example": "public"
              }
            },
            "required": [
              "avatar_url",
              "events_url",
              "followers_url",
              "following_url",
              "gists_url",
              "gravatar_id",
              "html_url",
              "id",
              "node_id",
              "login",
              "organizations_url",
              "received_events_url",
              "repos_url",
              "site_admin",
              "starred_url",
              "subscriptions_url",
              "type",
              "url"
            ]
          },
          {
            "title": "Empty Object",
            "description": "An object without any properties.",
            "type": "object",
            "properties": {},
            "additionalProperties": false
          }
        ],
        "nullable": true
      },
      "committer": {
        "oneOf": [
          {
            "title": "Simple User",
            "description": "A GitHub user.",
            "type": "object",
            "properties": {
              "name": {
                "nullable": true,
                "type": "string"
              },
              "email": {
                "nullable": true,
                "type": "string"
              },
              "login": {
                "type": "string",
                "example": "octocat"
              },
              "id": {
                "type": "integer",
                "format": "int64",
                "example": 1
              },
              "node_id": {
                "type": "string",
                "example": "MDQ6VXNlcjE="
              },
              "avatar_url": {
                "type": "string",
                "format": "uri",
                "example": "https://github.com/images/error/octocat_happy.gif"
              },
              "gravatar_id": {
                "type": "string",
                "example": "41d064eb2195891e12d0413f63227ea7",
                "nullable": true
              },
              "url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat"
              },
              "html_url": {
                "type": "string",
                "format": "uri",
                "example": "https://github.com/octocat"
              },
              "followers_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/followers"
              },
              "following_url": {
                "type": "string",
                "example": "https://api.github.com/users/octocat/following{/other_user}"
              },
              "gists_url": {
                "type": "string",
                "example": "https://api.github.com/users/octocat/gists{/gist_id}"
              },
              "starred_url": {
                "type": "string",
                "example": "https://api.github.com/users/octocat/starred{/owner}{/repo}"
              },
              "subscriptions_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/subscriptions"
              },
              "organizations_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/orgs"
              },
              "repos_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/repos"
              },
              "events_url": {
                "type": "string",
                "example": "https://api.github.com/users/octocat/events{/privacy}"
              },
              "received_events_url": {
                "type": "string",
                "format": "uri",
                "example": "https://api.github.com/users/octocat/received_events"
              },
              "type": {
                "type": "string",
                "example": "User"
              },
              "site_admin": {
                "type": "boolean"
              },
              "starred_at": {
                "type": "string",
                "example": "\"2020-07-09T00:17:55Z\""
              },
              "user_view_type": {
                "type": "string",
                "example": "public"
              }
            },
            "required": [
              "avatar_url",
              "events_url",
              "followers_url",
              "following_url",
              "gists_url",
              "gravatar_id",
              "html_url",
              "id",
              "node_id",
              "login",
              "organizations_url",
              "received_events_url",
              "repos_url",
              "site_admin",
              "starred_url",
              "subscriptions_url",
              "type",
              "url"
            ]
          },
          {
            "title": "Empty Object",
            "description": "An object without any properties.",
            "type": "object",
            "properties": {},
            "additionalProperties": false
          }
        ],
        "nullable": true
      },
      "parents": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "sha": {
              "type": "string",
              "example": "7638417db6d59f3c431d3e1f261cc637155684cd"
            },
            "url": {
              "type": "string",
              "format": "uri",
              "example": "https://api.github.com/repos/octocat/Hello-World/commits/7638417db6d59f3c431d3e1f261cc637155684cd"
            },
            "html_url": {
              "type": "string",
              "format": "uri",
              "example": "https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd"
            }
          },
          "required": [
            "sha",
            "url"
          ]
        }
      },
      "stats": {
        "type": "object",
        "properties": {
          "additions": {
            "type": "integer"
          },
          "deletions": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "files": {
        "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"
          ]
        }
      }
    },
    "required": [
      "url",
      "sha",
      "node_id",
      "html_url",
      "comments_url",
      "commit",
      "author",
      "committer",
      "parents"
    ]
  }
}

Usage

from ocp_agent import OCPAgent

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

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