IamBishal

Tool Shape Benchmark: Endpoint Wrappers vs Task-Shaped MCP Tools

I put my own article's claim through 360 agent runs. Half of it held up, and the half that didn't taught me more.

Same agent, same 30 support tasks, same backend, two MCP tool designs. Task-shaped tools halved tool calls and tokens. Endpoint wrappers were the more accurate design.

fewer tool calls with task-shaped tools
~50%
cheaper per correct answer (Haiku)
2.6×
accuracy with endpoint wrappers
100%
agent runs
360
  • Experiment
  • 5 min read
  • Evals & AgentOps
  • AI Agents
  • Python
  • MCP
  • Claude
  • Evaluations
Figure 1. Task success rate

Overview

In "Stop Wrapping Endpoints as Tools" I argued that agents work better with a few tools shaped around the job than with one tool per REST endpoint. That was an argument from experience. This experiment puts numbers on it, and I wrote the hypothesis down before the first live run so the results could prove me wrong: task-shaped tools give a higher success rate with fewer tool calls and fewer tokens, and the gap is wider on a smaller model.

The setup keeps everything equal except the tools. Both MCP servers sit on the same client for the Kestrel Outfitters mock API from my Agentic AI book series, so neither can see data the other can't. The endpoint server has 8 tools, one per route, returning raw JSON, with careful descriptions: a good wrapper, not a strawman. The task server has 5 tools (order status, return eligibility, ticket context, stock check, policy) that join records and apply the business rules in code. One agent loop runs both: the same system prompt, a 12-turn cap and a circuit breaker.

The 30 tasks are customer-support questions in five families: delivery status, return eligibility and refund approval, ticket triage, stock and policy facts. Some carry traps, such as a trade customer's 14-day return window or an outdated shipping policy that still sits in the policy list. Ground truth comes straight from the dataset, never through either server, and the agent answers through a strict submit_answer tool, so grading is exact comparison in code with no LLM judge. Claude Haiku 5.5 and Claude Sonnet 5.5 each ran every task three times on both designs: 360 episodes for USD 0.95 in total.

The efficiency half held up clearly. Task-shaped tools cut tool calls by about half (2.9 to 1.5 on Haiku, 3.3 to 1.4 on Sonnet), input tokens by 50 to 60 percent, median latency by roughly a third, and the cost of a correct answer by 2.6x on Haiku and 1.5x on Sonnet.

The accuracy half did not. Endpoint wrappers scored 100 percent on both models; task-shaped tools scored 99 percent on Haiku and 93 percent on Sonnet. Every miss was on the same two tasks, the only orders still in transit. My order_status tool dropped the late flag for undelivered orders and just said the order was promised in 2025 and still on its way. Sonnet read that as overdue and answered late every time, while the endpoint tool showed the stored late: false and the model repeated it. A task-shaped tool decides what the agent gets to know, and when it leaves a fact out, the model fills the gap with its own reading.

The code, the raw episodes and a longer write-up are in the ai-lab-code repository. Anyone can re-run the whole matrix offline for free with a scripted fake model, or live for about a dollar.

Did it hold up?

Full results

The hypothesis, written down before the first run, and what the results said.

  1. Wrong

    Task-shaped tools give a higher task success rate than endpoint wrappers.

    Endpoint wrappers scored 100% on both models; task-shaped tools 99% on Haiku and 93% on Sonnet.

  2. Confirmed

    Task-shaped tools need fewer tool calls and fewer tokens.

    About half the tool calls (2.9 to 1.5 on Haiku, 3.3 to 1.4 on Sonnet) and 50 to 60% fewer input tokens.

  3. Partly

    The gap is wider on the smaller model.

    The cost gap was (2.6x cheaper per correct answer on Haiku, 1.5x on Sonnet); the accuracy gap wasn't.

What it does

  • Two MCP servers over one API client: 8 endpoint wrappers and 5 task-shaped tools
  • 30 customer-support tasks with ground truth computed from the dataset, not the servers
  • Exact grading in code through a strict submit_answer tool, no LLM judge
  • One agent loop for both designs: same prompt, 12-turn cap, circuit breaker
  • Spend control: an offline dry run, a cost estimate and a hard --max-usd stop
  • Resumable runs: every episode is appended to a JSONL log as it finishes
  • Every chart and table regenerates from the committed episodes with one command

