Skip to content

MCP tools are unusable from text-only clients: capture_plan's preview token and read-backs are only in structuredContent #21

Closed

Description

@joeldickson

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:

  1. capture_plan can't be applied. The preview's plan token is only in structuredContent, 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.

  2. Agents can't read back what they wrote. get_work_item, plan_status and search also 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_status sees 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.

  • content becomes two text blocks: the summary line, then the same JSON that goes in structuredContent.
  • 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 structuredContent don't change. Clients that show only text get the full result, including the plan token, item keys, tags and plan_status waves.

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 plan value from the JSON below."
  • planning_guide says to copy plan from the preview result verbatim, and that it expires after expires_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_plan preview then apply, reading the plan token only from the text content, and then checks plan_status from its text content.
  • A guard-rail test in ShipLean.UnitTest checks that every CallToolResult the 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_plan in two calls, and read back the keys it created.
  • get_work_item shows tags, description, acceptance criteria and attachment names in text, and plan_status shows 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.md describes the new result shape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions