Skip to content

Tool Use / Function Calling

Tool use or function calling allows an AI model to request defined external functions that retrieve information or perform actions outside the model itself.

Tool use, sometimes called function calling, allows an AI model to request that an application perform a defined external operation.

It connects model reasoning with real data or actions outside the model itself.

OpenAI describes function calling as a way for models to interface with external systems and access data or functionality provided by an application. OpenAI function-calling guide

What a Tool Can Do

Tools might allow a model to:

  • Search a website
  • Query an API
  • Retrieve account details
  • Check inventory
  • Create a CRM record
  • Run code
  • Retrieve documents
  • Send a message
  • Look up current information

The application defines what tools are available.

How It Works

A simplified function-calling flow looks like:

User asks question
      ↓
Model decides tool is needed
      ↓
Model requests tool call
      ↓
Application executes function
      ↓
Result returned to model
      ↓
Model produces final response

The model does not necessarily execute the external action itself.

It can request the action through the surrounding application.

Tool Use vs. API

An API is an interface exposed by a system.

Tool use is the mechanism that lets an AI model select or request a function.

The function may then call an API.

For example:

AI tool:
get_customer_orders

      ↓

Commerce API

Why It Matters

Tools let AI systems work with:

  • Current information
  • Private information
  • Business systems
  • Actions

rather than relying only on model training.

They are therefore fundamental to many AI Agents.

Security Considerations

Tool permissions should be deliberately limited.

A system may allow:

Read customer order status

without allowing:

Refund any order.

Authentication, Authorization, API credentials, and Human-in-the-Loop controls remain important.

Common Problems

Common problems include:

  • Too many tools
  • Ambiguous tool descriptions
  • Model chooses wrong action
  • Tool arguments not validated
  • Tool failure ignored
  • Prompt Injection influencing tool selection
  • Read-only use case given write permissions
  • Irreversible actions happen without approval

How to Improve

Make tools:

  • Narrow
  • Clearly described
  • Validated
  • Permission-limited
  • Observable

Keep critical business rules in deterministic application code rather than relying on the model to remember them.