Repository navigation
Description
Problem
In an MCP client that shows the model only a tool result's content and not its structuredContent, every ShipLean tool comes back as a one-line summary. Cursor, connected through an MCP gateway, is one such client. Two workflows break completely:
-
capture_plancan't be applied. The preview'splantoken is only instructuredContent, so the agent never sees it and can't make the second call. A preview I ran today came back as exactly this (project key changed), and nothing else:Preview of the plan for SHIP; nothing is created yet. Call capture_plan again with the same arguments and the plan to create it.
The text tells the agent to send "the plan", which it has no way to get.
-
Agents can't read back what they wrote.
get_work_item,plan_statusandsearchalso return one line, for example:SHIP-44 Saves are validated: New, revision 1, 0 children, 0 attachments, 0 recent comments.
Tags, description, acceptance criteria, attachments and the plan's waves are all invisible. After writing a plan, the agent can't check that the tags landed or that
plan_statussees the plan.
In practice an agent falls back to create_feature, break_down, refine_work_item and attach_markdown, copying the tags capture_plan would write by hand. That loses the one-shot, idempotent apply (the sealed digest and plan claim). It turns one call into about 40 for a 15-story, 23-task plan, and the result can't be verified from the agent's side.
Cause
Every reply helper builds the same shape: the full result in structuredContent, and one summary line as the only text block.
// src/ShipLean.WebApi/Features/Mcp/Tools/Planning/PlanningReply.cs (same in WorkReply, OrientReply, SprintReply, StatusReply, CaptureSupport, ToolErrorFilter)
Content = [new TextContentBlock { Text = summary }],
StructuredContent = JsonSerializer.SerializeToElement(result, result.GetType()),The WorkReply comment says the line is "for a client that shows only text". But for anything beyond a confirmation, a client that shows only text then gets nothing it can act on.
The MCP spec covers this case. From Tools → Structured Content: "For backwards compatibility, a tool that returns structured content SHOULD also return the serialized JSON in a TextContent block." ShipLean returns structured content without that text block.
Proposed change
1. Every tool reply also carries its result as JSON text.
contentbecomes two text blocks: the summary line, then the same JSON that goes instructuredContent.- Do it in one shared helper that the seven reply helpers (including the error filter) call. That way the two copies can't drift, and a new tool can't forget the JSON block.
- Clients that read
structuredContentdon't change. Clients that show only text get the full result, including theplantoken, item keys, tags andplan_statuswaves.
2. Make capture_plan's preview → apply workflow work from text alone.
- The preview summary line points at the token: "…call capture_plan again with the same arguments and the
planvalue from the JSON below." planning_guidesays to copyplanfrom the preview result verbatim, and that it expires afterexpires_in_minutes.- The applied result's JSON carries the created keys, so the agent can confirm the tree without another call.
3. A test that drives the workflow the way a text-only client does.
- An API test runs
capture_planpreview then apply, reading theplantoken only from the text content, and then checksplan_statusfrom its text content. - A guard-rail test in
ShipLean.UnitTestchecks that everyCallToolResultthe MCP tools build goes through the shared helper. Then the JSON text block can't be skipped by a new reply helper.
4. Docs. Update the result convention in docs/mcp.md: summary line plus serialized JSON in content, and the same object in structuredContent. Also update the error paragraph, which currently says the message is "the one line of text".
Trade-off
Clients that show both copies to the model pay for the result twice. Most results are small. get_work_item and plan_status are the large ones, and they're exactly where a text-only client needs the full data. The spec recommends paying this cost for compatibility, so I'd rather do that than make the JSON block opt-in.
Acceptance criteria
- Every MCP tool result has its summary line, and a text block holding the same JSON as
structuredContent. Errors included. - A text-only agent can preview and apply
capture_planin two calls, and read back the keys it created. -
get_work_itemshows tags, description, acceptance criteria and attachment names in text, andplan_statusshows waves, stories and tasks with their model and context. - The API test of the text-only workflow and the guard-rail test pass.
-
docs/mcp.mddescribes the new result shape.
Activity
MCP results carry their JSON as text; instructions describe the resul…