Repository navigation
Keep the preview flag out of the MCP tools - #5
Merged
Merged
Conversation
`capturePreview` was added to `UpdateDocumentSchema`, and the MCP `update_document` tool takes that object as its input schema directly — so an agent is now asked to fill in a flag that exists to pace a browser against a stream of keystrokes. An agent writes a document at a time and has no such problem; the field is a question with no meaning on that surface. It moves to `UpdateDocumentRequestSchema`, which only the HTTP route parses. The content schema goes back to being the content, and the tool's inputs are `id`, `html` and `css` again — asserted now, since this reached the MCP surface by being added somewhere that looked unrelated to it. Main's `cloudflare:workers` stub makes the route handlers reachable from a unit test, so both halves of the preview split are covered too: what the new POST renders and for whom, and that a save captures unless it is asked not to. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MTqa7LTmuJMFEmNohAka5n
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
htmlcsspdf | e54ce78 | Commit Preview URL Branch Preview URL |
Aug 31 2026, 09:06 PM |
afternoon
marked this pull request as ready for review
August 31, 2026 21:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the auto-save work in #3, which landed alongside the MCP surface from #2.
The problem the merge created
Auto-save added
capturePreviewtoUpdateDocumentSchema. The MCPupdate_documenttool takes that same object as its input schema:Neither branch conflicted with the other, so on
mainan agent is now asked to fill in a flag that exists to pace a browser against a stream of keystrokes. An agent writes a document at a time — it has no pacing problem, and the field is a question with no meaning on that surface.The fix
capturePreviewmoves toUpdateDocumentRequestSchema, which only the HTTP route parses. The content schema goes back to being the content, and the tool's inputs areid,html,cssagain. No behaviour changes for either caller.Tests
src/server/mcpServer.test.tsnow asserts the fieldsupdate_documentasks for. Verified it fails onmain's schema (expected [ 'capturePreview', 'css', …(2) ] to deeply equal [ 'css', 'html', 'id' ]) and passes with the split — this reached the MCP surface by being added somewhere that looked unrelated to it, so the assertion is the guard against it happening again.cloudflare:workersstub makes route handlers reachable from a unit test for the first time, so both halves of the preview split are now covered against the real queries and the real migrations:POST /api/documents/:id/thumbnail(renders the stored content, 204 when the revision already has a capture, 404 — and no capture queued — for someone else's document) andPUT(captures by default, quiet only when asked).bun run test(431 unit + 12 e2e),bun run checkandbun run buildall clean.Generated by Claude Code