@@ -60,18 +60,6 @@ function saveBlob(blob: Blob, name: string) {
6060 setTimeout ( ( ) => URL . revokeObjectURL ( url ) , 60_000 ) ;
6161}
6262
63- // The host gets the tool call pushed by an effect keyed on it, so it stays
64- // stable across the command hooks that follow.
65- function useToolCall (
66- storedItem : NonNullable < ReturnType < typeof useTurnItemDetail > [ "data" ] > [ "item" ] | undefined ,
67- ) {
68- "use memo" ;
69- if ( storedItem ?. type !== "dynamic_tool" ) return undefined ;
70- const output = storedItem . output as { readonly result ?: unknown } | undefined ;
71- const result = output ?. result as McpAppCallToolResult | undefined ;
72- return { arguments : storedItem . input , result } ;
73- }
74-
7563export function McpAppFrame ( props : {
7664 readonly environmentId : EnvironmentId ;
7765 readonly threadId : ThreadId ;
@@ -142,7 +130,16 @@ export function McpAppFrame(props: {
142130 revision : props . revision ,
143131 } ) ;
144132 const storedItem = detail . data ?. item ;
145- const toolCall = useToolCall ( storedItem ) ;
133+ // The host gets the tool call pushed by an effect keyed on it, so it must stay cached.
134+ const toolCall =
135+ storedItem ?. type === "dynamic_tool"
136+ ? {
137+ arguments : storedItem . input ,
138+ result : ( storedItem . output as { readonly result ?: unknown } | undefined ) ?. result as
139+ | McpAppCallToolResult
140+ | undefined ,
141+ }
142+ : undefined ;
146143
147144 const callTool = useAtomCommand ( mcpAppEnvironment . callTool , { reportFailure : false } ) ;
148145 const toolInfo = useAtomCommand ( mcpAppEnvironment . toolInfo , { reportFailure : false } ) ;
0 commit comments