When the model wants a tool, its reply has a list called tool calls. Each one says which tool, with which arguments, plus an ID to match the result later.
A model can ask for several tools in one reply. Here we ask about two books, so it asks to check stock twice, with different titles. Run it. We print each call's name and arguments. The IDs are random, but they matter, because each result must be sent back with its matching ID.
tool_calls.pypython
from langchain.tools import toolfrom langchain.chat_models import init_chat_model@tooldef check_stock(title: str) -> int: """Return how many copies of a book Riverside Books has in stock.""" return {"Dune": 3, "Circe": 0}.get(title, 0)model = init_chat_model("google_genai:gemini-flash-lite-latest", temperature=0)reply = model.bind_tools([check_stock]).invoke("Do you have Dune and Circe in stock?")for call in reply.tool_calls: print(call["name"], call["args"], "id:", call["id"][:12] + "...")
Each tool call is a small dictionary. Name is the tool to run. Args is a dictionary of arguments, already parsed from the model's output. ID links the request to its result. And type is always tool call.