Skip to content

Conversation

@voki-gandzhelashvili-t
Copy link

@voki-gandzhelashvili-t voki-gandzhelashvili-t commented Jan 29, 2026

Summary

This PR adds a new optional parameter include_patch to the get_commit tool, allowing users to optionally include the patch/diff content for each file in the response.

Key Design Decision: Opt-in Behavior

The patch content is not included by default (include_patch: false). This is intentional:

  • Non-breaking change: Existing integrations continue to work unchanged
  • Performance conscious: Patch content can be large and may not always be needed
  • Explicit control: Users opt-in when they need the actual diff content

Changes

  1. Added Patch string field to MinimalCommitFile struct
  2. Added include_patch boolean parameter to get_commit tool (default: false)
  3. Updated convertToMinimalCommit function to conditionally include patch content

Usage

// Get commit without patch (default behavior, unchanged)
get_commit(owner: "foo", repo: "bar", sha: "abc123")

// Get commit with patch content
get_commit(owner: "foo", repo: "bar", sha: "abc123", include_patch: true)

Example Response with include_patch: true

{
  "sha": "abc123...",
  "files": [{
    "filename": "src/example.go",
    "status": "modified",
    "additions": 5,
    "deletions": 2,
    "changes": 7,
    "patch": "@@ -10,6 +10,9 @@\n func example() {\n+    // new code\n+    return true\n }"
  }]
}

Use Cases

  • Code review automation tools
  • AI agents analyzing code changes
  • Commit analysis and auditing tools
  • Any consumer that needs to see what actually changed in a commit

Test Plan

  • Code compiles successfully
  • Existing tests pass
  • Manual testing confirms:
    • Default behavior unchanged (no patch in response)
    • `include_patch: true` includes patch content

@voki-gandzhelashvili-t voki-gandzhelashvili-t requested a review from a team as a code owner January 29, 2026 09:29
Add a new optional parameter `include_patch` (default: false) to the
get_commit tool that controls whether the patch/diff content is included
for each file in the response.

This is a non-breaking change:
- Existing behavior is preserved (patch not included by default)
- Users can opt-in by setting include_patch: true
- Only applies when include_diff is also true

Changes:
- Added `Patch` field to MinimalCommitFile struct
- Added `include_patch` parameter to get_commit tool schema
- Updated convertToMinimalCommit to accept includePatch parameter
- Patch content is only included when explicitly requested

Use case: AI agents and code review tools that need to analyze
actual code changes without additional API calls.
@voki-gandzhelashvili-t voki-gandzhelashvili-t force-pushed the feature/add-patch-to-commit-files branch from df0c3db to 5d9c352 Compare January 29, 2026 09:35
@voki-gandzhelashvili-t voki-gandzhelashvili-t changed the title feat: add patch field to MinimalCommitFile feat: add include_patch parameter to get_commit tool Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant