Skip to main content
Glama
dailydaniel

Logseq MCP Server

logseq_get_page_content

Retrieve the hierarchical block content of a specific page from your Logseq knowledge graph, using the page name or UUID for targeted access.

Instructions

Get block hierarchy for specific page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
src_pageYesPage name or UUID

Implementation Reference

  • Main handler for logseq_get_page_content tool: parses arguments, calls Logseq API 'logseq.Editor.getPageBlocksTree', formats hierarchical block structure using format_blocks_tree, and returns as TextContent.
    elif name == "logseq_get_page_content":
        args = GetPageBlocksTreeParams(**arguments)
        result = make_request(
            "logseq.Editor.getPageBlocksTree",
            [args.src_page]
        )
        return [TextContent(
            type="text",
            text=format_blocks_tree(result)
        )]
  • Pydantic model defining input schema for the tool: requires 'src_page' parameter (page name or UUID). Used for validation in handler and tool registration.
    class GetPageBlocksTreeParams(LogseqBaseModel):
        src_page: Annotated[
            str,
            Field(description="Page name or UUID", examples=["[[Journal]]", "6485a-9de3..."])
        ]
  • Tool registration in @server.list_tools(): defines name, description, and input schema linking to GetPageBlocksTreeParams.
    Tool(
        name="logseq_get_page_content",
        description="Get block hierarchy for specific page",
        inputSchema=GetPageBlocksTreeParams.model_json_schema(),
    ),
  • Helper function to format the hierarchical block tree returned from Logseq API into a readable indented text representation, used in the tool handler.
    def format_blocks_tree(blocks: list) -> str:
        """Format hierarchical block structure"""
        def print_tree(block, level=0):
            output = []
            prefix = "  " * level + "- "
            output.append(f"{prefix}{block.get('content', '')}")
            for child in block.get('children', []):
                output.extend(print_tree(child, level + 1))
            return output
    
        return "\n".join(
            line for block in blocks
            for line in print_tree(block)
        )
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool gets block hierarchy, but doesn't explain what 'block hierarchy' entails (e.g., structure, format, depth), whether it's read-only (implied by 'Get' but not explicit), or any limitations like rate limits or authentication needs. This leaves significant gaps for a tool with no annotation coverage.

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 a single, direct sentence ('Get block hierarchy for specific page') that is front-loaded and wastes no words. It efficiently conveys the core purpose without unnecessary elaboration, making it highly concise and well-structured.

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

Completeness2/5

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

Given no annotations, no output schema, and a single parameter with full schema coverage, the description is incomplete. It doesn't explain the return value (e.g., what 'block hierarchy' looks like), behavioral aspects like safety or performance, or how it differs from sibling tools. For a tool with these contextual gaps, the description should provide more comprehensive information to guide effective use.

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

Parameters3/5

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

The input schema has 100% description coverage, with 'src_page' clearly documented as 'Page name or UUID' with examples. The description adds no additional meaning beyond this, as it doesn't elaborate on parameter usage or constraints. With high schema coverage, the baseline score of 3 is appropriate since the schema handles the parameter documentation adequately.

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

Purpose3/5

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

The description 'Get block hierarchy for specific page' clearly indicates a retrieval action ('Get') on a specific resource ('block hierarchy for specific page'), which is better than a tautology. However, it doesn't differentiate from sibling tools like 'logseq_get_page' or 'logseq_get_current_page_content', leaving ambiguity about what distinguishes this tool from other page/content retrieval tools.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this tool is appropriate compared to siblings such as 'logseq_get_page' or 'logseq_get_current_page_content', nor does it specify any prerequisites or exclusions for usage.

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

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