remove_block
Permanently delete a block and its child blocks from the Logseq graph. Specify the block ID to complete the operation, which cannot be undone. Ideal for managing and organizing your knowledge base.
Instructions
Removes a block from the Logseq graph.
⚠️ Permanently removes the block and all its children. Cannot be undone.
Args:
block_id: The ID of the block to remove.
Returns:
Result of the removal operation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block_id | Yes |
Implementation Reference
- src/logseq_mcp/tools/blocks.py:119-132 (handler)MCP tool handler for 'remove_block'. Defines the tool with @mcp.tool() decorator, includes schema via type hints and docstring, and delegates to LogseqAPIClient.remove_block().@mcp.tool() def remove_block(block_id: str) -> Dict: """ Removes a block from the Logseq graph. ⚠️ Permanently removes the block and all its children. Cannot be undone. Args: block_id: The ID of the block to remove. Returns: Result of the removal operation. """ return logseq_client.remove_block(block_id)
- Core helper method in LogseqAPIClient that implements the block removal by calling the Logseq API endpoint 'logseq.Editor.removeBlock'.def remove_block(self, block_id: str) -> Dict: """Remove a block and its children from the graph""" response = self.call_api("logseq.Editor.removeBlock", [block_id]) if isinstance(response, dict) and "result" in response: return response.get("result") return response
- src/logseq_mcp/tools/__init__.py:1-18 (registration)Re-exports the remove_block tool from blocks.py, likely facilitating its registration when tools module is imported by the MCP server.from .pages import get_all_pages, get_page, create_page, delete_page, get_page_linked_references from .blocks import get_page_blocks, get_block, create_block, update_block, remove_block, insert_block, move_block, search_blocks __all__ = [ "get_all_pages", "get_page", "create_page", "delete_page", "get_page_blocks", "get_block", "create_block", "update_block", "remove_block", "insert_block", "move_block", "search_blocks", "get_page_linked_references", ]