LangGraph.js API Reference
    Preparing search index...

    Type Alias GetToolCallsType<StateType>

    GetToolCallsType: ExtractToolCallsFromState<StateType> extends never
        ? DefaultToolCall
        : ExtractToolCallsFromState<StateType>

    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.

    Type Parameters

    • StateType extends Record<string, unknown>
    // 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