LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
  • Stream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServerStream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/reactuseToolCalls
Function●Since v1.0

useToolCalls

Subscribe to a scoped tools (tool-call) stream. Same target and lifecycle rules as useMessages; at the root this just returns stream.toolCalls.

The optional generic T can be passed to narrow the type of toolCall.args on the returned array. Accepts either:

  • an agent brand (typeof agent) — union is derived from the agent's declared tools;
  • an array of LangGraph tools (typeof tools) — union is derived from ToolCallFromTool<T[number]>;
  • any direct DefaultToolCall shape.

When omitted, returns the plain AssembledToolCall[] union used by the controller.

Copy
useToolCalls(stream: AnyStream, target: SelectorTarget): AssembledToolCall[]

Parameters

NameTypeDescription
stream*AnyStream
targetSelectorTarget
View source on GitHub