move_block
Move a block and its children to a new location in Logseq. Choose to place it as a child or sibling of the target block using block and target IDs for precise organization.
Instructions
Moves a block to a new location in the graph.
Moves a block and all its children to a different location.
- as_child=True: Block becomes a child of the target
- as_child=False: Block becomes a sibling after the target
Args:
block_id: The ID of the block to move.
target_block_id: The ID of the target block to move to.
as_child: Whether to make the block a child of the target (default: False).
Returns:
Result of the move operation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_child | No | ||
| block_id | Yes | ||
| target_block_id | Yes |
Implementation Reference
- src/logseq_mcp/tools/blocks.py:100-117 (handler)MCP tool handler for 'move_block'. Decorated with @mcp.tool() which registers it as an MCP tool. Includes input schema via type hints and docstring. Delegates to the LogseqAPIClient instance.@mcp.tool() def move_block(block_id: str, target_block_id: str, as_child: bool = False) -> Dict: """ Moves a block to a new location in the graph. Moves a block and all its children to a different location. - as_child=True: Block becomes a child of the target - as_child=False: Block becomes a sibling after the target Args: block_id: The ID of the block to move. target_block_id: The ID of the target block to move to. as_child: Whether to make the block a child of the target (default: False). Returns: Result of the move operation. """ return logseq_client.move_block(block_id, target_block_id, as_child)
- Low-level helper method in LogseqAPIClient that performs the actual API call to Logseq's 'logseq.Editor.moveBlock' endpoint with the required parameters.def move_block(self, block_id: str, target_block_id: str, as_child: bool = False) -> Dict: """Move a block to a new location in the graph""" # Determine the appropriate API method based on the as_child parameter method = "logseq.Editor.moveBlock" # The API expects a structured argument for the move operation move_params = { "srcUUID": block_id, "targetUUID": target_block_id, "isChild": as_child } response = self.call_api(method, [move_params]) if isinstance(response, dict) and "result" in response: return response.get("result") return response
- src/logseq_mcp/tools/__init__.py:4-18 (registration)Exports 'move_block' tool in __all__ for import in the main MCP server.__all__ = [ "get_all_pages", "get_page", "create_page", "delete_page", "get_page_blocks", "get_block", "create_block", "update_block", "remove_block", "insert_block", "move_block", "search_blocks", "get_page_linked_references", ]