feat(mcp): agents can write and read pull request review guides
Stacked on #18124.
Asking an agent to "prepare guides for these pull requests" had no tool to call: the pull request MCP tools only link, list and watch. This adds two tools that reach the review guide service from #18124.
write_pull_request_guidesstarts a guide for up to 20 pull requests (URL, or repository and number) and returns right away with one outcome per pull request:started,running(joined a run already going for that head), orfailedwith the reason. One refusal does not stop the rest.read_pull_request_guidereturns the stored guide, its run state, and whether a push left it stale. It never starts a run, so an agent can check back and report when the guides are done.
Each pull request is read through the project in the environment whose checkout is that repository, preferring the caller's own project. A repository with no checkout here reports that, and points at t3_project_create. While the server has review guides off, every write is refused with the setting's name, so the beta from #18124 holds for agents as well as people.
Writing a guide changes no thread, so it should not need thread control. It is gated by the pull-requests capability instead, through a new McpToolAccess.writesWithCapability declaration. That still refuses read-only clients and callers whose turn has ended, and the access table test covers both cases.
The tools also get work-log presentation ("Started review guides", "Read a review guide") on web and mobile through the shared tool inventory.
Testing
- Handler tests: guides go through the project that matches each repository; a repository with no checkout fails only its own entry; a server refusal ("Review guides are off") fails only its own entry; a run already going is reported as joined; reading reports stale.
- Access tests:
writes_with_capabilityruns for a credential without thread control, and is refused for a read-only client and an ended turn. - Server typecheck clean (errors and warnings), Knip passes, lint has no errors. Server MCP, adapter and pull request tests: 731 passed. Client-runtime and shared: 3503 passed.
Written by Claude Opus 5.5 in Claude Code.
š¤ Generated with Claude Code