Skip to content
mentoor

Topic 1 of 6 · 4 min read

Tool names, descriptions and parameter schemas

Goal: Rewrite a vague tool definition so its name, description and parameter schema leave no doubt about when and how to call it.

An agent can only use a tool as well as its definition explains it, so write the name, description and schema for a reader who has never seen your system. The model never sees your code. It sees a name, a paragraph and a JSON schema, and it chooses from those alone.

Check yourself · 1 of 3

A tool called search has the description "Searches things." What is the main risk?

Choose one answer

Why it matters

Most "the agent called the wrong tool" bugs are definition bugs. Two tools called search and find with one-line descriptions look identical to a model, so it guesses. A parameter named id could be a user id, an order id or a ticket id. A free-text status field invites "done", "Done" and "completed".

How to do it

  1. Name for the task, with a prefix when tools overlap. jira_search_issues and jira_create_issue sort together and say what system they touch.
  2. Describe when to use it, and when not to. Say what it returns, what it needs first and which sibling tool to use instead. Write it as you would brief a new colleague.
  3. Make parameters unambiguous. Use user_email, not user. Say the format ("ISO 8601 date, for example 2026-03-14").
  4. Constrain with the schema. Use enum for closed sets, required for must-haves, minimum and maximum for ranges. A schema that rejects bad input beats a prompt that asks nicely.
  5. Add one or two examples of realistic calls when the input shape is not obvious.

Before and after

{
  "name": "search",
  "description": "Searches things.",
  "input_schema": {
    "type": "object",
    "properties": { "q": { "type": "string" }, "status": { "type": "string" } }
  }
}

The agent cannot tell what is searched, what q accepts or which statuses exist. The fixed version:

{
  "name": "tickets_search",
  "description": "Search support tickets by keyword. Use this to find existing tickets before creating a new one. Returns up to 20 matches with id, title and status. To read one ticket in full, call tickets_get.",
  "input_schema": {
    "type": "object",
    "properties": {
      "query": { "type": "string", "description": "Keywords from the ticket title or body" },
      "status": { "type": "string", "enum": ["open", "pending", "closed"] }
    },
    "required": ["query"]
  }
}

What goes wrong

  • Overlap. Two tools whose descriptions could both fit the request. The model picks one at random and the choice flips between runs.
  • Hidden rules. "Dates must be in the past" lives in your code but not in the description, so the agent retries blindly.
  • Instruction creep. Putting a whole workflow in one description. Keep that in the system prompt; keep the description about this tool.

Examples

Disambiguating two similar tools

A support agent has get_customer and lookup_customer. Both say "Gets customer info". Runs show it calling the wrong one about half the time.

Rewrite: customer_get_by_id ("Fetch one customer by exact id. Use when you already have an id from another tool result") and customer_search ("Find customers by name or email when you do not have an id. Returns up to 10 matches"). The names now carry the difference and each description names the other.

Constraining a free-text field

"priority": { "type": "string", "enum": ["low", "normal", "urgent"], "description": "Use urgent only for outages affecting customers" }

Before this change the agent sent "high", "P1" and "ASAP", and the API rejected two of three. With the enum, the model sees the valid values and picks one.

Key points

  • The model sees only the name, description and schema, so those carry all the usage knowledge.
  • A good description says what the tool does, when to use it, what it returns and which tool to use instead.
  • Specific parameter names (user_email) and stated formats remove guessing that id or date leaves open.
  • Use enum, required and numeric bounds in the schema so bad input is rejected instead of discouraged.
  • Prefix related tools (jira_search_issues) so overlapping tools stay distinguishable.

Common mistakes

  • Writing a one-line description that restates the tool name instead of saying when to use it.
  • Naming parameters id, data or value so the agent has to guess what goes in them.
  • Leaving closed sets as free-text strings and hoping the prompt keeps values consistent.
  • Shipping several tools with overlapping purposes and no note on which to prefer.

Check yourself · 2 of 3

A tool takes a status parameter with exactly three valid values. What is the most reliable way to make the agent send one of them?

Choose one answer

Check yourself · 3 of 3

Which pair of tool names is easiest for an agent to choose between correctly?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic