2.6 KiB
2.6 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 05-mcp-publish-tool | publish_review_findings_kandev MCP tool | done | 3 |
|
plan.md | ../../specs/agents/requirements/native-code-review.md |
Task 05: publish_review_findings_kandev MCP tool
Let an agent session publish findings into the same store the built-in pass writes to.
Inputs
- Spec API surface → Task MCP tool, and the malformed-entry rule in Failure modes (an MCP call rejects the whole batch).
- Pattern:
show_walkthrough_kandev—internal/mcp/server/server.goregisterWalkthroughTools+ the steps schema helper,internal/mcp/server/handlers.goshowWalkthroughHandler,internal/mcp/handlers/handlers.gohandleShowWalkthrough, andpkg/websocket/actions.goActionMCPShowWalkthrough.
Work
pkg/websocket/actions.go—ActionMCPPublishReviewFindings = "mcp.review.publish_findings".internal/mcp/server/server.go—registerReviewTools()declaringpublish_review_findings_kandevwith the exact parameter schema from the spec, registered alongside the walkthrough tools.internal/mcp/server/handlers.go—publishReviewFindingsHandler()forwarding the payload and returning a text result naming the stored count and run id; a validation error is returned as a tool error so the agent can retry.internal/mcp/handlers/handlers.go—handlePublishReviewFindingscallingReviewService.PublishFindingswithTrigger = agent; mapErrInvalidReviewFindingtows.ErrorCodeInvalidPayloadand anything else tows.ErrorCodeInternalError. Register in the dispatcher next toActionMCPShowWalkthrough, and add thereviewServicedependency toNewHandlers.- Update the tool inventory in
docs/public/automation-and-mcp.mdif that file enumerates task-MCP tools (check before editing).
Acceptance
- Two valid findings produce a
completedrun withtrigger = agentand both findings, and the WStask.review.findings_publishedevent fires. - A batch with one entry missing
filereturns a tool error and stores nothing. anchor_textis absent from the tool schema — an agent-published finding stores an emptyanchor_textand is therefore never re-anchored, only marked stale.
Verification
cd apps/backend && go test ./internal/mcp/...
Files likely touched
pkg/websocket/actions.go, internal/mcp/server/{server.go,handlers.go,server_test.go}, internal/mcp/handlers/handlers.go, internal/backendapp/main.go.
Output contract
Summary, files changed, tests run with results, blockers, risks, status: done, plan checkbox.