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.

Stuck? AI Nudge Available

Get a conceptual hint to guide your logic without spoiling the final implementation.

03

Study the solution

The solution is waiting

Give it an honest attempt first — then compare your thinking with the full walkthrough.

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.