← Back to Pull requests

Send MCP string successes and declared errors as raw text #80

Closed
unknown closed this pull request without merging on Nov 23, 2026 14:53 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 14:32 UTC
Author

An MCP tool returning file contents or command output sent a model JSON-escaped text (\", \t), so a model copying it into an edit's old_string missed. This is a breaking wire change; nothing is released.

What changes

  • String successes. A success whose schema encodes only to a string (Schema.String, a string literal, Schema.DateTimeUtc) is now one raw text block on every MCP revision, with no structuredContent and no outputSchema. Other successes are unchanged. A union holding a string, such as NullOr(String), is still sent like any other success.

  • Declared errors. A declared error, refusals included, is isError: true with its message as the text. The error itself is the text when it is a string, and its JSON when it has no non-empty message. Its encoding goes in _meta["io.github.gjermundgaraba.effect-actions/error"].

  • ActionMcp.client decodes a string success from the text block and a declared error from that _meta only; it no longer falls back to parsing the text. Against a 0.37.0 endpoint it fails loudly: UnexpectedContent for a string success, UndeclaredError for an error. McpCallError's NoStructuredContent reason is renamed UnexpectedContent.

  • Why both fields go. Under 2026-07-28, Effect's adapters pass string structuredContent through, and Claude Code (2.1.330) shows a model serialized structuredContent in place of every text block. Leaving structuredContent out is the only way the text reaches the model raw. Amp and Claude Code's v2 client both negotiate 2026-07-28.
  • Commits

    1. dfcce54 is the fix, with tests, docs, the CHANGELOG and AGENTS.md recheck entries.
    2. 799d422 moves the _meta keys (field, progress, error) to a reverse-DNS prefix, as the MCP spec says a prefix should. It can be dropped independently.
    3. c724427 tidies up after a deslop review: a structural listing comparison in media.test.ts, and the version note kept in the CHANGELOG only.

    Unrelated docs line: AGENTS.md gains a note that tests/cli/cli.test.ts fails in an Amp orb (NO_COLOR=1), so run env -u NO_COLOR vp test there. It is environmental and fails the same way on main.

    Verification

    Done locally only. vp check, vp test (1694/1694) and vp run test:package pass, and the fix commit alone passes vp check and vp test. Two planted violations each failed their tests: error text always JSON failed surfaces-agree, and Effect dropping string structuredContent failed the media.test parity tests. No CI had run on the branch before this PR.

    Consumer migration is in CHANGELOG.md under Unreleased.

    Diff: 328 lines (+246 / -82) across 4 files Reviewer: gjermundgaraba Review duration: 21m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 328 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.347
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #80"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.1% (MEDIUM) · Higher = larger blast radius
    42.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.6% · Safe to merge
    16.6%