← Blog

Claude API Tool Use: 7 Real-World Examples

2026-11-12 · 5 min read · SubToAPI Team

What Claude API tool use actually looks like in production

If you're searching for "claude api tool use real world examples," you're probably past the documentation stage and want to see what actual tool definitions look like for things people build — not just the toy "get_weather" demo. Tool use (also called function calling) lets Claude decide when it needs external data or an action performed, call a function you define with structured arguments, and then use the result to finish its answer. The model never executes code itself — your application runs the function and sends the result back.

Below are seven tool definitions pulled from patterns that show up repeatedly in production apps, along with the request/response flow for each. They're deliberately varied so you can see how the same mechanism handles lookups, calculations, mutations, and multi-step workflows.

1. Order status lookup (customer support)

The most common tool use case: a support bot that needs real data instead of guessing.

{
  "name": "get_order_status",
  "description": "Retrieve the current status and tracking info for a customer order",
  "input_schema": {
    "type": "object",
    "properties": {
      "order_id": { "type": "string", "description": "The order ID, e.g. ORD-48213" }
    },
    "required": ["order_id"]
  }
}

A user says "where's my order ORD-48213?" and Claude returns a tool_use block with {"order_id": "ORD-48213"}. Your backend hits the orders table, returns JSON, and Claude turns it into a natural answer like "Your order shipped yesterday and should arrive Thursday."

2. Precise calculations

LLMs are bad at arithmetic on large numbers. Give Claude a calculator tool instead of trusting it to multiply in its head.

{
  "name": "calculate",
  "description": "Evaluate a mathematical expression and return the numeric result",
  "input_schema": {
    "type": "object",
    "properties": {
      "expression": { "type": "string", "description": "A math expression, e.g. (1500 * 1.0825) / 12" }
    },
    "required": ["expression"]
  }
}

This is useful for invoice generators, pricing tools, and anything involving tax, interest, or unit conversion — domains where "approximately right" isn't good enough.

3. Internal database queries

Instead of giving Claude raw SQL access, expose a narrow, safe function:

{
  "name": "query_inventory",
  "description": "Check current stock level for a product SKU across warehouses",
  "input_schema": {
    "type": "object",
    "properties": {
      "sku": { "type": "string" },
      "warehouse": { "type": "string", "enum": ["east", "west", "all"] }
    },
    "required": ["sku"]
  }
}

This pattern — one tool per well-defined business query — scales better than trying to give Claude a generic "run_sql" tool, which is harder to secure and audit.

4. Scheduling and calendar actions

Tool use isn't limited to reads. A scheduling assistant might expose:

{
  "name": "create_calendar_event",
  "description": "Create a calendar event for the authenticated user",
  "input_schema": {
    "type": "object",
    "properties": {
      "title": { "type": "string" },
      "start_time": { "type": "string", "description": "ISO 8601 datetime" },
      "duration_minutes": { "type": "integer" },
      "attendees": { "type": "array", "items": { "type": "string" } }
    },
    "required": ["title", "start_time", "duration_minutes"]
  }
}

Because the model fills in structured fields, you get a clean event object without regex-parsing free text like "set up a 30 minute call with Dana next Tuesday afternoon."

5. Currency and unit conversion

Useful for e-commerce and travel apps serving multiple regions:

{
  "name": "convert_currency",
  "description": "Convert an amount from one currency to another using live exchange rates",
  "input_schema": {
    "type": "object",
    "properties": {
      "amount": { "type": "number" },
      "from_currency": { "type": "string" },
      "to_currency": { "type": "string" }
    },
    "required": ["amount", "from_currency", "to_currency"]
  }
}

6. Ticket creation in a workflow

A classic multi-step example: a user reports a bug in chat, Claude recognizes it needs escalation, and calls a tool to open a ticket:

{
  "name": "create_support_ticket",
  "description": "Open a new support ticket with a category and priority",
  "input_schema": {
    "type": "object",
    "properties": {
      "summary": { "type": "string" },
      "category": { "type": "string", "enum": ["billing", "bug", "feature_request", "other"] },
      "priority": { "type": "string", "enum": ["low", "medium", "high", "urgent"] }
    },
    "required": ["summary", "category", "priority"]
  }
}

This is where tool use becomes genuinely valuable over plain chat: Claude isn't just answering, it's triggering a real side effect in another system.

7. Chained tools in one conversation

Real workflows often need more than one tool call per turn. A travel assistant might call search_flights, then check_loyalty_points, then book_flight — each building on the previous result. The API supports this naturally: you keep sending tool_result messages back, and Claude keeps issuing new tool_use blocks until it has what it needs to finish.

Putting it together

Here's the basic request shape, regardless of which tool you're using:

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4",
    "max_tokens": 1024,
    "tools": [ /* your tool definitions */ ],
    "messages": [
      { "role": "user", "content": "Check stock for SKU-9921 in the west warehouse" }
    ]
  }'

Claude responds with a tool_use content block instead of plain text. Your server executes the function, then sends a follow-up message with a tool_result block containing the output, role user. Claude reads that result and produces the final natural-language response.

If you're routing this through SubToAPI, the flow is identical to calling the Anthropic API directly — same message and tool schema — but you authenticate with a sub_live_ key instead of managing Claude credentials per environment, and usage across all your tool-calling apps shows up in one dashboard. See the tool use docs and the quickstart for the full request/response reference, including how streaming interacts with tool calls (/docs/streaming).

A few practical lessons from these patterns

FAQ

Does Claude execute the tool code itself? No. Claude only decides which tool to call and with what arguments. Your application is responsible for actually running the function and returning the result.

Can one response trigger multiple tool calls? Yes. Claude can request several tools in sequence within a conversation, chaining results — for example looking up inventory before creating an order.

Do I need a different setup to use tools through SubToAPI versus the direct Anthropic API? No — the tools array and message format are the same. You just authenticate against https://api.subtoapi.app/v1/messages with your sub_live_ key; see /docs/messages and /pricing for plan details.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →