feat(mcp): add update_view tool for editing existing diagrams#52
Open
breadoncee wants to merge 2 commits intoexcalidraw:mainfrom
Open
feat(mcp): add update_view tool for editing existing diagrams#52breadoncee wants to merge 2 commits intoexcalidraw:mainfrom
breadoncee wants to merge 2 commits intoexcalidraw:mainfrom
Conversation
…draw#29) Adds a new `update_view` tool that takes a `checkpointId` and `elements`, allowing the model to edit a previously created diagram without recreating it from scratch. The server loads the base state from the checkpoint, applies deletes, merges new elements, and saves a new checkpoint. The widget now also handles the top-level `checkpointId` field during streaming so the base diagram is visible while new elements stream in.
- Fix byte size check: use Buffer.byteLength instead of string length (multi-byte chars could bypass limit) — fixed in both create_view and update_view - Add Array.isArray validation after JSON.parse in both tools - Dedup elements by ID: new elements with same ID as base automatically override the base version (no delete+add needed) - Document override semantics and containerId cascade delete in cheat sheet - Add sync comments linking widget-side and server-side merge logic
|
@breadoncee is attempting to deploy a commit to the Excalidraw Team on Vercel. A member of the Team first needs to authorize it. |
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.
updae_view_excalidraw.mp4
Summary
update_viewtool that edits existing diagrams by applying changes on top of a saved checkpoint, so the model only needs to send new/changed elements instead of the full diagramcheckpointIdfrom tool input and restores base state during both streaming and final rendercreate_view(Buffer.byteLengthfor size check, array type guard) and updated cheat sheet to documentupdate_view, container cascade deletes, and editing workflowTest plan
create_view, note the returnedcheckpointIdupdate_viewwith thatcheckpointIdto add new elements — verify base elements persistidbut different properties{"type":"delete","ids":"..."}and verify container cascade removes bound textcheckpointIdis returned afterupdate_viewfor chaining editscheckpointId, invalid JSON, non-array inputCloses #29