update_block
Modify and enhance Logseq graph blocks by updating content, adding links with [[Page Name]], and optionally adjusting properties using block ID and new data.
Instructions
Updates an existing block in the Logseq graph.
Use [[Page Name]] to create links to other pages.
Args:
block_id: The ID of the block to update.
content: The new content for the block.
properties: Optional properties to update on the block.
Returns:
Information about the updated block.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block_id | Yes | ||
| content | Yes | ||
| properties | No |
Implementation Reference
- src/logseq_mcp/tools/blocks.py:83-98 (handler)The MCP tool handler for 'update_block'. Decorated with @mcp.tool(), it defines the input schema via type hints and docstring, and delegates the logic to the LogseqAPIClient.@mcp.tool() def update_block(block_id: str, content: str, properties: Optional[Dict] = None) -> Dict: """ Updates an existing block in the Logseq graph. Use [[Page Name]] to create links to other pages. Args: block_id: The ID of the block to update. content: The new content for the block. properties: Optional properties to update on the block. Returns: Information about the updated block. """ return logseq_client.update_block(block_id, content, properties)
- Core implementation logic in LogseqAPIClient that prepares parameters and calls the Logseq API endpoint 'logseq.Editor.updateBlock'.def update_block(self, block_id: str, content: str, properties: Optional[Dict] = None) -> Dict: """Update an existing block""" params = [block_id, content] if properties: params.append(properties) response = self.call_api("logseq.Editor.updateBlock", params) if isinstance(response, dict) and "result" in response: return response.get("result") return response
- src/logseq_mcp/tools/__init__.py:12-12 (registration)Exported as part of the tools module __all__ list, making it available for import."update_block",
- src/logseq_mcp/__init__.py:10-10 (registration)Imported and re-exported in the package __init__.py __all__.update_block,