You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Always include SHA in get_file_contents responses (#676)
* fix: Add SHA to get_file_contents while preserving MCP behavior (#595)
Enhance get_file_contents to include SHA information without changing
the existing MCP server response format.
Changes:
- Add Contents API call to retrieve SHA before fetching raw content
- Include SHA in resourceURI (repo://owner/repo/sha/{SHA}/contents/path)
- Add SHA to success messages
- Update tests to verify SHA inclusion
- Maintain original behavior: text files return raw text, binaries return base64
This preserves backward compatibility while providing SHA information
for better file versioning support.
Closes#595
* fix: Improve error handling for Contents API response
Ensure response body is properly closed even when an error occurs by moving
the defer statement before the error check. This prevents potential resource
leaks when the Contents API returns an error with a non-nil response.
Changes:
- Move defer respContents.Body.Close() before error checking
- Rename errContents to err for consistency
- Add nil check for respContents before attempting to close body
This follows Go best practices for handling HTTP responses and prevents
potential goroutine/memory leaks.
* revert changes to resource URI
* use GraphQL API to get file SHA
* refactor: mock GQL client instead of getFileSHA function to follow conventions
* lint
* revert GraphQL
---------
Co-authored-by: LuluBeatson <lulubeatson@github.com>
0 commit comments