Skip to content

chat: add ToolCallResult.resultMetadata mirroring MCP CallToolResult._meta - #549

Merged
Connor Peet (connor4312) merged 1 commit into
mainfrom
copeet/tool-result-metadata
Oct 29, 2026
Merged

Connor Peet (connor4312) merged 1 commit into
mainfrom
copeet/tool-result-metadata

Conversation

@connor4312

Copy link
Copy Markdown
Member

Adds optional resultMetadata?: Record<string, unknown> to ToolCallResult, mirroring the _meta field of MCP CallToolResult (the same way structuredContent mirrors MCP structuredContent).

Why

MCP Apps read app-only data from a tool result's _meta. Hosts that rebuild an MCP App tool result from AHP state (e.g. when a session is reopened or restored) had nowhere to keep it. ToolCallBase._meta is host/provider metadata (ui, toolKind, ...), so putting server-controlled data there risks collisions. Without the result metadata, restored MCP App cards lose their data: microsoft/vscode#343243.

Changes

  • types/channels-chat/state.ts: new optional ToolCallResult.resultMetadata.
  • types/channels-chat/reducer.ts: the result-confirmation path copies resultMetadata alongside structuredContent. The native Swift, Rust, Kotlin, Go and .NET reducers do the same.
  • Reducer fixtures updated, plus a new pending-confirmation reducer case and a round-trip fixture.
  • Regenerated schemas and all client state models. Change fragment added (additive, non-breaking).

Consumers

Validation

  • npm run generate: all targets regenerated.
  • npm test: typecheck, lint, release-metadata, changelog/fragment and generated-freshness checks pass; types/reducers.ts coverage is 100%.
  • Locally on Windows, scripts/read-window-exempt.test.ts and types/channel-delivery.test.ts fail ("Control Messages section must exist"). They fail the same way on unmodified main with core.autocrlf=true, so this change doesn't cause them.

Written by Connor's agent

…_meta

Hosts rebuilding MCP App tool results from state had no place for the
server's result _meta (ToolCallBase._meta is host/provider metadata), so
app-only data was lost on reconstruction (microsoft/vscode#343243).

Add optional resultMetadata to ToolCallResult, carried by the result
confirmation reducer like structuredContent, and regenerate schemas and
clients.

Co-authored-by: Copilot <[email protected]>
@connor4312
Connor Peet (connor4312) merged commit 0b7b7f9 into main Oct 29, 2026
9 checks passed
@connor4312
Connor Peet (connor4312) deleted the copeet/tool-result-metadata branch October 29, 2026 17:46
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.

3 participants