How it's built

  1. Inputs

    • 30 support tasksGround truth computed from the data
    • Kestrel mock APISeed 2026, 2,000 orders, in-process
  2. Agent harness

    • Endpoint server8 tools, raw JSON
    • Task server5 tools, rules in code
    • One loopsame prompt, 12-turn cap
    • Circuit breaker on repeated failures
    • Haiku 5.5 and Sonnet 5.5, 3 repeats
  3. Outputs

    • Episode log360 JSONL rows
    • Code-only graderExact field comparison
    • Scorecard and chartsSuccess, calls, tokens, cost
servers/endpoints.py vs servers/tasks.py
# Endpoint wrapper: one tool per route, the record as stored.
@server.tool()
def get_order_shipment(order_id: str) -> str:
    """GET /orders/{order_id}/shipment. Returns the shipment for an order: shipment_id,
    carrier, warehouse, shipped_at, promised_by, delivered_at, status and late.
    404 if the order has not shipped."""
    return call(f"/orders/{order_id}/shipment")


# Task-shaped: joins order + shipment and answers in plain language.
@server.tool()
def order_status(order_id: str) -> str:
    """Everything about where an order is: order status and total, customer type,
    carrier, ship and promise dates, whether it was delivered and whether it was late
    (a lost parcel counts as late). Use this for any "where is my order" question."""
    order, shipment = order_and_shipment(order_id)
    return "\n".join(describe(order, shipment))


# From describe(): a parcel in transit gets no word on lateness, though the
# docstring above promises one. All 7 misses in the benchmark trace back here.
lines.append("Delivered: no, still in transit.")

Figures

Figure 1. Task success rate1 of 3

What I learned

  • Task-shaped tools are an efficiency win before they are an accuracy win: about half the tool calls and tokens, and correct answers 1.5x to 2.6x cheaper.
  • A well-written endpoint wrapper is a strong baseline. With clear descriptions, both models found and applied the returns policy through raw endpoints in every episode.
  • A task-shaped tool decides what the agent knows. When it leaves a fact out, the model fills the gap with its own interpretation, and you no longer control which one.
  • Check a tool's output against its own description. order_status promised to say whether an order was late and stayed silent for parcels in transit.
  • Test what a tool leaves out, not only what it prints. My ground-truth test checked the printed fields and missed the dropped one.
  • Most of the extra endpoint calls were exploration, not need: on ticket triage Sonnet averaged 4.5 calls, often reading policies the task never needed.
  • Prompt caching changed the economics: the full 360-episode run cost USD 0.95, about a fifth of the uncached estimate.

Next steps

  • Make order_status say what late means for parcels in transit, and re-run the task-shaped design
  • Add harder multi-hop tasks and a larger endpoint surface, so accuracy can separate the designs
  • State today's date in every task, so no answer depends on the model's sense of time
  • Repeat the matrix with more models and a lower effort setting

Run it yourself

Everything on this page comes from code and data in the repository. The dry run is free and needs no API key. A full live rerun costs about USD 1.

Terminal
git clone https://github.com/bishal-saha/ai-lab-code.git
cd ai-lab-code/mcp-tool-shape-benchmark
uv sync
uv run tool-shape --dry-run          # the whole matrix with a scripted fake model, $0
mv results results-published         # the live runner resumes from committed results
cp .env.example .env                 # then add your ANTHROPIC_API_KEY
uv run --env-file .env tool-shape --models haiku,sonnet --repeats 3 --max-usd 20
uv run python -m tool_shape.report

Bishal SahaLet's build together

Have a system to design, or an AI feature to get right?

Tell me about the problem. You'll get a clear, honest view of the best way forward.

  • Reply within 24 hoursOn business days, with my honest view and a next step.
  • Accepting select engagementsArchitecture, AI features and full builds.
  • Remote, worldwideWorking with startups, SMEs and enterprises.