Skip to main content
Glama

get_block

Retrieve a specific block from a Logseq graph by its ID, including hierarchical details like parent block, indentation level, and adjacent blocks for structured data access.

Instructions

Gets a specific block from the Logseq graph by its ID.

The returned block contains hierarchical structure information:
  - parent: The parent block's ID
  - level: The indentation level
  - left: The block to the left

Args:
    block_id: The ID of the block to retrieve.
    
Returns:
    Information about the requested block, or None if not found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_idYes

Implementation Reference

  • MCP tool handler for get_block, decorated with @mcp.tool(). Delegates to LogseqAPIClient to fetch the block.
    @mcp.tool()
    def get_block(block_id: str) -> Optional[Dict]:
        """
        Gets a specific block from the Logseq graph by its ID.
        
        The returned block contains hierarchical structure information:
          - parent: The parent block's ID
          - level: The indentation level
          - left: The block to the left
        
        Args:
            block_id: The ID of the block to retrieve.
            
        Returns:
            Information about the requested block, or None if not found.
        """
        return logseq_client.get_block(block_id)
  • Implementation in LogseqAPIClient that calls the Logseq API endpoint logseq.Editor.getBlock to retrieve block data by ID.
    def get_block(self, block_id: str) -> Optional[Dict]:
        """Get a block by ID"""
        response = self.call_api("logseq.Editor.getBlock", [block_id])
        if response is None:
            return None
        return response.get("result") if isinstance(response, dict) else response
  • Package __init__ that imports and exports the get_block tool, and provides main() to run the MCP server, triggering tool registrations via decorators.
    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"]
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool returns hierarchical structure information (parent, level, left) and handles missing blocks by returning None, which adds useful behavioral context beyond just being a read operation. However, it doesn't mention error conditions, performance characteristics, or authentication needs.

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 efficiently structured with a clear purpose statement, bullet points for return details, and labeled Args/Returns sections. Every sentence adds value with no redundant information.

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 simple read operation with 1 parameter and no output schema, the description is reasonably complete: it explains what the tool does, what parameter it needs, what information it returns, and the not-found case. The main gap is lack of explicit usage guidance versus sibling tools.

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 and only 1 parameter, the description compensates well by explaining that 'block_id' is 'The ID of the block to retrieve,' providing clear semantic meaning. It doesn't specify format or constraints, but for a single parameter tool this is adequate.

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 ('Gets a specific block') and resource ('from the Logseq graph by its ID'), distinguishing it from siblings like get_page, get_page_blocks, or search_blocks which operate on different resources or with different scopes.

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

Usage Guidelines3/5

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

The description implies usage by specifying it retrieves a block by ID, but doesn't explicitly state when to use this versus alternatives like get_page_blocks (for all blocks on a page) or search_blocks (for query-based retrieval). No exclusions or prerequisites are mentioned.

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