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()

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