Skip to main content
Glama

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
NameRequiredDescriptionDefault
posNoCursor position in block content
src_blockYesBlock UUID or reference

Implementation Reference

  • 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 ) ]
  • 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(), ),
  • 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 ) ] ),
  • 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}" ) ) ] )

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

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