Skip to main content
Glama

Octocode MCP

by bgauryy

githubSearchPullRequests

Search GitHub pull requests by keywords, state, or author to identify relevant PRs. Fetch head/base branch SHAs for detailed commit analysis or retrieve all PR commits with file changes for deeper insights.

Instructions

Search GitHub PRs by keywords, state, or author. Returns head/base SHAs for github_fetch_content (branch=SHA). Can fetch all PR commits with changes using getCommitData=true.

SEARCH STRATEGY FOR BEST RESULTS:

  • Use minimal search terms for broader coverage (2-3 words max)
  • Separate searches for different aspects vs complex queries
  • Use filters to narrow scope after getting initial results
  • Use getCommitData=true to get all commits in PR with file changes
  • Use github_search_commits with head_sha/base_sha from results to get code changes

COMMIT DATA FETCHING (getCommitData=true):

  • Fetches all commits in the PR using 'gh pr view --json commits'
  • For each commit, fetches detailed changes using GitHub API
  • Shows commit SHA, message, author, and file changes
  • Includes up to 10 commits per PR with detailed diffs
  • Each commit shows changed files with additions/deletions/patches
  • Example: Shows individual commits like "Fix bug in component" with specific file changes

EXAMPLE OUTPUT WITH getCommitData=true: { "commits": { "total_count": 3, "commits": [ { "sha": "abc123", "message": "Fix bug in component", "author": "username", "diff": { "changed_files": 2, "additions": 15, "deletions": 3, "files": [...] } } ] } }

NOTE: The head_sha and base_sha fields in the PR results can be used as the 'hash' parameter in github_search_commits to look up the exact commit and get actual code changes.

TOKEN OPTIMIZATION:

  • getCommitData=true is expensive in tokens. Use only when necessary.
  • Consider using github_search_commits with head_sha/base_sha instead for specific commits

Input Schema

