Deep dive · module 73 of 100
Tools and function calling
Understand how AI can call external tools.
After this lesson
You can explain what function calling is and when it is useful.
In view · Step by step
A tool call makes a detour
For example, performing a calculation with clearly named inputs.
The application validates the call and lets the allowed tool calculate.
The tool result goes back to the model and is used in a controlled manner.
Part 1 of 3 · Model proposes a call
Your preference for less movement is on. Choose each part yourself.
What is function calling?
The model can call an external tool (for example, a calculator, search function, or database) and use the result.
When is it useful?
For exact calculations, real-time data, or actions in other systems.
Control remains necessary
The model chooses which tool to call. Check whether the correct tool was used and whether the result is correct.
New practice example
From explanation to a usable result.
When using tools, a model makes a proposal for a function call; the application must check the input and authority.
Fictional practice situationA fictitious assistant proposes a calendar call with a duration of 30 minutes, but without a date. The application should only execute complete proposals after agreement.
View a possible solution
This is how it can be done
Validate the mandatory fields and first ask for the missing date. Show the full proposal for verification. A text like “appointment made” is not proof: you must read the actual calendar outcome for that.
Why this works
A function with a neat name is not yet a safe action. Validation, permission, and outcome checking belong in the application.
Make it slightly more difficult
Have the tool return a time-out. Which status do you show before you decide, as retrying could cause a duplicate appointment?
Extra practice, at your own pace. You do not need to submit anything. This does not count towards an automatic assessment.
Your workplace · learning by doing
Make something. See what changes.

Checking the AI connection… You can already view the written example.

Present your assignment to Ende.
Read the answer, change one thing, and compare.
Previously held
New version
You remain in control
What do you want to improve in your next attempt?
On this device only. AI answers remain only in this page memory. This is self-review, not a grade.
Why this approach works
A function with a neat name is not yet a safe action. Validation, permission, and outcome checking belong in the application.
A step further
Have the tool return a time-out. Which status do you show before you decide, as retrying could cause a duplicate appointment?
Try & discover · no obligation
Control an agent with a control port
Try to send before the check. Then also test a missing source or a malfunction.
- Retrieve source
- Check draft
- Execute action
What is happening?
- No source has been retrieved yet. Feel free to try the submit button first.
All tools, queues and submissions have been simulated. No message is sent and no external service is called.
This trial works locally with fictitious data and does not count towards your lesson completion. It starts anew with a new lesson or reload.
A prompt to get you started
Briefly explain what function calling is and give one example where it is more useful than just generating text.
Apply it
A model requests to call a tool to change data. The proposal contains an unknown dossier ID.
Which approach best fits this situation?
- Execute every tool call automatically.
- Validate arguments and permissions before the tool executes anything.
- Let the model determine for itself which access rights it receives.
With JavaScript, you can check your approach and receive immediate feedback.
Test your insight
What is function calling?
- The model can call external tools and use their results.
- A way to make prompts longer.
- Only for programmers.
Extra practice
Name a task where an external tool (calculator, search function, database) is more useful than a language model alone.
An exact calculation or looking up current stock levels.

