Skip to content
AI & Machine Learning

Tool Use (Function Calling)

Definition

Tool use, also called function calling, lets a language model ask the application to run a defined function, such as a search, a database query or a calculation, and then use the result in its answer. The model chooses the tool and its inputs; the application runs it.

How a tool call works

  1. Describe the toolsThe app tells the model each tool's name, purpose and inputs.
  2. The model asksIt replies with a structured request to call a tool, instead of an answer.
  3. The app runs itThe app checks the request, calls the real system and returns the result.
  4. The model answersIt writes its reply from the result, or asks for another tool.

Diagram

  1. Person

    Where is my order 1042?

  2. Model → app
    call get_order_status
    { "order_id": "1042" }

    Not an answer yet: a structured request

  3. App → model
    { "status": "shipped",
      "carrier": "DHL", "eta": "Thursday" }

    The app ran the real lookup

  4. Model → person

    It shipped with DHL and should arrive on Thursday.

The model never touches the order system: it only asks, and the app decides whether to run the request. That is where to check permissions, validate inputs and ask a person before anything costly or irreversible.

Case study

Worked example