feat: add since and until date filters to list_commits #1928
+32
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When using the GitHub MCP server with Claude to analyze commit history—for example, to calculate working hours or review activity within a specific time period—the
list_commitstool currently returns all commits without any date filtering. This forces the assistant to load and process unnecessary historical data, consuming valuable context window space and reducing efficiency.This PR adds two optional parameters to the
list_commitstool:since- Only return commits after this date (ISO 8601 format)until- Only return commits before this date (ISO 8601 format)These parameters map directly to the GitHub Commits API query parameters that were previously unused.
Example Usage
{ "owner": "github", "repo": "github-mcp-server", "since": "2025-01-01T00:00:00Z", "until": "2025-01-31T23:59:59Z" }Changes
timeimport topkg/github/repositories.gosinceanduntilschema properties with ISO 8601 format descriptiongithub.CommitsListOptionsNote
I'm not experienced with Go, but I thought this feature would be useful and wanted to contribute. This implementation was created with assistance from Claude.
🤖 Generated with Claude Code