fix(apps): forward _meta in tool results to MCP Apps#7476
Conversation
The McpAppToolResult type and appToolResult memo were missing the _meta property, causing it to be silently dropped when converting tool results for the @mcp-ui/client SDK's AppRenderer component. This is a regression from #7013 which refactored McpAppRenderer to use the SDK's AppRenderer. The custom McpAppToolResult type was created without _meta, and the conversion logic only mapped content and structuredContent. Fixes #7435
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression from #7013 where the _meta property from tool results was being dropped when forwarding to MCP Apps. The MCP Apps specification requires hosts to forward the entire tool execution result, including _meta, to the app view. The fix adds the missing _meta field to the McpAppToolResult type and ensures it's properly forwarded in the conversion logic.
Changes:
- Add
_meta?: { [key: string]: unknown }toMcpAppToolResulttype definition - Forward
_metaproperty in theappToolResultmemo when converting toCallToolResult
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ui/desktop/src/components/McpApps/types.ts | Add optional _meta field to McpAppToolResult type |
| ui/desktop/src/components/McpApps/McpAppRenderer.tsx | Forward _meta from toolResult to appToolResult in the conversion memo |
| @@ -40,6 +40,7 @@ export type McpAppToolCancelled = McpUiToolCancelledNotification['params']; | |||
| export type McpAppToolResult = { | |||
There was a problem hiding this comment.
do we need this type? isn't this just CallToolResult?
There was a problem hiding this comment.
No, we don't, but upon further investigation, we are sending camel case over the wire and should make updates in the backend. Will follow up with another PR for that.
b4936b2 to
9752efc
Compare
Signed-off-by: Oleg Levchenko <[email protected]>
Summary
Fixes #7435
The
_metaproperty from tool results was being silently dropped when forwarding to MCP Apps via the@mcp-ui/clientSDK'sAppRenderercomponent. This is a regression introduced in #7013.Root Cause
When #7013 refactored
McpAppRendererto use the SDK'sAppRenderer, the customMcpAppToolResulttype was created without_meta, and the conversion logic in theappToolResultmemo only mappedcontentandstructuredContent.The upstream data (from rmcp's
CallToolResult) does include_metaon the wire — it was just being discarded at the TypeScript boundary.Changes
types.ts: Add_meta?: { [key: string]: unknown }toMcpAppToolResultMcpAppRenderer.tsx: Forward_metain theappToolResultmemoTesting
toolResult._meta