create_block
Add a new bullet point block to any page in your Logseq graph, optionally setting properties or linking to other pages using [[Page Name]] syntax.
Instructions
Creates a new block on a page in the Logseq graph.
IMPORTANT NOTES:
1. All blocks are automatically formatted as bullet points in Logseq UI
2. To create links to other pages, use double brackets: [[Page Name]]
When creating blocks on journal pages:
- The block will inherit the "journal?" and "journalDay" attributes from the page
- "journalDay" will be in YYYYMMDD format (e.g., 20250404 for April 4, 2025)
Args:
page_name (str): The name of the page to create the block on.
content (str): The content of the new block.
properties (dict, optional): Properties to set on the new block.
Returns:
dict: Information about the created block.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| page_name | Yes | ||
| properties | No |
Implementation Reference
- src/logseq_mcp/tools/blocks.py:55-77 (handler)MCP tool handler for 'create_block'. Decorated with @mcp.tool(), defines input parameters and calls the LogseqAPIClient's create_block method. Includes detailed docstring serving as schema documentation.@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. IMPORTANT NOTES: 1. All blocks are automatically formatted as bullet points in Logseq UI 2. To create links to other pages, use double brackets: [[Page Name]] When creating blocks on journal pages: - The block will inherit the "journal?" and "journalDay" attributes from the page - "journalDay" will be in YYYYMMDD format (e.g., 20250404 for April 4, 2025) Args: page_name (str): The name of the page to create the block on. content (str): The content of the new block. properties (dict, optional): Properties to set on the new block. Returns: dict: Information about the created block. """ """Create a new block on the specified page.""" return logseq_client.create_block(page_name, content, properties)
- Helper method in LogseqAPIClient that implements the actual API call to Logseq's 'logseq.Editor.appendBlockInPage' for creating a block.def create_block(self, page_name: str, content: str, properties: 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
- src/logseq_mcp/tools/__init__.py:2-2 (registration)Imports the create_block tool function from blocks.py for re-export and use in the MCP server.from .blocks import get_page_blocks, get_block, create_block, update_block, remove_block, insert_block, move_block, search_blocks
- src/logseq_mcp/__init__.py:9-9 (registration)Re-exports create_block in the package __init__ for easy access when importing the package.create_block,