Skip to content

Concepts / Field notes

What is Function Calling?

Learn how function calling enables LLMs to use external tools and APIs. Understand structured outputs and tool use patterns.

By DriftRail · Updated

Function calling allows LLMs to output structured data that triggers external functions. Instead of just generating text, the model can request specific actions like API calls or database queries.

How It Works

  1. 1. Define available functions with schemas
  2. 2. LLM decides when to call functions
  3. 3. Model outputs structured function call
  4. 4. Your code executes the function
  5. 5. Result returned to LLM for response

Security Considerations

  • Validate all function parameters
  • Limit function permissions
  • Log all function calls
  • Watch for injection through parameters

Is function calling safe?

Function calling itself is safe, but the functions you expose may not be. Treat LLM-generated parameters as untrusted input.

Practical example

A model proposes an order-lookup call, and the application validates its arguments and the user’s access before running it.

What to check

Test missing fields, unexpected values, unauthorized identifiers, tool errors, and duplicate requests.

Limits and tradeoffs

A tool schema constrains argument shape; it does not authorize an action or establish that a value is correct.

Maintained by DriftRail. AI assisted the October 2026 content and template revision. Examples are illustrative; they are not measured product benchmarks. Suggest a correction.

From understanding to evidence

Observe your AI in production.

Explore event logging, detections, and review workflows in DriftRail.

Open DriftRail ↗Read the documentation →