Mid

What is function calling (tool calling) in LLMs?

How to answer it in an AI engineer interview: what is being tested, a step-by-step framework, a sample answer and the mistakes to avoid.

$19.99 on Gumroad, instant download40% off with code EARLYBF until Nov 3, 11:59 PM PTEARLYBF: 40% off until Nov 3

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Practiced one out loud? Paste your answer into the free self-check and get a score in 30 seconds

What the interviewer is testing

Whether you understand who executes what in a tool-calling loop, and whether you know what makes tools easy for a model to use correctly and safely.

Answer framework

  1. Describe tools: give each a name, a description and JSON-schema parameters.
  2. The model decides: instead of text it returns a structured call with a tool name and arguments.
  3. Your code executes: validate the arguments, run the function, and send the result back as a tool message.
  4. The model continues: it uses the result to answer or makes another call.
  5. Quality and safety: clear descriptions, few overlapping tools, strict argument validation and permissions in code.

Sample answer

Function calling lets a model ask your application to run code. You send the model a list of tools, each with a name, a plain-language description of when to use it and a JSON schema for its parameters. When the model decides a tool is needed, it returns a structured call such as get_order_status with an order ID, rather than a text reply.

The model never executes anything itself. My code receives the call, validates the arguments against the schema and against business rules, checks that this user is allowed to perform the action, runs the function and sends the result back. The model then either answers or calls another tool.

Most quality problems come from the tool design. I keep the tool set small and non-overlapping, write descriptions that say when to use and when not to use each tool, use enums and clear parameter names, and return compact, structured results with useful error messages so the model can recover. For actions with side effects, such as refunds, I require confirmation outside the model.

Likely follow-ups

How is function calling different from MCP? Function calling is the model-side format for requesting a call; MCP is a protocol for exposing and discovering tools across applications.

Common mistakes

The PlaybookWant the full method?

The 0 to 1 AI Engineer Interview Playbook covers the answer frameworks, system-design walkthroughs and an 8-week plan.

Get the playbook 40% off with code EARLYBF until Nov 3, 11:59 PM PTEARLYBF: 40% off until Nov 3

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Interviewing for PM or TPM? See the full PM package, $59 on Gumroad: a resume system, a PM, TPM and PGM interview handbook, a 1:1 cheat sheet and a PM playbook. PM and TPM content, not AI engineer prep.

Related questions

Based on question #20, #44 in the full question bank.