Skip to content

feat(mcp): expose blocks.delete/deleteRange via superdoc_edit - #3587

Draft
jacobjove wants to merge 1 commit into
superdoc:v1from
jacobjove:feature/mcp-expose-blocks-delete
Draft

jacobjove wants to merge 1 commit into
superdoc:v1from
jacobjove:feature/mcp-expose-blocks-delete

Conversation

@jacobjove

@jacobjove jacobjove commented May 30, 2026

Copy link
Copy Markdown

Summary

Wires the existing document-api blocks.delete / blocks.deleteRange ops into the MCP tool surface as two new superdoc_edit actions — delete_block and delete_block_range — so an MCP client can remove an entire block node, not just its text. Closes the gap where deleting a heading/paragraph's text leaves an empty container that still renders as block spacing.

Proposed in #3586 (surface options A/B/C discussed there). This PR implements option A.

What changed

  • Contract (packages/document-api/src/contract/operation-definitions.ts): intentGroup:'edit' + intentAction:'delete_block' on blocks.delete; intentGroup:'edit' + intentAction:'delete_block_range' on blocks.deleteRange; one disambiguation sentence and one inputExample in INTENT_GROUP_META.edit.
  • Regenerated via pnpm run generate:all: apps/mcp/src/generated/{catalog,intent-dispatch.generated}.ts, packages/sdk/langs/browser/src/intent-dispatch.ts, packages/sdk/tools/intent_dispatch_generated.py.
  • Tests (apps/mcp/src/__tests__/protocol.test.ts): action-enum assertion plus three end-to-end cases asserting physical block removal (block-count decrement + nodeId absence) — one demonstrating the text-delete-leaves-empty-container bug vs delete_block removing it, and one asserting delete_block_range removes a contiguous top-level span (deletedCount + spanned nodeIds absent, with a neighbor outside the range surviving so the delete is proven bounded).

Addressing

delete (existing) takes a text ref; delete_block takes target:{kind:'block',nodeType,nodeId}; delete_block_range takes start/end (each a {kind:'block',nodeType,nodeId} top-level block, inclusive). The delete_block name is forced by the existing delete collision in the edit group.

Verification

apps/mcp 41 pass (4 new) · document-api 1480 pass (blocks + contract-parity) · conformance 1198 pass · codegen incl. cross-lang-parity (Node↔Python) 57 pass · typecheck 0 new errors vs baseline.

Limitations

Wire the existing document-api blocks.delete / blocks.deleteRange ops
into the MCP tool surface as superdoc_edit actions delete_block and
delete_block_range, so clients can remove an entire block node, not
just its text content. Deleting a heading/paragraph's text previously
left an empty container behind, still rendering as block spacing.

Regenerates the MCP catalog and intent-dispatch (Node, browser,
Python) and adds end-to-end protocol tests proving physical block
removal (block-count decrement + nodeId absence).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jacobjove
jacobjove force-pushed the feature/mcp-expose-blocks-delete branch from 4c75ffe to b36f627 Compare May 30, 2026 04:14
@caio-pizzol caio-pizzol self-assigned this Jul 14, 2026
@caio-pizzol

Copy link
Copy Markdown
Contributor

Thanks for the contribution, Jacob! We reproduced the block-deletion gap in the released MCP package. The newer core path handles selected paragraph deletion on main, but it hasn’t shipped, and we haven’t established equivalent range support. We’re keeping this PR open while we work through those remaining gaps.

@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


Jacob Jove seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants