Skip to main content
Glama

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
NameRequiredDescriptionDefault
block_idYes

Implementation Reference

  • 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
  • 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",
    ] 
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and excels. It discloses critical behavioral traits: the operation is permanent ('Cannot be undone'), destructive ('Permanently removes'), and cascading ('and all its children'). This goes well beyond what a basic 'remove' verb would imply, providing essential safety context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly structured and front-loaded: purpose statement first, critical warning second, then parameter and return documentation. Every sentence earns its place - the warning is essential safety information, and the Args/Returns sections provide necessary documentation without fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive mutation tool with no annotations and no output schema, the description does an excellent job covering safety implications and parameter meaning. The main gap is the vague return description ('Result of the removal operation') - more specificity about success/failure indicators would have made this a 5, but overall it's highly complete given the context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage (the schema only shows block_id as a string with no description), the description compensates by explaining what block_id represents ('The ID of the block to remove'). This adds meaningful context beyond the bare schema. It doesn't provide format examples or validation rules, so it's not a perfect 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Removes') and target resource ('a block from the Logseq graph'), distinguishing it from siblings like delete_page (which removes pages) and update_block (which modifies blocks). The verb+resource combination is precise and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool (to permanently remove blocks) through the warning about permanent deletion. However, it doesn't explicitly mention when NOT to use it or name specific alternatives like delete_page for removing pages instead of blocks, which would have earned a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/apw124/logseq-mcp'

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