Toolscore Documentation

PyPI version License Downloads

Toolscore tests MCP servers and the tool calls agents make. It grades any MCP server A–F (local or remote, MCP 2026-07-28 and earlier revisions) and checks the tool calls an agent makes against the ones you expect, locally, deterministically and without an API key.

Correct tool calls are not enough. Toolscore checks that the tool really did it (Effect Probes), and that the agent told the truth about it (Honesty Checks, Fault Injection).

What is Toolscore?

Toolscore evaluates LLM tool usage - it doesn’t call LLM APIs directly. Think of it as a testing framework for function-calling agents:

✅ Evaluates tool usage traces from OpenAI (Chat Completions and Responses), Anthropic, Gemini, agent frameworks, recorded MCP sessions, OpenTelemetry spans, or custom sources

✅ Compares actual behavior against expected gold standards

✅ Reports detailed metrics on accuracy, efficiency, and correctness, plus failed calls, leaked credentials and forbidden calls

✅ Grades and lints MCP servers over stdio or Streamable HTTP, including behavior annotations, output schemas, references to missing tools and tool poisoning

❌ Does NOT call LLM APIs or execute tools (you capture traces separately)

Quick Start

pip install tool-scorer

# Run evaluation
toolscore eval examples/gold_calls.json examples/trace_openai.json --html report.html

# Grade a bundled sample MCP server, then your own (a command or a URL)
toolscore demo
toolscore mcp test "python my_server.py"
toolscore mcp test https://mcp.example.com/mcp --auth-env MCP_TOKEN   # needs tool-scorer[http]

Key Features

  • Comprehensive Metrics Suite: Tool invocation accuracy, selection accuracy, sequence edit distance, argument matching, redundant and repeated calls, required calls completed, and side-effect validation

  • Behavior and Safety Checks: Failed calls, blind retries, credentials passed into tool arguments, and forbidden-call policies, with a CI gate (Behavior and Safety Checks)

  • Truth Checks: effect probes that catch tools reporting success without doing it (Effect Probes), honesty checks that compare tool results with the agent’s final answer (Honesty Checks), and a fault-injection proxy that makes chosen calls fail (Fault Injection)

  • Rigor: an agent harness that runs LLM agents against MCP servers with guards, budgets and resumable runs (Agent Harness); pinning and drift checks against MCP rug pulls, and server diffs (Diff & Pinning); contracts with optional, forbidden and alternative calls (Contracts v2); content-hashed receipts, regrading and tri-state evidence (Receipts & Regrade); repeated-run statistics and variant selection (Comparing Runs)

  • Snapshot Testing: Record, approve and replay your agent’s tool calls in pytest (Snapshot Testing)

  • MCP Scorecard, Lint and Recorder: Grade any MCP server (stdio or Streamable HTTP, MCP 2026-07-28 with a fallback to the initialize handshake), lint its annotations, output schemas, missing-tool references and tool poisoning, write a grade badge, and record real sessions (Testing MCP Servers)

  • Native Everywhere: OpenAI (Chat Completions and Responses API), Anthropic, Gemini, LangGraph, Pydantic AI, OpenAI Agents SDK, Claude Agent SDK, CrewAI, MCP and OpenTelemetry traces (Framework Integration Guide)

  • CLI, Python API and GitHub Action: Command-line interface, programmatic usage and CI gates

  • Rich Reports: Console, HTML, Markdown, CSV and machine-readable JSON reports, plus a versioned record for evaluation harnesses

  • Extensible: Easy to add custom metrics and validators

Contents

Guides

Development

Indices and tables