Skip to main content
Glama

get_page_blocks

Retrieve structured blocks from a specific Logseq page, including hierarchical details like parent ID, indentation level, and left block relationships, using the page name as input.

Instructions

Gets all blocks from a specific page in the Logseq graph.

For journal pages, use the format "mmm dth, yyyy" (e.g., "Apr 4th, 2025").
Returned blocks contain hierarchical structure information:
  - parent: The parent block's ID
  - level: The indentation level (1 for top-level, 2+ for indented)
  - left: The block to the left (typically the parent for indented blocks)

Args:
    page_name: The name of the page to retrieve blocks from.
    
Returns:
    List of blocks from the specified page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_nameYes

Implementation Reference

  • The MCP tool handler for 'get_page_blocks', decorated with @mcp.tool(). Includes type hints and docstring serving as input/output schema. Delegates to LogseqAPIClient.get_page_blocks().
    def get_page_blocks(page_name: str) -> List[Dict]:
        """
        Gets all blocks from a specific page in the Logseq graph.
        
        For journal pages, use the format "mmm dth, yyyy" (e.g., "Apr 4th, 2025").
        Returned blocks contain hierarchical structure information:
          - parent: The parent block's ID
          - level: The indentation level (1 for top-level, 2+ for indented)
          - left: The block to the left (typically the parent for indented blocks)
        
        Args:
            page_name: The name of the page to retrieve blocks from.
            
        Returns:
            List of blocks from the specified page.
        """
        return logseq_client.get_page_blocks(page_name)
  • Helper method in LogseqAPIClient that performs the actual API call to retrieve page blocks from Logseq using 'logseq.Editor.getPageBlocksTree'.
    def get_page_blocks(self, page_name: str) -> List[Dict]:
        """Get all blocks for a page"""
        response = self.call_api("logseq.Editor.getPageBlocksTree", [page_name])
        if isinstance(response, list):
            return response
        return response.get("result", []) if isinstance(response, dict) else []
  • Import of the get_page_blocks tool function from blocks.py, exposing it for use in the tools module.
    from .blocks import get_page_blocks, get_block, create_block, update_block, remove_block, insert_block, move_block, search_blocks
  • Inclusion of get_page_blocks in the main module imports and __all__, ensuring it's registered when the server runs.
    get_page_blocks,
Behavior4/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 adds valuable context beyond the basic purpose: it specifies the hierarchical structure information returned (parent, level, left), which helps the agent understand the output format. However, it doesn't mention potential errors (e.g., if the page doesn't exist), rate limits, or authentication needs, leaving some gaps. This earns a 4 for adding significant behavioral details but not being exhaustive.

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 well-structured: it starts with the core purpose, provides usage guidelines, details the return structure, and lists parameters clearly with 'Args' and 'Returns' sections. Every sentence adds value without redundancy, making it easy to scan and understand quickly.

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 the tool's moderate complexity (retrieving structured data), no annotations, no output schema, and low schema coverage, the description does a good job of being complete. It explains the purpose, parameter usage, and return format in detail. However, it lacks information on error handling or performance aspects (e.g., pagination for large pages), which prevents a perfect score. Overall, it's largely sufficient for an agent to use the tool effectively.

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 description coverage is 0%, so the description must compensate. It adds meaning beyond the input schema by explaining the 'page_name' parameter: 'The name of the page to retrieve blocks from.' and provides a specific format example for journal pages. This clarifies the parameter's purpose and usage, effectively compensating for the lack of schema descriptions. However, it doesn't cover edge cases 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.

Purpose4/5

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

The description clearly states the tool's purpose: 'Gets all blocks from a specific page in the Logseq graph.' It specifies the verb ('Gets'), resource ('blocks'), and scope ('from a specific page'), which is specific and actionable. However, it doesn't explicitly differentiate from sibling tools like 'get_block' or 'search_blocks', which limits the score to 4 instead of 5.

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 provides some usage guidance: 'For journal pages, use the format "mmm dth, yyyy" (e.g., "Apr 4th, 2025").' This implies context for when to use a specific format, but it doesn't explicitly state when to use this tool versus alternatives like 'get_block' (for single blocks) or 'search_blocks' (for filtered searches). The guidance is helpful but incomplete, warranting a score of 3.

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