Expand description
Review-conversation tools (Phase 2).
Worker-facing MCP tools that turn a submitted review set into a
two-way conversation. The reviewer submits comments via /diff; the
worker reads them, replies, and resolves through
mcp__forge__review__*, and each reply appends to the comment thread
and flips it Open -> Addressed.
This module holds the JSON view shapes the tools return plus the pure
mappers from the durable forge_primitives::review types. The store
I/O lives in crate::store::review; the Workspace::review_*
wrappers surface it; the Tool impls + caller resolution live beside
this (the facade submodule and the tool structs).
Re-exports§
use std::sync::Arc;🔒use serde::Deserialize;🔒use serde::Deserialize;🔒use serde::Serialize;🔒use serde::Serialize;🔒use forge_sdk::mcp::server::McpServerBuilder;🔒use forge_sdk::mcp::tool::Tool;🔒use forge_sdk::mcp::tool::ToolInput;🔒use forge_sdk::mcp::tool::ToolOutput;🔒use forge_sdk::mcp::tool::ToolOutputBlock;🔒use forge_primitives::review::ReviewAuthor;🔒use forge_primitives::review::ReviewSet;🔒use forge_primitives::review::ReviewSide;🔒use forge_primitives::review::ReviewStatus;🔒use forge_primitives::review::ReviewThread;🔒use forge_primitives::review::is_doc_scope;🔒use forge_primitives::review::is_tree_scope;🔒use forge_primitives::review::tree_scope_ref;🔒use crate::SessionSlot;🔒use crate::mcp::review::facade::ReviewFacade;🔒use crate::mcp::review::facade::ReviewScope;🔒
Modules§
- facade
- The narrow workspace surface the review-conversation tools call, plus
the production impl on
Workspaceand a mock for unit tests.
Structs§
- Comment
Anchor View - What
review__replyandreview__resolveanswer with: where the comment is anchored and the review round its latest turn belongs to, alongside the state it now holds.numberis the review’s 1-based ordinal, null while the thread is filed in no round. - GetArgs 🔒
- List
Args 🔒 - Reply
Args 🔒 - Resolve
Args 🔒 - Review
Activity 🔒 - One worker review action recorded during a turn, accumulated per caller and drained at the turn’s end into a single notice per review.
- Review
Comment View - One comment in
review__get, carrying the anchored code so the worker can locate the spot regardless of the comment’s diff scope (a commit-scoped comment’s line may not match the current working tree). - Review
Detail review__get: a review’s overview plus the comments filed under it.- Review
Get 🔒 review__get- the comments of one review, with anchored code.- Review
List 🔒 review__list- the submitted reviews on the caller’s (project, branch), or on an explicitscope.- Review
Reply 🔒 review__reply- append a reply to a comment thread; flips it Open -> Addressed.- Review
Resolve 🔒 review__resolve- mark a comment resolved.- Review
Summary - One row of
review__list: a submitted review plus its member-comment tally by state. - Review
Turn View - One turn in a comment thread:
authoris"you"for the reviewer or the agent’s label for a worker reply.reviewis the number of the review that sealed the turn, so a thread spanning several rounds shows which turns belong to which;Noneon agent replies and on a turn no review has sealed yet.
Functions§
- add_
tools 🔒 - Attach the four review-conversation tools to an existing builder. The
parent module’s
build_forge_servercalls this so they share theforgeserver name with the agents tools. - author_
str 🔒 - comment_
anchor 🔒 - Build the anchor echo for
thread, whose state just becamestatus. - comment_
view 🔒 - Map one thread to its
review__getview. The whole conversation is carried, not just the requested review’s turns, so the worker reads a later round with the earlier exchange as context; each turn’sreviewsays which round it came from. - detail 🔒
- Build the
review__getdetail forreview_id, orNonewhen no such review exists on the branch. - json_
or_ 🔒error - list_
output 🔒 - The caller’s rows, plus the project’s other review-bearing branches when there are any. A branch-scoped list is indistinguishable from the project’s whole set, and a review on the caller’s own branch is no reason to leave the one beside it unseen.
- merge_
newest 🔒 - Branch rows and seat-tree rows as one list, newest first. Review ids are
uuids, so none collide across the two scopes;
numberis per-scope and CAN repeat, which is why the tree’s rows come with the scope note beside them. - notice_
message 🔒 - The reviewer-facing one-line summary a worker’s review turn produces:
worker addressed review #N - A replied, B resolved, C open. Open /diff.openis the review’s current open-comment count after the turn, andscopenames the review itself, because each scope’s comments open in a door of their own: the document viewer, the files page, or the diff overlay (the lead’s gate, 2026-10-17: a tree scope pointed at/diff, which never carries one - the same hole the doc scope’s door had closed). - rfc3339_
now 🔒 - RFC3339 timestamp for the current instant, matching the peers helper.
- scope_
or_ 🔒error - Resolve the caller’s review scope or a ready-to-return tool error
naming the step that failed (see
ScopeError). - seat_
tree_ 🔒scope - The caller’s seat-tree scope, derived from its resolved branch scope:
project, author label and caller carry over; the key is the seat’s own
tree (a worker’s worktree, the lead’s checkout), which is where the
files page’s reviews live. The tools consult it beside the branch on
their default (no
scopeargument) path. - side_
str 🔒 - status_
str 🔒 - summarize 🔒
- Build the
review__listrows forreviewsgiven every thread on the branch, newest review first. A review’s members are the threads with a turn filed into it, so a thread the reviewer replied on across rounds counts under each of them. - tool_
error 🔒