Title: fix(repos): allow explicitly empty file content by Elon-Jiang · Pull Request #3884 · github/github-mcp-server · GitHub
Open Graph Title: fix(repos): allow explicitly empty file content by Elon-Jiang · Pull Request #3884 · github/github-mcp-server
X Title: fix(repos): allow explicitly empty file content by Elon-Jiang · Pull Request #3884 · github/github-mcp-server
Description: Summary Allow create_or_update_file to create empty files and intentionally clear existing files when content: "" is explicitly supplied. Why Fixes #3883. Agents cannot currently create empty package markers (__init__.py, .gitkeep) or clear a file: an empty string is treated as a missing parameter before any request reaches GitHub. The Contents API accepts base64 file content, and the tool schema does not impose a minimum length. What changed When the decoded content is empty, distinguish an explicitly supplied string from absent/null content. Keep the existing exported Go input type and public JSON schema. Exercise empty-file creation, clearing an existing ordinary file, and absent/null content through the public tool handler and real go-github request serialization. Existing nonempty create/update, stale SHA and symlink protection cases remain in the same test table. Document intentionally empty writes in the bundled repository-content-changes skill. MCP impact Tool schema or behavior changed: explicit empty strings now reach the Contents API. Missing/null values still fail; SHA and symlink validation are unchanged. No schema or tool renaming. Prompts tested (tool changes only) The tests invoke tool arguments directly; no LLM prompt execution is claimed. The corresponding use cases are “create an empty package marker on this branch” and “clear this ordinary file using its current blob SHA.” The HTTP transport substitutes GitHub's service; the public tool handler, validation and REST serialization run normally. No live account file write was used in testing. Security / limits Auth / permissions considered: existing permissions, SHA and symlink guards remain in place. Missing content cannot silently erase a file. Tool renaming I am not renaming tools as part of this PR. Lint & tests ./script/lint (Go 1.27.4, pinned golangci-lint 2.14.0): passed. ./script/test (go test -race ./...): passed. UPDATE_TOOLSNAPS=true go test ./...: passed; no snapshot changes. Baseline: the two empty-write cases fail; 15 existing controls pass. After the fix, all 19 cases pass, including the two new absent/null controls. After the maintainer merged main into this branch (f650c53), I reviewed the update and reran all 19 handler cases, lint, the full race-enabled suite, and documentation generation on Go 1.27.4. The three fix files are unchanged by that main merge; the generated documentation leaves the checkout clean. Docs Updated the bundled skill. ./script/generate-docs passed without README changes. Skills Updated the repository-content-changes skill; catalog coverage is exercised by the full suite. Prepared with AI assistance. No claim of independent human review is made.
Open Graph Description: Summary Allow create_or_update_file to create empty files and intentionally clear existing files when content: "" is explicitly supplied. Why Fixes #3883. Agents cannot currently create e...
X Description: Summary Allow create_or_update_file to create empty files and intentionally clear existing files when content: "" is explicitly supplied. Why Fixes #3883. Agents cannot currently ...
Opengraph URL: https://github.com/github/github-mcp-server/pull/3884
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
| 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 | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8d019a0d-10b6-957b-b8f6-bc152cdf0ddf |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9704:1649B1:2FE53E:3F38C3:6B06172F |
| html-safe-nonce | c61ff8453846b1c59d7f6a374cfb24522d8bd87a3082fd84636492a66378eb53 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzA0OjE2NDlCMToyRkU1M0U6M0YzOEMzOjZCMDYxNzJGIiwidmlzaXRvcl9pZCI6IjgzNTQ1NjUwMzg3NDA0Nzc3NDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b14d21eb166048afd188dd53171b2df19b8872c05895de39012d8d011d08a6ec |
| hovercard-subject-tag | pull_request:5373523896 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/github/github-mcp-server/pull/3884/files |
| twitter:image | https://avatars.githubusercontent.com/u/191222665?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/191222665?s=400&v=4 |
| og:image:alt | Summary Allow create_or_update_file to create empty files and intentionally clear existing files when content: "" is explicitly supplied. Why Fixes #3883. Agents cannot currently create e... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width