Skip to main content
Glama

create_block

Add a new bullet point block to a Logseq page with specified content, optional properties, and internal page links.

Instructions

Creates a new block on a page in the Logseq graph.

Note: Blocks are automatically formatted as bullet points in Logseq UI.
Use [[Page Name]] to create links to other pages.

Args:
    page_name: The name of the page to create the block on.
    content: The content of the new block.
    properties: Optional properties to set on the new block.
    
Returns:
    Information about the created block.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
page_nameYes
propertiesNo

Implementation Reference

  • The MCP tool handler for 'create_block', decorated with @mcp.tool(). It validates inputs via type hints and docstring, then delegates to LogseqAPIClient.create_block.
    @mcp.tool()
    def create_block(page_name: str, content: str, properties: Optional[Dict] = None) -> Dict:
        """
        Creates a new block on a page in the Logseq graph.
        
        Note: Blocks are automatically formatted as bullet points in Logseq UI.
        Use [[Page Name]] to create links to other pages.
        
        Args:
            page_name: The name of the page to create the block on.
            content: The content of the new block.
            properties: Optional properties to set on the new block.
            
        Returns:
            Information about the created block.
        """
        return logseq_client.create_block(page_name, content, properties)
  • Core implementation in LogseqAPIClient that performs the HTTP API call to Logseq's 'logseq.Editor.appendBlockInPage' method to create the block.
    def create_block(self, page_name: str, content: str, properties: Optional[Dict] = None) -> Dict:
        """Create a new block on a page"""
        params = [page_name, content]
        if properties:
            params.append(properties)
        response = self.call_api("logseq.Editor.appendBlockInPage", params)
        if isinstance(response, dict) and "result" in response:
            return response.get("result")
        return response
  • Imports and exports 'create_block' in the package __init__.py, making it available for use in the MCP server.
    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"]
  • Initialization of the shared LogseqAPIClient instance used by all block tools, including create_block.
    logseq_client = LogseqAPIClient()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions automatic bullet formatting and link syntax, which are useful behavioral details, but fails to address critical aspects like permissions required, whether creation is idempotent, error conditions, or what 'Information about the created block' entails. For a mutation tool with zero annotation coverage, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with purpose statement, behavioral note, parameter documentation, and return indication. Each section earns its place, though the 'Returns' statement is vague. The text is appropriately sized for a 3-parameter tool without unnecessary elaboration.

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

Completeness3/5

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

Given a mutation tool with 3 parameters, no annotations, and no output schema, the description is moderately complete. It covers parameter semantics well and includes some behavioral context (formatting, linking), but lacks details about the return value, error handling, and operational constraints. The absence of output schema means the vague 'Information about the created block' leaves the agent uncertain about response structure.

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 description explicitly documents all three parameters with clear semantics: 'page_name: The name of the page to create the block on', 'content: The content of the new block', and 'properties: Optional properties to set on the new block'. With 0% schema description coverage, this fully compensates by providing meaning beyond the bare schema types. The optional nature of 'properties' is correctly indicated.

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 tool's purpose with specific verb ('creates') and resource ('new block on a page in the Logseq graph'), and distinguishes it from siblings like 'create_page' by specifying it creates blocks rather than pages. The mention of 'automatically formatted as bullet points' further clarifies the nature of the created resource.

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 implied usage guidance through the note about formatting and link syntax ('Use [[Page Name]] to create links'), but lacks explicit when-to-use guidance versus alternatives like 'insert_block' or 'update_block'. No exclusions or prerequisites are mentioned, leaving the agent to infer appropriate contexts.

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