Skip to content

fix(mcp): align lifecycle envelope, strip raw_message from get_review, doc drift - #659

Merged
jiashuoz merged 4 commits into
mainfrom
fix/mcp-tool-contract
Jul 23, 2026
Merged

fix(mcp): align lifecycle envelope, strip raw_message from get_review, doc drift#659
jiashuoz merged 4 commits into
mainfrom
fix/mcp-tool-contract

Conversation

@jiashuoz

Copy link
Copy Markdown
Member

Summary

Three MCP server issues found in a cross-surface review, plus tool-description corrections:

  1. get_message_lifecycle broke the frozen list-envelope contract — it returned the raw REST page ({items, next_cursor: null}) while util.ts declares the domain-named-array + omit-next_cursor-when-done shape frozen. Now returns {transitions, next_cursor?} like every other list tool. The tool is beta, so the output change is permitted pre-stable.
  2. get_review leaked full raw_message base64 MIME into model context — multi-MB per held inbound message. It now uses the same context-safe projection as get_message (shared messageViewForTool helper; legacy get_pending_message alias too). approve_review is unaffected — it builds payloads from caller override fields only.
  3. McpClient.listEvents declared agentId?: string but the SDK takes agentEmail; the spread caller silently bypassed excess-property checking. Renamed.

Description fixes: create_webhook/list_events now list the valid agent.suppression_added event type; approve_review no longer claims "SENT via SES" (queue-first 202-accepted semantics); update_protection documents the DMARC-pass precondition for inbound gates; README counts corrected to 60/16/44 and the false "agents can view their pending queue" claim removed.

Client surface checklist

  • MCP tool in mcp/src/tools/ + registry assertion in mcp/tests/tools.test.ts (envelope + projection tests updated/added)
  • Tests at each surface (236/236 vitest + test:types pass)

Intentionally skipped: REST/SDK/CLI/web rows — no REST change; the envelope and projection are MCP-output-only. wait=sent exposure in MCP tools is a separate follow-up (needs the TS SDK SendOptions.wait landing first).

Operational risk

Low-moderate: two MCP tool outputs change shape (get_message_lifecycle, get_review) — both beta, and the lifecycle change restores the documented frozen contract. Hosted-only deploy; no data touched. Rollback: revert.

Test plan

  • npm test --workspace @e2a/mcp-server (236/236 + type tests)
  • npm run build --workspace @e2a/mcp-server
  • get_review test asserts raw_message/parsed/attachment bytes absent, metadata retained

jiashuoz and others added 4 commits July 22, 2026 18:53
- README: correct counts to 60 tools / 16 runtime / 44 admin; drop the false
  claim that agent-scope credentials can view a pending review queue
- create_webhook/list_events: add agent.suppression_added to the documented
  event types (backend accepts it; omission made LLMs refuse to subscribe)
- update_protection: document the DMARC-pass precondition for inbound
  allowlist/domain gates
- get_message_lifecycle now returns the frozen MCP list envelope
  ({transitions, next_cursor?}) instead of the raw REST page
- get_review (and legacy get_pending_message) project held messages through
  the same context-safe view as get_message: no raw_message base64 MIME or
  attachment bytes in model context; approve_review unaffected
- approve_review description reflects queue-first 202-accepted semantics
  (was 'SENT via SES')
- McpClient.listEvents param renamed agentId -> agentEmail to match the SDK
  (spread had silently bypassed excess-property checking)
The review tools' context-safe projection (messageViewForTool, shared with
get_message) dropped hold_reason — the server's primary hold explanation,
set only on the review surface and the sole explanation when the
best-effort protection enrichment degrades. Wrap the projection in
reviewViewForTool (get_review + get_pending_message alias) so hold_reason
survives; get_message's output shape is unchanged.

Co-Authored-By: Kimi <noreply@moonshot.ai>
@jiashuoz
jiashuoz merged commit 47d8a7c into main Jul 23, 2026
22 checks passed
@jiashuoz
jiashuoz deleted the fix/mcp-tool-contract branch July 23, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant