Extract the tool call type from a StateType's messages property. This is the canonical way to get typed tool calls in useStream.
Tool call types are now extracted from the messages property of StateType, rather than being specified separately in the Bag.
GetToolCallsType: ExtractToolCallsFromState<
StateType
> extends never DefaultToolCall : ExtractToolCallsFromState<StateType>// Define state with typed messages
type MyToolCalls =
| { name: "get_weather"; args: { location: string }; id?: string }
| { name: "search"; args: { query: string }; id?: string };
interface MyState {
messages: Message<MyToolCalls>[];
}
// GetToolCallsType<MyState> = MyToolCalls