Designing safe tools
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
design tools that are hard to misuse.
Planned topics
- Narrow scope:
get_order_status(orderId), notrun_sql(query)orcall_any_api(url). - Typed, constrained parameters: enums, ranges, patterns; reject everything else.
- Idempotency: the same call twice has the same effect.
- Clear error results ("not found", "not allowed") so the model can explain, without leaking internals.
- Return only the fields the answer needs.
Draft outline details
Demonstration
record OrderStatusArgs(@Positive long orderId) {}
// result: {status:"SHIPPED", eta:"2026-11-02"} or {error:"NOT_FOUND"}Check your understanding
Why is run_sql a bad tool?
Show answer
It is unbounded; one bad argument reads or destroys anything.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.