Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Claude
  • CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
  • Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
  • One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
  • Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
  • Hooks That Block Destructive Actions: a PreToolUse Gate That Allows, Asks or Denies
  • Choosing a Claude Code Extension: Skill, Hook, Rules File, Subagent, Slash Command or Plugin
  • Rolling Out Claude Code to a Team: Settings Precedence, dontAsk in CI, a Hook for Every-Time Rules and a Plugin for Five Repos
  • A Claude Code Review Bot in CI: Headless -p, JSON Findings, Team Rules in Git and a Person on the Merge
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Configuring MCP Servers in Claude Code: A Command or a URL, Three Scopes, and Three Moves When One Breaks
  • The Claude Messages API: Your First Call, Field by Field
  • Claude Tool Use: How tool_use and tool_result Work in the Messages API
  • Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
  • Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
  • Claude Streaming Events: The Event Order, message_stop, Tool Arguments, Stop Reasons and a WebSocket Relay
  • Images, PDFs and Thinking Blocks in the Claude Messages API: Typed Blocks In, Typed Blocks Out
  • Getting Data Into Claude: PDF Documents, the Files API, Search Results and Citations
  • Opus, Sonnet or Haiku: Pick the Claude Model per Job, and Test the Request When a New Release Arrives
  • Adaptive Thinking and Effort in Claude: Two Dials, Set per Workload, and the Thinking Block You Must Pass Back
  • Claude Cost Tracking From usage: Count Before, Cap During, Read After, Then Find the Line That Drives the Bill
  • Claude Cache Breakpoints: Where to Put cache_control, How to Move It With the Chat, and Why the Reads Stay at Zero
  • Claude Message Batches or Real Time: Choose by Who Is Waiting, Match by custom_id, Resend Only the Failures
  • Calling Claude Through Amazon Bedrock, Google Cloud and Microsoft Foundry: Same Call, Different Door
  • The Life Cycle of a Claude App: Six Phases, a Model That Retires, and a Release Gate for Every Change
  • Pinning Claude Model IDs and Upgrading Safely: One Change at a Time, a Golden-Set Replay and a Staged Rollout
  • Content Boundaries and Schema Design for Claude: Fence the Input in a Tag, Let the Output Say I Don't Know
  • The Agentic Loop and stop_reason: Keep Turning on tool_use, Stop on end_turn, Cap the Turns
  • The Claude Agent SDK: query(), ClaudeAgentOptions and @tool, in Python and TypeScript
  • Fix the Agent: Four Broken Claude Agent SDK Configs, From the Symptom to the One Wrong Line
  • Claude Managed Agents: Cloud Sandbox, Self-Hosted Sandbox or Self-Hosted Service
  • Agent SDK Hooks for Deterministic Actions: PreToolUse, PostToolUse, and Four Hooks That Fail Silently
  • Memory and Context-Window Patterns for Claude Agents: Context Editing, Compaction and the Memory Tool
  • Reading an Agent Trace: Five Signatures, Five Missing Patterns, and How Long a Fact Must Live
  • Tool Descriptions for Claude: How Claude Picks a Tool, and How to Stop It Picking the Wrong One
  • Tool Input Schemas and Error Responses for Claude: Required Fields, Enums, is_error and a Retry Flag
  • Tool Response Shaping and a Lean Tool Set: Give Claude a Sticky Note, Not the Filing Cabinet
  • Fix the Tool Schema: Read the Trace, Fix the Card, Re-Run (Four Real Schema Bugs)
  • Client Tools, Server Tools and Approval Gates: Who Runs the Tool, and Who Says Yes First
  • Built-in Tool, Custom Tool, Skill or MCP Server? Pick the Lightest One That Fits
  • System Prompt or User Turn: Where Each Instruction Goes, and Output Limits Your Code Enforces
  • Refine the Prompt One Line at a Time, Then Clean and Fence the Customer's Text
  • Prompt Revision Driven by Evals: Name the Cause, Change One Thing, Rerun the Whole Suite
  • Long-Running Sessions: Compact, Prune, Isolate or Start Fresh, Decided by Naming the Failure
  • Context Isolation Through Subagents: Read the Logs Elsewhere, Keep One Line
  • Defensive Parsing of Claude Replies: Check the Stop Reason, Read the Block or the Text, Then Validate the Values
  • Full Context or Retrieval: Choose by Corpus Size, Cost and Freshness
  • Skepticism Toward Confident Output: Check the Quote, the Record and the Sum Before You Send
  • Debugging a Claude App: Three Error Types, the Recovery Each One Earns, and the First Failing Row
  • Six Ways a 200 Can Still Be Wrong: Hallucination, Refusal, Under-Acting, Context Loss, Format Drift and Inconsistency
  • Fix the Cause, Not the Symptom: Four Recovery Drills for an LLM App, Each Checked on a New Input
  • Integration Layer or Model Output? Three Taps and Three Questions to Find Where a Wrong Answer Lives
  • Which Test Layer Owns the Failure? Unit, Functional, Integration and End-to-End Tests for a Claude App
  • Designing an Overnight Document Pipeline on Claude: Batch Lane, Live Lane, a Cached Prefix and a custom_id Reconcile
  • Proving a Model Upgrade Is Ready: A Frozen Golden Set, a Calibrated Judge, the Right Layer and a Release Gate
  • From Requirement to Design for a Claude App: Eight Requirements, Five Elements and a Trace With No Gaps
  • Build a Claude Refund App: the Messages API, Two Tools, an MCP Server and a Hook in One Loop
  • Ship a Claude App: an Eval Gate, Two Guardrail Layers, a Cost Check From usage and a Pinned Model
  • Lab: a 30-Case Golden Set, a Calibrated Judge and a Per-Slice CI Gate on a Claude Refund App
  • Lab: Cut a Claude App's Bill by 62 Percent With Usage Data, Layered Cache Breakpoints and a Batch Job
  • Lab: Three Planted Bugs in a Claude App, a Vague Prompt, a Mistyped Tool Schema and a Broken Stream Handler
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Lab: Harden a Claude App, an Uncalibrated Judge, a Retry Loop That Retries Everything and a Hook Matcher With a Gap
  • Lab: Turn a Claude App Into a Reusable Template, One Pinned Model Id, No Key in Code and Evals Built From Data
  • Building an MCP Server: Tools, Resources and Prompts in Python and TypeScript
  • MCP Transports: stdio or Streamable HTTP, and Who Starts the Server
  • Deploying and Authenticating an MCP Server: Environment Keys for stdio, Bearer Tokens and Scopes for HTTP
  1. Blog
  2. /
  3. Claude
  4. /
  5. Building with the Claude API

