Skip to main content
Glama

move_block

Move a block and its children to reorganize your Logseq knowledge graph, either as a child or sibling of another block.

Instructions

Moves a block to a new location in the graph. This allows for reorganizing the structure of blocks in the graph by moving a block (and all its children) to a different location. IMPORTANT NOTES: 1. The block will maintain its children when moved 2. The hierarchical position depends on the 'as_child' parameter: - If as_child=True: The block becomes a child of the target block - If as_child=False: The block becomes a sibling after the target block Args: block_id (str): The ID of the block to move. target_block_id (str): The ID of the target block to move to. as_child (bool, optional): Whether to make the block a child of the target. Default is False (insert as sibling). Returns: dict: Result of the move operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_idYes
target_block_idYes
as_childNo

Implementation Reference

  • MCP tool handler for 'move_block': decorated with @mcp.tool(), defines input schema via type hints and docstring, executes by calling logseq_client.move_block
    @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. This allows for reorganizing the structure of blocks in the graph by moving a block (and all its children) to a different location. IMPORTANT NOTES: 1. The block will maintain its children when moved 2. The hierarchical position depends on the 'as_child' parameter: - If as_child=True: The block becomes a child of the target block - If as_child=False: The block becomes a sibling after the target block Args: block_id (str): The ID of the block to move. target_block_id (str): The ID of the target block to move to. as_child (bool, optional): Whether to make the block a child of the target. Default is False (insert as sibling). Returns: dict: Result of the move operation. """ """Move a block to a new location in the graph.""" return logseq_client.move_block(block_id, target_block_id, as_child)
  • Helper method in LogseqAPIClient that performs the actual Logseq API call for moving a block using logseq.Editor.moveBlock with structured 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

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/mikeysrecipes/logseq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server