Skip to main content
Glama

remove_block

Permanently delete a block and its child blocks from your Logseq knowledge graph using the block ID. This action cannot be undone.

Instructions

Removes a block from the Logseq graph. This operation permanently removes the specified block and all its children. This action cannot be undone. To remove a block, you need its block ID, which can be obtained from: - get_page_blocks() function - get_block() function - search_blocks() function Args: block_id (str): The ID of the block to remove. Returns: dict: Result of the removal operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_idYes

Implementation Reference

  • The MCP tool handler for 'remove_block', decorated with @mcp.tool(). It invokes the LogseqAPIClient's remove_block method.
    @mcp.tool() def remove_block(block_id: str) -> Dict: """ Removes a block from the Logseq graph. This operation permanently removes the specified block and all its children. This action cannot be undone. To remove a block, you need its block ID, which can be obtained from: - get_page_blocks() function - get_block() function - search_blocks() function Args: block_id (str): The ID of the block to remove. Returns: dict: Result of the removal operation. """ """Remove a block and its children from the graph.""" return logseq_client.remove_block(block_id)
  • Helper method in LogseqAPIClient that performs the actual API call to logseq.Editor.removeBlock to remove the block.
    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
  • Imports from tools module which triggers loading of blocks.py (containing remove_block) via tools/__init__.py, implicitly registering the @mcp.tool() decorated functions including remove_block.
    from .mcp import mcp from .utils.logging import log from .tools import ( get_all_pages, get_page, create_page, get_page_blocks, get_block, create_block, update_block, search_blocks, get_page_linked_references, ) import os import inspect __all__ = ["get_all_pages", "get_page", "create_page", "get_page_blocks", "get_block", "create_block", "update_block", "search_blocks", "get_page_linked_references"]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mikeysrecipes/logseq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server