Repository navigation
MCP results carry their JSON as text; instructions describe the result shape and how to run a plan - #24
Merged
Conversation
…t shape and how to run a plan (#21, #23) Every tool result, errors included, is built by McpToolResult.Of: a summary line, the Markdown for get_brief and planning_guide, then the same JSON as structuredContent, so a client that shows the model only text gets the whole result. Preview summary lines name the plan value. The server instructions describe the result shape, the run-a-plan route and that the MCP is the only way in. A guard-rail test fails for any other type that builds tool-result content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #21. Closes #23.
Why
Cursor, through the MCP gateway, shows the model only a tool result's
content, and every ShipLean tool put the whole result instructuredContentwith one summary line as the only text. In that clientcapture_plancouldn't be applied, nothing could be read back, andget_brief/planning_guidereturned no guidance. So agents went looking in saved output, transcripts, ShipLean's source and MCP config. This happened again this morning: an agent asked to run UNF-64 got "The brief for UNF-64." and nothing else.What changes
Every result also carries its JSON as text (#21). A new
McpToolResult.Ofbuilds every tool result, errors included.contentis the summary line, then the Markdown forget_briefandplanning_guide, then the same JSON asstructuredContent. This is the spec's backwards-compatible shape. The seven reply helpers (WorkReply,PlanningReply,OrientReply,SprintReply,StatusReply,CaptureSupport.Reply,ToolErrorFilter.Result) keep their own serialization (OrientReplystill drops nulls) and call it. Clients that readstructuredContentsee no change.Summary lines name what the next call needs (#21, #23 item 5). The
capture_plan,capture_work,plan_sprintandend_sprintpreviews now say "…with theplanvalue from the JSON below". The planning guide says to copy that token verbatim.Server instructions (#23). These describe the result shape, and say what to do when a client hides everything but the summary line: tell the person, and don't search saved output, transcripts or source. They also give the run-a-plan route (
get_briefon the Feature,get_briefper task,report_task), and say that these tools are the only way in.Docs.
docs/mcp.mdhas a new "Tool results" section, an updated error paragraph, and an "Adding a tool" note: return through your area's reply helper.Trade-off
A client that shows both copies reads the result twice.
get_briefandplanning_guidecarry the Markdown three times (as text, inside the JSON text, and instructuredContent). I kept the JSON block identical tostructuredContentinstead of stripping the Markdown from it, so the two copies can't drift. That's what #21's acceptance criteria ask for.Tests
TextOnlyCapturePlanTests: preview → apply →plan_status, reading theplantoken, created keys and the waves (with model and context per task) only from text. It also checks that a result's JSON text equals itsstructuredContent, and that an error carries itsMcpErroras JSON text.GetBriefTests,PlanningGuideTests: the summary line, then the Markdown, then the JSON.OrientItemTests:get_work_itemtext JSON is the whole item (tags, children).McpToolRulesTests: the guard rail fails for any type other thanMcpToolResultthat builds tool-result content. A fixture shows that a hand-built reply is caught.McpServerInstructionsTests: the instructions nameget_briefandreport_task, and describe the result shape and the only way in.Run locally (Release, warnings as errors):
ShipLean.WebApi,ShipLean.UnitTestandShipLean.WebApi.Testsbuild clean. 28 MCP unit and guard-rail tests and all 427 MCP API tests (ShipLean.WebApi.Tests.Mcp) pass.ShipLean.AcceptanceTestsdoesn't build on this machine: its SDK (10.0.113) reportsS8969in two journey files this PR doesn't touch. CI's newer10.0.xbuildsmainclean, so CI covers that project.After deploy
#23's last criterion can only be checked live. Replay a "run this plan" prompt in Cursor: the agent should call
get_briefon the Feature within its first few calls and read the waves, without listing saved files, grepping transcripts, or reading ShipLean's source or MCP config.