Tool Descriptions for Claude: How Claude Picks a Tool, and How to Stop It Picking the Wrong One

Claude picks a tool by reading its name, description and input schema. Two support tools, written once vaguely and once properly, show how a purpose, an input format, an example and a 'Not for' boundary fix the wrong pick.

Chaand Sheikh

·27 November 2026Building with the Claude API

What you will learn

  • Explain what Claude reads when it chooses between tools
  • Write a tool description with a purpose, an input format, an example and a boundary
  • Fix misrouting between two overlapping tools
  • Spot a system prompt sentence that pulls the pick to the wrong tool

Before you start

  • Claude tool use: tool_use and tool_result
  • Basic Python dictionaries

A customer writes: find Maya's order, here is her email. Our support agent has two search tools, search_orders and search_customers. It sends the email to search_orders and finds nothing.

Notice that nothing crashed. The tool worked. The pick was wrong, and search_customers would have found Maya straight away. In this article we look at how Claude makes that pick, and how a few sentences of text fix it.

Two doors, one sign each

Think of a hospital corridor. A patient needs an X-ray and holds a referral. There are two doors, and both say Office. The patient has to guess.

Now change the signs. One says X-ray, bring your referral, not for blood tests. The other says Blood tests, bring your ID, not for X-rays. The patient walks straight to the right door.

To Claude, a tool description is the sign on the door.

What Claude actually sees

Claude never sees your Python function. That stays on your side. For each tool it sees a small card with three parts: the name, the description and the input schema. It compares the request with every card and picks one.

What Claude reads to pick a tool Your code search_orders() search_customers() Claude never sees this The tool card name description the part to improve input_schema Claude compares the request with every card
Claude chooses from the card, never from your code. The description is the part you can improve most.

The round trip itself (your app sends the tools, Claude replies with a tool_use block, your code runs the function and sends a tool_result back) is covered in Claude tool use: tool_use and tool_result. Here we stay with the card, because everything Claude asks for starts from it.

The four parts of a good description

  1. What it does. Finds one order by its order id, and what it returns.
  2. The input format. An order id such as 1042.
  3. An example query. Just 1042.
  4. When not to use it. For emails, use search_customers. This is the part that matters most, because it stops the neighbour tool being picked by mistake.

The Claude docs advise very detailed descriptions, at least three to four sentences per tool.

The vague tools and the clear tools

Here are the two tools written the lazy way, in tools_vague.py:

SCHEMA = {
    "type": "object",
    "properties": {"query": {"type": "string"}},
    "required": ["query"],
}

TOOLS = [
    {"name": "search_orders",
     "description": "Searches orders.",
     "input_schema": SCHEMA},
    {"name": "search_customers",
     "description": "Searches customers.",
     "input_schema": SCHEMA},
]

And the same two tools written properly, in tools_clear.py. The schema is identical; only the words change:

TOOLS = [
    {
        "name": "search_orders",
        "description": (
            "Finds one order by its order id. "
            "Returns item and shipping status. "
            "Input: an order id such as 1042. "
            "Example query: 1042. "
            "Not for emails: use search_customers."
        ),
        "input_schema": SCHEMA,
    },
    {
        "name": "search_customers",
        "description": (
            "Finds a customer by email, name or phone. "
            "Input: text such as [email protected]. "
            "Example query: [email protected]. "
            "Not for order ids: use search_orders."
        ),
        "input_schema": SCHEMA,
    },
]

