Skip to main content
Glama

Octocode MCP

by bgauryy

githubSearchCommits

Search GitHub commits by message, author, hash, or date to retrieve SHAs or fetch content changes (diffs/patches). Use query-based, filter-only, or combined searches for precise results. Works for public and private repositories, with optional commit content fetching.

Instructions

Search GitHub commits by message, author, hash, or date. Returns SHAs for github_fetch_content (branch=SHA). Can fetch commit content changes (diffs/patches) when getChangesContent=true.

SEARCH OPTIONS:

  1. Query-based search:
    • exactQuery: Exact phrase matching (e.g., "bug fix")
    • queryTerms: Multiple keywords with AND logic (e.g., ["readme", "typo"])
    • orTerms: Keywords with OR logic (e.g., ["bug", "fix"] finds commits with either)
    • Combine: queryTerms=["api"] + orTerms=["auth", "login"] = api AND (auth OR login)
  2. Filter-only search (no query required):
    • Search by author, committer, hash, date, etc.
    • Example: Just committer="monalisa" to find all commits by that user
    • Example: Search by commit hash (including head_sha/base_sha from a PR): hash="<sha>"
  3. Combined search:
    • Mix queries with filters for precise results
    • Example: queryTerms=["fix"] + author="jane" + author-date=">2023-01-01"

EXAMPLES: • Search commits with "readme" AND "typo": queryTerms=["readme", "typo"] • Search exact phrase "bug fix": exactQuery="bug fix" • Search by committer only: committer="monalisa" • Search by author name: author-name="Jane Doe" • Search by commit hash (including head_sha/base_sha from a PR): hash="8dd03144ffdc6c0d486d6b705f9c7fba871ee7c3" • Search before date: author-date="<2022-02-01"

CONTENT FETCHING:

  • Set getChangesContent=true to fetch actual commit changes: • Gets file diffs and patches for up to 10 commits • Shows changed files, additions, deletions • Includes code patches (first 1000 chars) • Works for both public AND private repositories • Most effective when owner and repo are specified

TOKEN OPTIMIZATION NOTICE:

  • getChangesContent=true is EXTREMELY expensive in tokens
  • Each commit's diff/patch content consumes significant tokens
  • Limited to 1000 characters per patch and 5 files per commit for efficiency
  • Use sparingly and only when code changes are essential to your task
  • use fetch_github_file_content to get the full content of the file

Input Schema

NameRequiredDescriptionDefault
authorNoGitHub username of commit author (e.g., "octocat")
author-dateNoFilter by author date (e.g., "<2022-02-01", ">2020-01-01", "2020-01-01..2021-01-01")
author-emailNoEmail of commit author
author-nameNoFull name of commit author
committerNoGitHub username of committer (e.g., "monalisa")
committer-dateNoFilter by commit date (e.g., "<2022-02-01", ">2020-01-01", "2020-01-01..2021-01-01")
committer-emailNoEmail of committer
committer-nameNoFull name of committer
exactQueryNoExact phrase to search for in commit messages (e.g., "bug fix")
getChangesContentNoSet to true to fetch actual commit changes (diffs/patches). Works for both public and private repositories, most effective with owner and repo specified. Limited to first 10 commits for rate limiting. WARNING: EXTREMELY expensive in tokens - each commit diff can consume thousands of tokens.
hashNoCommit SHA (full or partial, including head_sha/base_sha from a PR as returned by github_search_pull_requests)
limitNoMaximum number of results to fetch
mergeNoOnly merge commits (true) or exclude them (false)
orTermsNoArray of search terms with OR logic (e.g., ["bug", "fix"] finds commits with either word)
orderNoSort orderdesc
ownerNoRepository owner (use with repo param)
parentNoParent commit SHA
queryTermsNoArray of search terms with AND logic (e.g., ["readme", "typo"] finds commits with both words)
repoNoRepository name (use with owner param)
sortNoSort by date field
treeNoTree SHA
visibilityNoRepository visibility filter

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "author": { "description": "GitHub username of commit author (e.g., \"octocat\")", "type": "string" }, "author-date": { "description": "Filter by author date (e.g., \"<2022-02-01\", \">2020-01-01\", \"2020-01-01..2021-01-01\")", "type": "string" }, "author-email": { "description": "Email of commit author", "type": "string" }, "author-name": { "description": "Full name of commit author", "type": "string" }, "committer": { "description": "GitHub username of committer (e.g., \"monalisa\")", "type": "string" }, "committer-date": { "description": "Filter by commit date (e.g., \"<2022-02-01\", \">2020-01-01\", \"2020-01-01..2021-01-01\")", "type": "string" }, "committer-email": { "description": "Email of committer", "type": "string" }, "committer-name": { "description": "Full name of committer", "type": "string" }, "exactQuery": { "description": "Exact phrase to search for in commit messages (e.g., \"bug fix\")", "type": "string" }, "getChangesContent": { "default": false, "description": "Set to true to fetch actual commit changes (diffs/patches). Works for both public and private repositories, most effective with owner and repo specified. Limited to first 10 commits for rate limiting. WARNING: EXTREMELY expensive in tokens - each commit diff can consume thousands of tokens.", "type": "boolean" }, "hash": { "description": "Commit SHA (full or partial, including head_sha/base_sha from a PR as returned by github_search_pull_requests)", "type": "string" }, "limit": { "default": 25, "description": "Maximum number of results to fetch", "maximum": 50, "minimum": 1, "type": "integer" }, "merge": { "description": "Only merge commits (true) or exclude them (false)", "type": "boolean" }, "orTerms": { "description": "Array of search terms with OR logic (e.g., [\"bug\", \"fix\"] finds commits with either word)", "items": { "type": "string" }, "type": "array" }, "order": { "default": "desc", "description": "Sort order", "enum": [ "asc", "desc" ], "type": "string" }, "owner": { "description": "Repository owner (use with repo param)", "type": "string" }, "parent": { "description": "Parent commit SHA", "type": "string" }, "queryTerms": { "description": "Array of search terms with AND logic (e.g., [\"readme\", \"typo\"] finds commits with both words)", "items": { "type": "string" }, "type": "array" }, "repo": { "description": "Repository name (use with owner param)", "type": "string" }, "sort": { "description": "Sort by date field", "enum": [ "author-date", "committer-date" ], "type": "string" }, "tree": { "description": "Tree SHA", "type": "string" }, "visibility": { "description": "Repository visibility filter", "enum": [ "public", "private", "internal" ], "type": "string" } }, "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