NameRequiredDescriptionDefault
appNoFilter by GitHub App author
archivedNoFilter by repository archived state
assigneeNoGitHub username of assignee
authorNoGitHub username of PR author
baseNoFilter on base branch name
checksNoFilter by checks status
closedNoFilter by closed date (e.g., >2020-01-01)
commenterNoUser who commented on PR
commentsNoInclude comment content in search results. This is a very expensive operation in tokens and should be used with caution.
createdNoFilter by created date (e.g., >2020-01-01)
draftNoFilter by draft state
getCommitDataNoSet to true to fetch all commits in the PR with their changes. Shows commit messages, authors, and file changes. WARNING: EXTREMELY expensive in tokens - fetches diff/patch content for each commit.
headNoFilter on head branch name
interactionsNoTotal interactions (reactions + comments)
involvesNoUser involved in any way
labelNoFilter by label
languageNoRepository language
limitNoMaximum number of results to fetch
lockedNoFilter by locked conversation status
matchNoRestrict search to specific fields
mentionsNoPRs mentioning this user
mergedNoFilter by merged state
merged-atNoFilter by merged date (e.g., >2020-01-01)
milestoneNoMilestone title
no-assigneeNoFilter by missing assignee
no-labelNoFilter by missing label
no-milestoneNoFilter by missing milestone
no-projectNoFilter by missing project
orderNoOrder of results (requires --sort)desc
ownerNoRepository owner (use with repo param)
projectNoProject board owner/number
queryYesSearch query for PR content (keep minimal for broader results)
reactionsNoFilter by number of reactions
repoNoRepository name (use with owner param)
reviewNoFilter by review status
review-requestedNoUser/team requested for review
reviewed-byNoUser who reviewed the PR
sortNoSort fetched results
stateNoFilter by state: open or closed
team-mentionsNoFilter by team mentions
updatedNoFilter by updated date (e.g., >2020-01-01)
visibilityNoRepository visibility

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "app": { "description": "Filter by GitHub App author", "type": "string" }, "archived": { "description": "Filter by repository archived state", "type": "boolean" }, "assignee": { "description": "GitHub username of assignee", "type": "string" }, "author": { "description": "GitHub username of PR author", "type": "string" }, "base": { "description": "Filter on base branch name", "type": "string" }, "checks": { "description": "Filter by checks status", "enum": [ "pending", "success", "failure" ], "type": "string" }, "closed": { "description": "Filter by closed date (e.g., >2020-01-01)", "type": "string" }, "commenter": { "description": "User who commented on PR", "type": "string" }, "comments": { "default": false, "description": "Include comment content in search results. This is a very expensive operation in tokens and should be used with caution.", "type": "boolean" }, "created": { "description": "Filter by created date (e.g., >2020-01-01)", "type": "string" }, "draft": { "description": "Filter by draft state", "type": "boolean" }, "getCommitData": { "default": false, "description": "Set to true to fetch all commits in the PR with their changes. Shows commit messages, authors, and file changes. WARNING: EXTREMELY expensive in tokens - fetches diff/patch content for each commit.", "type": "boolean" }, "head": { "description": "Filter on head branch name", "type": "string" }, "interactions": { "description": "Total interactions (reactions + comments)", "type": "number" }, "involves": { "description": "User involved in any way", "type": "string" }, "label": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "description": "Filter by label" }, "language": { "description": "Repository language", "type": "string" }, "limit": { "default": 30, "description": "Maximum number of results to fetch", "maximum": 100, "minimum": 1, "type": "integer" }, "locked": { "description": "Filter by locked conversation status", "type": "boolean" }, "match": { "description": "Restrict search to specific fields", "items": { "enum": [ "title", "body", "comments" ], "type": "string" }, "type": "array" }, "mentions": { "description": "PRs mentioning this user", "type": "string" }, "merged": { "description": "Filter by merged state", "type": "boolean" }, "merged-at": { "description": "Filter by merged date (e.g., >2020-01-01)", "type": "string" }, "milestone": { "description": "Milestone title", "type": "string" }, "no-assignee": { "description": "Filter by missing assignee", "type": "boolean" }, "no-label": { "description": "Filter by missing label", "type": "boolean" }, "no-milestone": { "description": "Filter by missing milestone", "type": "boolean" }, "no-project": { "description": "Filter by missing project", "type": "boolean" }, "order": { "default": "desc", "description": "Order of results (requires --sort)", "enum": [ "asc", "desc" ], "type": "string" }, "owner": { "description": "Repository owner (use with repo param)", "type": "string" }, "project": { "description": "Project board owner/number", "type": "string" }, "query": { "description": "Search query for PR content (keep minimal for broader results)", "minLength": 1, "type": "string" }, "reactions": { "description": "Filter by number of reactions", "type": "number" }, "repo": { "description": "Repository name (use with owner param)", "type": "string" }, "review": { "description": "Filter by review status", "enum": [ "none", "required", "approved", "changes_requested" ], "type": "string" }, "review-requested": { "description": "User/team requested for review", "type": "string" }, "reviewed-by": { "description": "User who reviewed the PR", "type": "string" }, "sort": { "description": "Sort fetched results", "enum": [ "comments", "reactions", "reactions-+1", "reactions--1", "reactions-smile", "reactions-thinking_face", "reactions-heart", "reactions-tada", "interactions", "created", "updated" ], "type": "string" }, "state": { "description": "Filter by state: open or closed", "enum": [ "open", "closed" ], "type": "string" }, "team-mentions": { "description": "Filter by team mentions", "type": "string" }, "updated": { "description": "Filter by updated date (e.g., >2020-01-01)", "type": "string" }, "visibility": { "description": "Repository visibility", "enum": [ "public", "private", "internal" ], "type": "string" } }, "required": [ "query" ], "type": "object" }
Install Server

Other Tools from Octocode MCP

Related Tools

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/bgauryy/octocode-mcp'

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