logseq_edit_block
Enable editing mode for a specific block in Logseq by providing the block UUID or reference and cursor position, allowing precise content updates.
Instructions
Enter editing mode for a specific block
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pos | No | Cursor position in block content | |
| src_block | Yes | Block UUID or reference |
Implementation Reference
- src/mcp_server_logseq/server.py:538-548 (handler)The main handler for the logseq_edit_block tool within the @server.call_tool() function. It validates arguments using EditBlockParams, makes an API request to Logseq's Editor.editBlock method, and returns a confirmation message.elif name == "logseq_edit_block": args = EditBlockParams(**arguments) result = make_request( "logseq.Editor.editBlock", [args.src_block, {"pos": args.pos}] ) return [TextContent( type="text", text=f"Editing block {args.src_block} at position {args.pos}" )]
- Pydantic model defining the input schema for the logseq_edit_block tool, including src_block (required) and pos (optional cursor position).class EditBlockParams(LogseqBaseModel): src_block: Annotated[ str, Field(description="Block UUID or reference", examples=["6485a-9de3...", "[[Page/Block]]"]) ] pos: Annotated[ int, Field( default=0, description="Cursor position in block content", ge=0, le=10000 ) ]
- src/mcp_server_logseq/server.py:253-257 (registration)Tool registration in the @server.list_tools() function, specifying the name, description, and input schema for logseq_edit_block.Tool( name="logseq_edit_block", description="Enter editing mode for a specific block", inputSchema=EditBlockParams.model_json_schema(), ),
- src/mcp_server_logseq/server.py:352-362 (registration)Prompt registration in the @server.list_prompts() function for logseq_edit_block.Prompt( name="logseq_edit_block", description="Edit specific block content", arguments=[ PromptArgument( name="src_block", description="Block identifier", required=True ) ] ),
- src/mcp_server_logseq/server.py:710-731 (handler)Handler logic for logseq_edit_block within the @server.get_prompt() function, similar to the tool handler but for prompt execution.elif name == "logseq_edit_block": if "src_block" not in arguments: raise ValueError("src_block is required") pos = arguments.get("pos", 0) make_request( "logseq.Editor.editBlock", [arguments["src_block"], {"pos": pos}] ) return GetPromptResult( description=f"Editing block {arguments['src_block']}", messages=[ PromptMessage( role="user", content=TextContent( type="text", text=f"Editing mode activated at position {pos}" ) ) ] )