Skip to content

Add links and Comment quotes to MCP reads #343

Open

Description

@HMarzban

Parent

#328. Related: #230, #336

What to build

A person asks their AI app "Where did we decide the venue budget?". The answer cannot link there, because no read tool returns a link. The app also cannot see which sentence a Comment quotes, so it misreads replies such as "too high".

After this change, get_outline and read_document return heading links, and list_chat_rooms returns chat links. read_chat_thread shows each Comment's quote.

Acceptance criteria

  • One module in apps/hocuspocus.server/src/lib/ exports buildDocumentUrl(appUrl, slug) and buildHeadingUrl(documentUrl, tocId | null). buildDocumentUrl encodes the slug. buildHeadingUrl encodes the toc-id.
  • The digest's sectionUrl is deleted. Digest tests pass with unchanged URLs.
  • create_document and the digest's withResolvedName use buildDocumentUrl.
  • get_outline gives each node a url, or url: null when section_id is null.
  • read_document carries url: the heading link with section_id, else the document link.
  • list_chat_rooms gives each room a url from buildChatActionUrl. A cold open of it opens that heading chat.
  • Links appear in the text, outside the data frame. The read tools return text only since Put document and heading titles inside the data frame in every MCP read #457, so there is no structuredContent to fill.
  • read_chat_thread shows a text Comment as (comment on: "<quote>"), capped at 200 characters, with line breaks as spaces. A media Comment shows (comment on media). No src, html, caption or preview leaves the server.
  • From metadata, readThread selects only named paths (comment->>kind, comment->>content), never the whole object.
  • Tool descriptions, docs/mcp/reference.md and apps/hocuspocus.server/API.md §MCP connector name the new fields.

Blocked by

Agent brief

Type: AFK.

  • Model the helpers on buildChatActionUrl (apps/hocuspocus.server/src/lib/push/chatActionUrl.ts). The module imports nothing, so tests load it without Redis.
  • The browser writes Comment JSON (apps/webapp/src/api/messages/sendCommentMessage.ts). So one pure function in modules/mcp/domain/ type-checks it.
  • Rules: apps/hocuspocus.server/CLAUDE.md §MCP Connector and §Testability Seams. AGENTS.md §Test Policy (c): one formatter unit test, proved by sabotage.
  • Verify: bun test src/modules/mcp tests/unit/contentChangeDigest.test.ts, typecheck, lint, format. Open each returned url in a fresh profile.

Out of scope

Activity

  1. added
    enhancement
    Chat
    on Sep 28, 2026
  2. changed the title [-]Add heading links and comment quotes to MCP reads[/-] [+]Add links and Comment quotes to MCP reads[/+] on Sep 29, 2026
  3. HMarzban commented on Oct 15, 2026

    @HMarzban
    CollaboratorAuthor

    Related issues


    Cross-link review, 2026-10-15. Generated by Claude Code

  4. added this to the v2.4.0 milestone on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Chatenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions