Skip to main content
Glama
mikeysrecipes

Logseq MCP Tools

get_block

Retrieve a specific block from your Logseq graph using its unique ID to access content, hierarchical structure, and journal information.

Instructions

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

The returned block contains information about its hierarchical structure:
  - parent: The parent block's ID
  - level: The indentation level (1 for top-level, 2+ for indented blocks)
  - left: The block to the left (typically the parent for indented blocks)

If the block is from a journal page, it will include:
  - "journal?": true
  - "journalDay": YYYYMMDD - Date in numeric format

Args:
    block_id (str): The ID of the block to retrieve.
    
Returns:
    dict: Information about the requested block.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_idYes

Implementation Reference

  • The MCP tool handler for 'get_block', decorated with @mcp.tool(). It defines the input schema via type hints and docstring, and delegates to the LogseqAPIClient.get_block() method.
    @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 information about its hierarchical structure:
          - parent: The parent block's ID
          - level: The indentation level (1 for top-level, 2+ for indented blocks)
          - left: The block to the left (typically the parent for indented blocks)
        
        If the block is from a journal page, it will include:
          - "journal?": true
          - "journalDay": YYYYMMDD - Date in numeric format
        
        Args:
            block_id (str): The ID of the block to retrieve.
            
        Returns:
            dict: Information about the requested block.
        """
        """Fetch a specific block by ID."""
        return logseq_client.get_block(block_id)
  • Helper method in LogseqAPIClient that calls the Logseq API 'logseq.Editor.getBlock' to fetch the block data.
    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
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it describes the hierarchical structure information returned (parent, level, left), journal-specific fields, and the return format (dict). However, it doesn't mention error handling, permissions, or rate limits.

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 appropriately sized and front-loaded: the first sentence states the core purpose, followed by structured details about returned information, journal specifics, and parameter/return documentation. Every sentence adds value with zero waste.

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?

Given 1 parameter with no schema descriptions, no annotations, and no output schema, the description does an excellent job covering purpose, behavior, and parameters. However, it doesn't fully address potential edge cases or error scenarios, leaving minor gaps in completeness.

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

Parameters5/5

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

With 0% schema description coverage for the single parameter, the description fully compensates by clearly explaining 'block_id (str): The ID of the block to retrieve.' This adds essential meaning beyond the bare schema, specifying the parameter's purpose and type.

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. The verb 'gets' is precise and the scope is well-defined.

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 implies usage context by specifying retrieval by block ID, but doesn't explicitly state when to use this versus alternatives like get_page_blocks (which retrieves multiple blocks) or search_blocks (which finds blocks by content). It provides clear context but lacks explicit exclusions or named alternatives.

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