Overview
The Tool Invocation evaluator determines whether an LLM invoked a tool correctly with proper arguments, formatting, and safe content. This evaluator focuses on the how of tool calling - validating that the invocation itself is well-formed - rather than whether the right tool was selected.When to Use
Use the Tool Invocation evaluator when you need to:- Validate tool call arguments - Ensure all required parameters are present with correct values
- Check JSON formatting - Verify tool calls are properly structured
- Detect hallucinated fields - Identify when the LLM invents parameters not in the schema
- Audit for unsafe content - Check that arguments don’t contain PII or sensitive data
- Evaluate multi-tool invocations - Validate when the LLM calls multiple tools at once
This evaluator validates tool invocation correctness, not tool selection. For evaluating whether the right tool was chosen, use the Tool Selection evaluator instead. The two evaluators are complementary — Tool Selection catches wrong-tool errors while Tool Invocation catches malformed-call errors — and are best run together for complete tool-calling coverage.
Supported Levels
The level of an evaluator determines the scope of the evaluation in OpenTelemetry terms. Some evaluations are applicable to individual spans, some to full traces or sessions, and some are applicable at multiple levels.
Relevant span kinds: Tool spans or LLM spans with tool calls, particularly in agentic applications.
Input Requirements
The Tool Invocation evaluator requires three inputs:In TypeScript, the fields use camelCase:
availableTools and toolSelection.Formatting Tips
While you can pass full JSON representations for each field, human-readable formats typically produce more accurate evaluations.input (conversation context adapted from input messages):
available_tools (tool descriptions adapted by JSON schemas):
tool_selection (the LLM’s tool invocation adapted from tool_calls in the output):
- Include full conversation context - The evaluator considers the entire conversation history to validate argument values
- Multi-tool invocations are supported - If the LLM calls multiple tools, include all invocations in the
tool_selectionfield
Output Interpretation
The evaluator returns aScore object with the following properties:
Usage Examples
- Python
- TypeScript
Using Input Mapping
When your data has different field names, use input mapping.- Python
- TypeScript
Configuration
For LLM client configuration options, see Configuring the LLM.Viewing and Modifying the Prompt
You can view the latest versions of our prompt templates on GitHub. The evaluators are designed to work well in a variety of contexts, but we highly recommend modifying the prompt to be more specific to your use case. Feel free to adapt them.- Python
- TypeScript
Using with Phoenix
Evaluating Traces
Run evaluations on traces collected in Phoenix and log results as annotations:Running Experiments
Use the Tool Invocation evaluator in Phoenix experiments:API Reference
- Python: ToolInvocationEvaluator
- TypeScript: createToolInvocationEvaluator
Related
- Tool Selection Evaluator - For evaluating whether the right tool was chosen
- Correctness Evaluator - For evaluating factual accuracy

