Skip to solution
mediumAI Engineering

How do you design good tool definitions for an LLM?

382 views
01

Understand the problem

Tool ergonomics: names, descriptions, parameter design and error messages the model can act on.

tool-designfunction-callingschemasagents
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Nudge consolestandby

Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.

03

Study the solution

Treat the model as the API consumer: give tools verb-object names, descriptions that say when to use (and not use) them, few and well-typed parameters with enums over free strings, and defaults for everything optional. Return results the model can reason about — concise, structured, with actionable error messages ('dat

Solution ready — 2 min read

Classified // press E to declassify

04

Read the code

A well-shaped tool definition
{
  name: "search_orders",
  description:
    "Search a customer's orders by status and date range. Use for questions " +
    "about order history or delivery status. NOT for refunds (create_refund) " +
    "or catalog items (search_products). Max range: 90 days.",
  input_schema: {
    type: "object",
    properties: {
      customer_id: { type: "string", description: "UUID from the session context" },
      status: { type: "string", enum: ["open", "shipped", "delivered", "returned"] },
      from_date: { type: "string", format: "date" },
      to_date:   { type: "string", format: "date" },
    },
    required: ["customer_id"],
  },
}
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.

Transmission complete // awaiting log

KEEP THE
STREAK ALIVE.

Dossier 45 of 80 decoded in the AI Engineering track. One more won't hurt.

Back to track