Tools and protocols / 1 of 8
Function calling
What you’ll learn
- Explain the main idea of “Function calling” in your own words.
- Trace a concrete example and identify the assumptions behind it.
- Apply the principle in a practice problem and recognize a common failure.
The idea, intuitively
Function calling lets a model propose a structured request to an application-defined function. The proposal is data. The application validates it and decides whether execution is authorized; the model does not automatically acquire permission.
An agent can only act through the capabilities an application exposes. Model-generated plans and tool calls are proposals that require validation. Keep the user’s actual goal and authorization visible throughout the loop. More autonomy increases the importance of explicit boundaries, inspectable state, and meaningful stopping conditions.
Under the hood
Define a tool name, argument schema, and result contract. Validate types, allowed ranges, and resource identifiers. Separate read-only operations from actions that modify external state.
Schema-valid arguments can still request an unauthorized action.
A worked example
A weather function might accept a location and return a forecast. A transfer-money function requires a much stronger authorization boundary.
For a weather request, the model might propose a forecast lookup for Bandung. The application checks that the location is valid and that this read-only tool is allowed, then calls the forecast service. If the service has no data, return that outcome explicitly so the model can tell the learner that the forecast is unavailable.
How to use this way of thinking
Write the goal, allowed data, permitted actions, and maximum budget before designing the loop. Make each action auditable and distinguish failed, completed, and unknown outcomes. When approval is needed, show the concrete action and its consequences rather than asking for blanket permission.
Try it yourself
List checks for a tool that deletes a file.
Key takeaways
- The application or tool boundary
- Schema-valid arguments can still request an unauthorized action.
- Check the assumptions with a small example before applying this idea to a larger system.
Check your understanding
Use feedback to learn. Quiz scores and lesson completion are tracked separately.
Go to lesson completionFurther reading
Original papers and reference material for this school. External resources may be in English and require internet access.
MCP architecture overview (opens a new tab)OWASP: LLM prompt injection prevention (opens a new tab)Finish this lesson
Mark this lesson complete when you’re ready to continue.