Skip to main content
Glama
mikeysrecipes

Logseq MCP Tools

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

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly states critical behavioral traits: the operation is permanent, removes children recursively, cannot be undone, and requires specific permissions/access (block ID from other functions). This goes well beyond basic parameter documentation.

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: purpose statement first, critical behavioral warnings next, usage prerequisites, then parameter and return documentation. Every sentence earns its place with essential information, and there's no redundancy or fluff.

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

Completeness5/5

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

For a destructive operation with no annotations and no output schema, the description provides excellent completeness. It covers purpose, behavioral consequences (permanent, recursive), prerequisites, parameter meaning, and return type. Given the tool's complexity and lack of structured metadata, this is comprehensive.

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?

The schema has 0% description coverage, so the description must compensate. It explains what block_id represents, how to obtain it (listing three specific functions), and its purpose in the removal operation. This adds substantial meaning beyond the bare schema, though it doesn't detail format constraints.

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 a block') and resource ('from the Logseq graph'), distinguishing it from siblings like delete_page (which removes pages) or update_block (which modifies blocks). The verb 'removes' 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 on when to use this tool by specifying prerequisites (needing a block ID) and listing three sibling tools that can provide that ID. However, it doesn't explicitly state when NOT to use it or compare it to alternatives like delete_page for page-level removal.

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

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