Skip to main content
Glama
dailydaniel

Logseq MCP Server

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}"
                    )
                )
            ]
        )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action ('enter editing mode') but lacks behavioral details such as what 'editing mode' entails (e.g., UI changes, permissions required, or effects on other operations), rate limits, or error handling, making it insufficient for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and wastes no space, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation operation with no annotations and no output schema), the description is incomplete. It doesn't cover behavioral aspects, usage context, or what happens after entering editing mode, leaving significant gaps for an AI agent to understand and invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear documentation for both parameters (src_block and pos). The description adds no additional meaning beyond the schema, such as explaining how 'src_block' references work or when to use 'pos'. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('enter editing mode') and resource ('for a specific block'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'logseq_insert_block' or 'logseq_get_editing_block_content', which also involve block editing or content retrieval, so it doesn't reach the highest clarity level.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid block reference), exclusions, or compare to siblings like 'logseq_exit_editing_mode' or 'logseq_insert_block', leaving usage context unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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