Skip to content

feat: add update_block tool to edit existing block content by UUID #17

@ergut

Description

@ergut

Summary

Add an update_block tool that edits the content of an existing block by UUID. This is the only missing piece of block-level CRUD — read (get_page_content), create (insert_nested_block), and delete (delete_block) are all covered.

Motivation

Currently there's no way to modify an existing block's text without deleting and recreating it. Common use cases:

  • Fix a typo in a specific block
  • Update a task's status marker
  • Edit a block that was found via search or query

Proposed API

Tool name: update_block

Input schema:

{
  "block_uuid": "string (required) — UUID of the block to edit",
  "content": "string (required) — new content to replace the block's current text"
}

Underlying Logseq API: logseq.Editor.updateBlock(blockUUID, content)

Implementation Notes

  • logseq.Editor.updateBlock is part of the plugin API and should be available via HTTP
  • Returns null on success (like removeBlock)
  • Should follow the existing emoji-prefix pattern: ✅ on success, ❌ on error
  • Needs unit tests in test_logseq_api.py and test_tool_handlers.py

Acceptance Criteria

  • LogSeq.update_block(block_uuid, content) method in logseq.py
  • UpdateBlockToolHandler in tools.py
  • Registered in server.py
  • Unit tests for both the API method and the handler
  • Integration test expected_tools updated (15 tools)
  • README tool table updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions