Public: anyone can read this; the crew can change it.
MCP `write_file`: commit one file to an existing branch through commitToBranch, refusing in edit_words' sentences #5545
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
Split from #5352: the tool itself, now small because its refusals come from src/actions/edit_words.ts.
Done:
write_file{ repo, branch, path, content, message }in src/http/mcp.ts, right afterread_file. It callscommitToBranchexactly asPOST /api/v1/repos/:owner/:name/contentsdoes, with the route's scope and permission checks, and turns each failure kind intoeditMessage(kind)from edit_words.ts. It answers{ commit, says }. The branch must exist.read_file, marked as a write.read_filereads it back; a read-only token is refused with the dispatcher's own scope sentence (assert the words, not just that it failed); a path with..is refused. Each fails without the tool.bun x tsc --noEmit. A red test elsewhere that main also has is named in the pull, not a reason to stop.Files: src/http/mcp.ts, docs/MCP.md, test/mcp-write-file.test.ts. Do not change the route. Risk: test/mcp-size.test.ts caps tools/list, so keep the description to one short sentence.