Skip to content

Comments

Add delete_block tool to remove blocks by UUID#15

Merged
ergut merged 1 commit intoergut:mainfrom
arndjan:feature/delete-block
Feb 23, 2026
Merged

Add delete_block tool to remove blocks by UUID#15
ergut merged 1 commit intoergut:mainfrom
arndjan:feature/delete-block

Conversation

@arndjan
Copy link
Contributor

@arndjan arndjan commented Feb 4, 2026

Summary

Adds support for deleting blocks via the logseq.Editor.removeBlock API method.

Changes

  • Added delete_block(block_uuid) method to LogSeq class in logseq.py
  • Added DeleteBlockToolHandler class in tools.py
  • Registered the new tool handler in server.py

Usage

# MCP tool call
{
  "name": "delete_block",
  "arguments": {
    "block_uuid": "6983204d-ef32-4fbf-b19c-02181f16b28e"
  }
}

Motivation

Currently the MCP server supports creating and editing blocks, but not deleting them. This makes it impossible to clean up test blocks or remove unwanted content programmatically.

The underlying Logseq API already supports this via logseq.Editor.removeBlock, so this PR simply exposes that functionality.

Closes #14

🤖 Generated with Claude Code

Adds logseq.Editor.removeBlock API support:
- New delete_block method in LogSeq class
- New DeleteBlockToolHandler for MCP tool interface
- Registered in server.py

Closes ergut#14
@ergut ergut merged commit 1948397 into ergut:main Feb 23, 2026
@ergut
Copy link
Owner

ergut commented Feb 23, 2026

Thanks @arndjan for this contribution! delete_block allows cleaning up blocks programmatically alongside the existing create/edit tools.

We made a small follow-up commit after merging to align the response messages with the conventions used in other handlers (emoji prefixes, ValueError catch branch). Nothing substantial, just keeping things consistent.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Add delete_block / remove_block tool

2 participants