agentleFS
varunk130varunk130/AI-Eval-Skills/skills/tool-use-eval/SKILL.md

tool-use-eval

Skill1 starsChanged 28 days agoMITView on GitHub

Evaluation pattern for agents that call tools / functions - measures tool selection accuracy, argument correctness, recovery from tool errors, and avoidance of unnecessary tool calls. Pairs with eval-suite-planner. Use when: tool-use eval, function-calling eval, agent tool selection, tool invocation accuracy, tool argument validation, tool error recovery, agent tools, function-calling agent, MCP eval.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every test case captures:

    line 76
  2. Distinctive:

    Adopt / extend the seed suite: - start with the 18 canonical cases

    line 103

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tool-Use Eval

Evaluation pattern for agents whose job is to invoke tools / functions / MCP capabilities. Conversational quality and task-completion evals miss the failure modes specific to tool-use; this skill adds the four dimensions that actually predict whether a tool-using agent is production-ready.

Core Principle

A tool-using agent has four ways to fail that pure-conversation agents don't. Generic quality scores can be high while every one of these is broken. This eval pattern separates them so improvements target the right failure mode.

The Four Tool-Use Dimensions

DimensionWhat It MeasuresFailure Example
Tool Selection AccuracyDid the agent pick the right tool for the request?Used search_web when lookup_internal_kb was the right call
Argument CorrectnessWere the arguments well-formed and schema-valid?Required field missing, type mismatch, hallucinated parameter
Error RecoveryWhen a tool returned an error, did the agent recover sensibly?Repeats the same failing call, or gives up silently
RestraintDid the agent avoid unnecessary tool calls?Calls 5 tools when 1 would do; calls a tool when no tool was needed

The four dimensions are independently scorable - improvements often help one and hurt another (e.g., tightening argument validation can increase Restraint failures).

Scoring Anchors (0-3 per dimension)

Tool Selection Accuracy

ScoreAnchor
0Wrong tool; result has no chance of satisfying the request
1Plausible-looking tool but mismatched to the request's actual intent
2Right tool family, but a more specific / cheaper tool existed and was missed
3Most appropriate tool selected on the first call

Argument Correctness

ScoreAnchor
0Schema-invalid (missing required field, type mismatch, hallucinated param)
1Schema-valid but semantically wrong
2Schema-valid and semantically reasonable, with one suboptimal field
3Schema-valid, semantically optimal, no extraneous fields

Error Recovery

ScoreAnchor
0Agent ignored the error or repeated the same failing call > 1×
1Agent stopped without explaining the failure to the user
2Agent tried a different approach but did not surface the failure clearly
3Sensible alternative tried or failure clearly surfaced with next-step guidance

Restraint

ScoreAnchor
0Tool called when no tool was needed (request answerable from prior context)
1Multiple tools called for what should have been a single call
2Tool count is right but ordering wasted a call
3Minimum-necessary tool calls, ordered well

Canonical Test Suite

The skill ships an 18-case seed suite covering common failure shapes:

Case TypeCountTests
No tool needed3Restraint baseline - request answerable from context
Single obvious tool3Selection + Argument basics
Two plausible tools3Selection discrimination
Multi-tool chain3Sequencing + Restraint
First call errors3Error Recovery
Ambiguous request3Pre-call clarification vs. guessing

Extend with 5-10 cases from your actual production traffic.

Trace Capture Schema

Every test case captures:

  • request - the user prompt
  • tool_calls[] - each call's name, arguments, timestamp, result, error (if any)
  • final_response - the agent's reply to the user
  • expected_tools[] - gold-standard tool sequence (for Selection scoring)
  • expected_no_tools - boolean (for Restraint scoring)

Without the trace, post-hoc scoring is impossible.

Failure Taxonomy

Standardized labels so triage rolls up cleanly:

CodeMeaning
SEL-WRONGWrong tool selected
SEL-SUBOPTIMALRight family, wrong specific tool
ARG-INVALIDSchema validation failed
ARG-SEMANTICSchema-valid but semantically wrong
REC-SILENTFailure not surfaced to user
REC-LOOPSame failing call repeated
RES-OVERCALLMore tool calls than needed
RES-UNNECESSARYTool call when none was needed

Process

  1. Inventory the tools - list with schemas and one-line use cases
  2. Adopt / extend the seed suite - start with the 18 canonical cases
  3. Run with full trace capture - request + every call + final response
  4. Score each case on all four dimensions independently
  5. Aggregate by failure type - which dimension is dragging?
  6. Track over time - re-run on every model / prompt / tool-schema change

Pairs With

  • eval-suite-planner - designs the broader plan; tool-use-eval is the tool-use chapter
  • eval-result-interpreter - produces SHIP / ITERATE / BLOCK verdicts
  • eval-triage-and-improvement - walks through failures, recommends fixes
  • cost-quality-frontier - Restraint failures show up as cost regressions

Tips

  1. Score the trace, not the response. Wasteful tool sequences hide if you only judge output.
  2. Restraint regressions are the most expensive at scale - a 2× tool-call regression doubles inference + tool-execution costs.
  3. Don't conflate Selection and Argument failures - different fixes (prompt vs. schema clarity).
  4. Test the no-tool baseline - over-calling is the hardest failure mode to detect without it.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.