Skip to main content
Glama
dailydaniel

Logseq MCP Server

logseq_get_page

Retrieve metadata and content of a specific Logseq page by its identifier, with optional inclusion of child blocks, enabling detailed knowledge graph interaction.

Instructions

Retrieve detailed information about a specific page including metadata and content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_childrenNoInclude child blocks in response
src_pageYesPage identifier (name, UUID or database ID)

Implementation Reference

  • Handler implementation for the logseq_get_page tool: validates input with GetPageParams, calls Logseq API 'logseq.Editor.getPage' with src_page and includeChildren option, formats and returns the page result.
    elif name == "logseq_get_page":
        args = GetPageParams(**arguments)
        result = make_request(
            "logseq.Editor.getPage",
            [
                args.src_page,
                {"includeChildren": args.include_children}
            ]
        )
        return [TextContent(
            type="text",
            text=format_page_result(result)
        )]
  • Pydantic schema/model for logseq_get_page tool inputs: src_page (page identifier as str or int), include_children (optional bool).
    class GetPageParams(LogseqBaseModel):
        """Parameters for retrieving a specific page"""
        src_page: Annotated[
            str | int,
            Field(
                description="Page identifier (name, UUID or database ID)",
                examples=["[[Journal/2024-03-15]]", 12345]
            )
        ]
        include_children: Annotated[
            Optional[bool],
            Field(
                default=False,
                description="Include child blocks in response"
            )
        ]
  • Tool registration in MCP server's list_tools(): defines name, description, and input schema for logseq_get_page.
    Tool(
        name="logseq_get_page",
        description="Retrieve detailed information about a specific page including metadata and content",
        inputSchema=GetPageParams.model_json_schema(),
    ),
  • Prompt registration in MCP server's list_prompts(): defines prompt for logseq_get_page with src_page argument.
    Prompt(
        name="logseq_get_page",
        description="Retrieve information about a specific page",
        arguments=[
            PromptArgument(
                name="src_page",
                description="Page name, UUID or database ID",
                required=True
            )
        ]
    ),
  • Helper function to format the page result from API into readable text output, used by logseq_get_page handler.
    def format_page_result(result: dict) -> str:
        """Format page creation result into readable text."""
        properties = "".join(
            f"  {key}: {value}\n" for key, value in result.get('propertiesTextValues', {}).items()
        )
        properties_text = "\n" + properties if properties else " None"
    
        return (
            f"Created page: {result.get('name')}\n"
            f"UUID: {result.get('uuid')}\n"
            f"Journal: {result.get('journal', False)}\n"
            f"Properties: {properties_text}"
        )

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