Skip to content

Project a bead's body so the MCP can return it - #340

Merged
anuveyatsu merged 1 commit into
mainfrom
bead/bead-body-in-mcp
Sep 25, 2026
Merged

anuveyatsu merged 1 commit into
mainfrom
bead/bead-body-in-mcp

Conversation

@anuveyatsu

Copy link
Copy Markdown
Member

The gap

Aleksandra couldn't fetch a bead's content (description, acceptance) from the MCP. Confirmed root cause: workgraph_bead → /v1/work/{bead} → system_bead_detail reads work_refs, a projection of the Beads graph that carries title, status and the last comment — but not the bead's own body. Those fields live only in the canonical Dolt graph on the node, so the detail had the outcome but never the brief.

What this does

bd list (which the node already reads every pass) returns description and acceptance_criteria for every bead. This projects them:

  • dispatcher readBeads maps both from the existing bd list output (no extra bd show); beadRow carries them up, omitempty.
  • control-api POST /v1/node/work/project accepts them and calls a new system_project_bead_body — a small updater alongside system_project_bead, mirroring system_project_bead_blockers, so the big upsert's signature/body are untouched.
  • migration 0105 adds description/acceptance columns to work_refs and the two fields to system_bead_detail's result (reproduced from 0104 with only those keys inserted).
  • workgraph_bead tool description now advertises the brief.

Projected with COALESCE (like last_comment) so a pass carrying no body never erases one an earlier pass recorded; omitempty keeps the payload backward-compatible with an older control plane.

Scope note

This surfaces description + acceptance (the "body"). The full comment thread beyond the last comment is a larger change (only last_comment is projected today) and is left as a follow-up.

Command run

go build ./... && go vet ./cmd/dispatcher/ ./cmd/control-api/ ./internal/mcp/ && go test ./internal/mcp/ ./cmd/migrate/
ok  github.com/datopian/openbases/internal/mcp   0.398s
ok  github.com/datopian/openbases/cmd/migrate    0.606s

Migration applies in CI's database job.

🤖 Generated with Claude Code

The bead detail carried the title, the outcome, the agent's last comment, the
pull requests and the cost -- but never the bead's own body: the description
that says what to do and the acceptance criteria that say what "done" means.
So "fetch the content of this bead" through workgraph_bead had no answer, and a
bead's own brief was unreadable from any MCP client.

work_refs is a projection of the Beads graph and simply did not carry these two
fields, though `bd list` has returned both all along. This projects them:

- dispatcher readBeads maps description and acceptance_criteria from the same
  `bd list` output it already reads (no extra bd show), and beadRow carries them
  up, omitempty so an older control plane sees the payload it always saw;
- POST /v1/node/work/project accepts them and calls a new
  system_project_bead_body, a small updater alongside system_project_bead
  (mirroring system_project_bead_blockers) so the big upsert's signature and
  body are untouched;
- migration 0105 adds description/acceptance columns to work_refs and adds the
  two fields to system_bead_detail's result;
- the workgraph_bead tool description now advertises the brief.

Body is projected, like last_comment, with COALESCE so a pass carrying none
never erases one an earlier pass recorded.

Command run:
  go build ./... && go vet ./cmd/dispatcher/ ./cmd/control-api/ ./internal/mcp/ \
    && go test ./internal/mcp/ ./cmd/migrate/
Output:
  ok  github.com/datopian/openbases/internal/mcp   0.398s
  ok  github.com/datopian/openbases/cmd/migrate    0.606s

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 52 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 3245e958-f730-4e6f-9739-4c56687db763

📥 Commits

Reviewing files that changed from the base of the PR and between d81a277 and 07a7442.

📒 Files selected for processing (4)
  • cmd/control-api/main.go
  • cmd/dispatcher/main.go
  • db/migrations/0105_the_bead_detail_shows_its_body.sql
  • internal/mcp/tools.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@anuveyatsu
anuveyatsu merged commit dc89acf into main Sep 25, 2026
7 checks passed
@anuveyatsu
anuveyatsu deleted the bead/bead-body-in-mcp branch September 25, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant