Title: Tool `get_file_contents` is missing the required `sha` in its response · Issue #595 · github/github-mcp-server · GitHub
Open Graph Title: Tool `get_file_contents` is missing the required `sha` in its response · Issue #595 · github/github-mcp-server
X Title: Tool `get_file_contents` is missing the required `sha` in its response · Issue #595 · github/github-mcp-server
Description: The get_file_contents tool does not return the SHA hash of the file, which is essential for updating files using create_or_update_file. Description When calling the github.get_file_contents tool, the response object does not include the ...
Open Graph Description: The get_file_contents tool does not return the SHA hash of the file, which is essential for updating files using create_or_update_file. Description When calling the github.get_file_contents tool, t...
X Description: The get_file_contents tool does not return the SHA hash of the file, which is essential for updating files using create_or_update_file. Description When calling the github.get_file_contents tool, t...
Opengraph URL: https://github.com/github/github-mcp-server/issues/595
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tool `get_file_contents` is missing the required `sha` in its response","articleBody":"The `get_file_contents` tool does not return the SHA hash of the file, which is essential for updating files using `create_or_update_file`.\n\n### Description\nWhen calling the `github.get_file_contents` tool, the response object does not include the `sha` field for the requested file. The official GitHub REST API documentation for the `GET /repos/{owner}/{repo}/contents/{path}` endpoint confirms that the `sha` is expected in the response.\n\nThis omission prevents the direct use of the `github.create_or_update_file` tool, as it requires the blob's SHA for any update operation.\n\n### Expected Behavior\nThe response from `get_file_contents` should include the file's SHA hash, consistent with the GitHub API.\n\n```json\n{\n \"type\": \"file\",\n \"encoding\": \"base64\",\n \"size\": 5362,\n \"name\": \"file.txt\",\n \"path\": \"path/to/file.txt\",\n \"content\": \"...\",\n \"sha\": \"b23e37d327d520337de2f7a1a4a4b49435b37699\" \n}\n```\n\n### Current Behavior\nThe `sha` field is missing from the tool's response.\n\n### Workaround\nA functional workaround has been identified:\n1. Delete the target file using `github.delete_file` (which does not require a SHA).\n2. Recreate the file at the same path using `github.create_or_update_file` with the updated content. This is treated as a new file creation, thus not requiring a SHA.\n\nWhile effective, this workaround is suboptimal.\n\n### Suspected Cause\nThe server-side implementation of the `get_file_contents` tool likely fails to parse or include the `sha` field from the GitHub API response before sending it to the client agent.","author":{"url":"https://github.com/yonaka15","@type":"Person","name":"yonaka15"},"datePublished":"2025-06-26T20:49:48Z","url":"https://github.com/github/github-mcp-server/issues/595"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e2076ad8-56c6-2269-bb59-7b50ce2c8515 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D82:1577AD:C7EA80:1143387:6B06A275 |
| html-safe-nonce | ea31c127ea86a3cb09434036c01821fc0d2f6ea8f2f93725c7477ebfee6267b6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDgyOjE1NzdBRDpDN0VBODA6MTE0MzM4Nzo2QjA2QTI3NSIsInZpc2l0b3JfaWQiOiIyMzM4MTk5ODA4NTU4NjcwNDUzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b1de50801397b10fd114b1ead800186b9a1a1236cf6dbca658d1cb9568afe3a4 |
| hovercard-subject-tag | issue:3180394682 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/github-mcp-server/595/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e9ed7b5e4747ade7df9fa1e68f50394dcaef97d27dbbf9bdd5066968c1a287d6/github/github-mcp-server/issues/595 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e9ed7b5e4747ade7df9fa1e68f50394dcaef97d27dbbf9bdd5066968c1a287d6/github/github-mcp-server/issues/595 |
| og:image:alt | The get_file_contents tool does not return the SHA hash of the file, which is essential for updating files using create_or_update_file. Description When calling the github.get_file_contents tool, t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yonaka15 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4462ff7ebfd3d551f202659f2423dae617b6849d23b1df6465dc504ef497d14a |
| turbo-cache-control | no-preview |
| go-import | github.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 942771284 |
| octolytics-dimension-repository_nwo | github/github-mcp-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 942771284 |
| octolytics-dimension-repository_network_root_nwo | github/github-mcp-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6d3909414814ff86ce7da4c51a0f4918a13fb41b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width