Each description says what the tool does and returns, gives the input format and an example, and ends with a boundary that names the other tool.

Run it: four questions, vague against clear

The lesson project runs without an API key. pick.py is a stand-in for the model: it imitates the choice by counting words a message shares with each description, and words after "Not for" count against a tool. Real Claude reads meaning, not shared words. The stand-in only shows why the text matters. Here is the core of the file (it also has a small words() helper that lower-cases the text and drops stop words):

MESSAGES = [
    ("Where is order 1042?", "search_orders"),
    ("Who owns the email [email protected]?", "search_customers"),
    ("What shipped with order 1042?", "search_orders"),
    ("What is the phone number for Maya?", "search_customers"),
]


def score(message, description):
    use, _, avoid = description.partition("Not for")
    mine = words(message)
    return len(mine & words(use)) - len(mine & words(avoid))


def pick(message, tools):  # a tie goes to the first tool listed
    best = max(tools, key=lambda t: score(message, t["description"]))
    return best["name"]

The output of python pick.py:

test model reply: stand-in picks, no API key
Q: Where is order 1042?
   vague -> search_orders (right)
   clear -> search_orders (right)
Q: Who owns the email maya@example.com?
   vague -> search_orders (wrong)
   clear -> search_customers (right)
Q: What shipped with order 1042?
   vague -> search_orders (right)
   clear -> search_orders (right)
Q: What is the phone number for Maya?
   vague -> search_orders (wrong)
   clear -> search_customers (right)
right picks: vague 2/4, clear 4/4

With the vague text, the email question and the phone question both went to search_orders. With the clear text, all four picks are right. Real Claude is far better at reading than a word counter, but it still has only your name, your description and your schema to go on.

The trap outside the tools: the system prompt

Good descriptions can still be outvoted. Suppose the system prompt says always search orders first, and a user asks who owns [email protected]? That one keyword, "orders", can pull the pick to search_orders.

The fix is plain wording in the system prompt: for order ids, use search_orders; for emails and names, use search_customers. When you review tools, review the system prompt with them.

Break it: two tools with the same job

Overlap makes the model guess. Take these two:

  • get_order_status: looks up an order.
  • lookup_order: finds an order.

Same job, same words. Ask where is order 1042? and the choice can change from one turn to the next, because nothing on the cards separates them.

The fix is to give them different jobs with clear boundaries: get_order_status handles one order by id, and list_customer_orders handles all orders of one customer id. Each says what it is not for. Rename, split the job, and state the boundary.

Common mistakes

MistakeWhat happensFix
One-line descriptionsSimilar tools look the same, so the wrong one gets calledPurpose, input format, example, boundary
Two tools with overlapping jobsThe pick changes between turnsRename and split into purpose-specific tools
A keyword-heavy system promptOne word outvotes good descriptionsSay which tool handles which input
Fixing misrouting with more code firstCostly, and the card is still unclearSharpen the words the model reads first

Quick recap

Part of the cardWhat it does for the pick
NameShort and specific to the job
Description: purposeWhat the tool does and returns
Description: format and exampleGets the input right
Description: boundary"Not for this, use that tool" stops the neighbour being picked
Input schemaThe shape of the call (covered in input schemas and error responses)

For an exam-style scenario with two tools such as find_record and search_record and the wrong one being called, the first fix is the cheap one: sharpen the descriptions, then check the system prompt.

Try it yourself

Add a third question to MESSAGES, such as Which orders did Maya place?, and decide which tool should answer it. Does either description cover it? If not, write the boundary sentence that would.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in Claude · 34 of 66

Previous
Reading an Agent Trace: Five Signatures, Five Missing Patterns, and How Long a Fact Must Live
Next post
Tool Input Schemas and Error Responses for Claude: Required Fields, Enums, is_error and a Retry Flag

Related course on Udemy

Claude Certified Developer - Foundations (CCDV-F) Exam Prep

Build and ship Claude apps: the API, agents, tools and MCP, prompts, evals, security and model choice.View on Udemy ↗: Claude Certified Developer - Foundations (CCDV-F) Exam Prep (paid course, opens in a new tab)

Related posts

The Claude Messages API: Your First Call, Field by Field

One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.

Claude Tool Use: How tool_use and tool_result Work in the Messages API

Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.

Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared

Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.

Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move

Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.

On this page

  • Two doors, one sign each
  • What Claude actually sees
  • The four parts of a good description
  • The vague tools and the clear tools
  • Run it: four questions, vague against clear
  • The trap outside the tools: the system prompt
  • Break it: two tools with the same job
  • Common mistakes
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

Claude Certified Developer - Foundations (CCDV-F) Exam Prep

Build and ship Claude apps: the API, agents, tools and MCP, prompts, evals, security and model choice.View on Udemy ↗: Claude Certified Developer - Foundations (CCDV-F) Exam Prep (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact usFAQs
Legal
Terms of ServicePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.