Inferensys

Prompt

Example Set Tool Call Accuracy Test Prompt

A practical prompt playbook for validating that few-shot tool-use examples demonstrate correct function selection and argument construction before deployment.
Developer demonstrating multi-agent tool use, agent tool selection interface on laptop, casual tech demo moment.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the offline audit workflow for validating tool-call example sets before agent deployment, and clarifies when this prompt should not be used.

This prompt is built for agent developers and prompt QA engineers who maintain few-shot example sets that teach a model when and how to call tools. Before shipping an agent, you need to verify that every tool-use example in your prompt selects the correct function and constructs valid arguments. Manual review misses argument shape errors, type mismatches, and hallucinated parameter names. This prompt automates that audit by comparing each example's tool call against the actual function signatures you provide.

Feed this prompt your complete tool definitions (JSON Schema or function declarations) and your full example set. It returns a structured accuracy report scoring each example on two dimensions: tool selection correctness (did the example call the right function?) and argument schema compliance (do the supplied arguments match the expected types, required fields, and constraints?). The report flags specific violations—missing required parameters, incorrect types, hallucinated field names, and wrong function choices—so you can fix problematic examples before they corrupt agent behavior in production.

Use this prompt before any release that changes tool signatures, adds new tools, or modifies example sets. It is also valuable during initial agent development when you are iterating on tool definitions and need to keep examples synchronized. Run it as a pre-commit check or as part of your CI pipeline for prompt changes. Do not use this prompt for evaluating runtime tool calls from live traffic—it is designed for offline example validation only. Runtime tool call evaluation requires different infrastructure, including execution feedback loops, side-effect monitoring, and latency considerations that this static analysis prompt does not address. For production monitoring, pair this with runtime observability prompts from the Prompt Observability and Trace Analysis pillar.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works, where it fails, and what you must provide before running it.

01

Good Fit: Pre-Deployment Tool QA

Use when: you have a static set of few-shot examples that demonstrate tool selection and argument construction, and you need to validate them before a release. Guardrail: run this prompt as a gate in your CI/CD pipeline against a golden example set.

02

Bad Fit: Runtime Agent Evaluation

Avoid when: you need to evaluate tool-call accuracy of a live agent in production. This prompt tests static examples, not dynamic agent behavior. Guardrail: use production trace analysis and LLM-as-judge on actual agent runs for runtime monitoring.

03

Required Input: Tool Schema Definitions

Risk: without the exact function signatures, parameter types, and expected argument constraints, the accuracy test cannot validate correctness. Guardrail: provide a complete tool manifest with JSON Schema definitions for every tool referenced in your examples.

04

Required Input: Labeled Expected Calls

Risk: if you don't specify the expected tool name and arguments for each example, the evaluator has no ground truth to compare against. Guardrail: maintain a parallel ground-truth file mapping each example ID to its correct tool call and arguments.

05

Operational Risk: Schema Drift

Risk: your tool signatures change but the examples and ground truth are not updated, causing false failures or silent accuracy degradation. Guardrail: version your tool schemas alongside your example sets and run this test on every schema change.

06

Operational Risk: Overfitting to Examples

Risk: high accuracy on this test may create false confidence if your example set lacks diversity. The model may memorize patterns without generalizing. Guardrail: combine this test with coverage gap analysis and hold-out evaluation sets.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt that tests whether your few-shot tool-use examples produce correct function selections and argument constructions.

This prompt template is designed to be pasted directly into your testing harness. It evaluates each example in your tool-use demonstration set against the expected tool signature and argument schema. Replace the square-bracket placeholders with your actual tool definitions, example set, and evaluation criteria before running the test. The prompt instructs the model to act as an automated validator, comparing the tool call implied by each example against the ground-truth specification.

text
You are an automated tool-call accuracy validator. Your task is to evaluate a set of few-shot examples that demonstrate tool use. For each example, you will compare the tool call shown in the example against the expected tool signature and argument schema defined below.

## TOOL DEFINITIONS
[TOOLS]

## EXAMPLE SET TO EVALUATE
[EXAMPLES]

## EVALUATION CRITERIA
For each example in the set, perform the following checks:
1. **Tool Selection Correctness:** Does the example select the correct tool from the available definitions? Score as `pass` or `fail`.
2. **Argument Schema Compliance:** Do the arguments passed in the example match the required and optional parameters, types, and constraints defined in the tool schema? Score as `pass` or `fail`.
3. **Argument Value Correctness:** For the specific input shown in the example, are the argument values logically correct and appropriate? Score as `pass` or `fail`.
4. **Overall Example Accuracy:** An example passes overall only if all three checks above pass.

## OUTPUT FORMAT
Return a JSON object with the following structure:
{
  "overall_accuracy_score": <float between 0.0 and 1.0>,
  "total_examples": <integer>,
  "passed_examples": <integer>,
  "failed_examples": <integer>,
  "per_example_results": [
    {
      "example_index": <integer>,
      "tool_selection_correct": <"pass" or "fail">,
      "argument_schema_compliant": <"pass" or "fail">,
      "argument_values_correct": <"pass" or "fail">,
      "overall_pass": <true or false>,
      "failure_notes": <string explaining the failure, or null if passed>
    }
  ],
  "summary_findings": <string summarizing common failure patterns>
}

## CONSTRAINTS
- Evaluate every example in the set. Do not skip any.
- If an example is ambiguous about which tool to call, flag it as a failure and explain the ambiguity.
- If an argument value cannot be verified from the example input, note this in `failure_notes` but do not automatically fail the example unless the schema requires a value that is missing.
- Do not invent tool definitions or examples. Use only what is provided.

To adapt this template, replace [TOOLS] with your complete function definitions in JSON Schema format, including function names, descriptions, and parameter specifications. Replace [EXAMPLES] with your full few-shot demonstration set, preserving the exact format your application uses (typically a sequence of user messages and assistant tool-call responses). For high-risk agent workflows where incorrect tool calls could trigger destructive actions, add a [RISK_LEVEL] placeholder that gates whether failures require human review before proceeding. After running the test, feed the output into your regression testing dashboard and flag any example with an overall_pass of false for immediate correction or removal.

IMPLEMENTATION TABLE

Prompt Variables

Placeholders required by the Example Set Tool Call Accuracy Test Prompt. Replace each placeholder with concrete values before execution. Validation notes describe how to check that the supplied value is well-formed and compatible with the test harness.

PlaceholderPurposeExampleValidation Notes

[EXAMPLE_SET]

The collection of few-shot tool-use examples to test. Each example must include a user input, the expected tool name, and the expected arguments.

[ {"input": "Schedule a meeting with Alice tomorrow at 2pm", "expected_tool": "create_calendar_event", "expected_args": {"title": "Meeting with Alice", "start_time": "2025-07-16T14:00:00Z"}} ]

Parse as JSON array. Each element must contain input, expected_tool, and expected_args fields. expected_args must be a valid JSON object. Empty array is allowed but produces a no-op test run.

[TOOL_SCHEMAS]

The JSON Schema definitions for all tools the model is allowed to call. Used to validate that expected arguments conform to the tool's parameter specification.

{ "create_calendar_event": { "type": "object", "properties": { "title": {"type": "string"}, "start_time": {"type": "string", "format": "date-time"} }, "required": ["title", "start_time"] } }

Parse as JSON object mapping tool names to JSON Schema objects. Each schema must be a valid JSON Schema draft-07 or later. Missing schemas for tools referenced in [EXAMPLE_SET] will cause validation failures.

[MODEL_IDENTIFIER]

The model to test against. Used to route the prompt to the correct API endpoint and to record which model produced each result.

"gpt-4o"

Must be a non-empty string matching a supported model identifier in the test harness configuration. Unknown identifiers should cause an early failure rather than a silent default.

[CONFIDENCE_THRESHOLD]

The minimum confidence score required for a tool call to be considered accurate. Calls below this threshold are flagged for review.

0.8

Must be a float between 0.0 and 1.0 inclusive. Values outside this range should be rejected. A threshold of 0.0 disables confidence filtering. A threshold of 1.0 requires perfect confidence.

[OUTPUT_SCHEMA]

The expected structure for the accuracy report. Defines the fields the test harness will parse from the model's response.

{ "type": "object", "properties": { "results": { "type": "array", "items": { "type": "object", "properties": { "example_index": {"type": "integer"}, "tool_selection_correct": {"type": "boolean"}, "argument_accuracy_score": {"type": "number"}, "errors": {"type": "array", "items": {"type": "string"}} }, "required": ["example_index", "tool_selection_correct", "argument_accuracy_score"] } }, "overall_accuracy": {"type": "number"} }, "required": ["results", "overall_accuracy"] }

Must be a valid JSON Schema. The harness will validate the model's output against this schema. Schema mismatch between the prompt instruction and the harness validation will cause parse failures.

[MAX_RETRIES]

The number of times to retry a failed tool call before marking the example as incorrect. Controls the retry loop in the test harness.

2

Must be a non-negative integer. A value of 0 means no retries. Values above 10 should trigger a warning about test duration and cost. The harness should enforce a timeout per retry cycle.

[EVAL_MODE]

Controls whether the test runs in strict mode (exact argument match required) or lenient mode (semantic equivalence accepted).

"strict"

Must be one of the enumerated values: "strict" or "lenient". Any other value should cause a configuration error. In strict mode, argument comparison uses deep equality. In lenient mode, the harness applies configurable equivalence rules for dates, names, and numeric tolerances.

[REPORT_DESTINATION]

Where to write the accuracy report. Determines whether results are returned inline, written to a file, or sent to a logging endpoint.

"inline"

Must be one of the enumerated values: "inline", "file", or "log_endpoint". If "file", [REPORT_PATH] must also be provided. If "log_endpoint", [LOG_ENDPOINT_URL] must be provided. The harness should validate destination availability before starting the test run.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Example Set Tool Call Accuracy Test Prompt into a testing pipeline or CI workflow.

The Example Set Tool Call Accuracy Test Prompt is designed to be a gate in a continuous integration pipeline for agent systems. Its primary job is to programmatically validate that a set of few-shot examples—which teach the model when and how to use tools—actually produces the correct tool selection and argument construction. You should wire this prompt into a pre-release testing workflow that runs whenever the example set, tool definitions, or system prompt changes. The harness must treat each example as a test case: send the example's input to the model under test, capture the model's tool call, and compare it against the expected tool call defined in the example's output. A simple pass/fail report is insufficient; the harness must produce structured diagnostics that pinpoint whether the failure was a wrong tool selection, a missing required argument, a type mismatch, or a hallucinated parameter.

To implement this, construct a test runner that iterates over your example set. For each example, extract the [INPUT] and the [EXPECTED_TOOL_CALL]. Send the input to the model with the full system prompt and tool definitions loaded. Parse the model's response to extract the actual tool call. Then, run a two-stage validation: first, check that the tool_name matches exactly. Second, validate the arguments against the expected schema. For argument validation, use a JSON Schema validator to confirm that all required fields are present, no extra fields exist, and each field's type matches. Log every mismatch with the example ID, the expected value, the actual value, and the specific field that failed. This structured log is your accuracy report. For high-risk agent workflows—such as those triggering financial transactions or modifying production infrastructure—add a human approval gate that blocks the release if any critical tool call examples fail.

Integrate this harness into your CI system as a script that exits with a non-zero code if the accuracy falls below a configurable threshold (e.g., 100% for critical tools, 95% for non-critical). Use environment variables to control the model endpoint, API key, and the path to the example set file. Store the example set in a version-controlled JSON file where each entry has an id, input, expected_tool_name, and expected_arguments schema. The harness should also measure and log latency per example to detect regressions in tool-call speed. Avoid running this test against production models without a dry-run mode first; a misconfigured test could accidentally invoke real tools if your agent harness is not properly sandboxed. Always run tool-call accuracy tests in an isolated environment where tool execution is mocked or disabled, validating only the model's intent to call the tool, not the tool's side effects.

IMPLEMENTATION TABLE

Expected Output Contract

The JSON structure the model must return for the Example Set Tool Call Accuracy Test. Use this contract to validate the model's output before accepting the accuracy report.

Field or ElementType or FormatRequiredValidation Rule

test_run_id

string

Must match the [TEST_RUN_ID] input exactly. Non-nullable.

overall_accuracy_score

number

Must be a float between 0.0 and 1.0 inclusive. Calculated as correct_tool_calls / total_examples.

total_examples

integer

Must equal the count of examples in the [EXAMPLE_SET] input. Non-negative.

correct_tool_calls

integer

Must be less than or equal to total_examples. Non-negative.

per_example_results

array of objects

Array length must equal total_examples. Each object must contain example_id, tool_selection_correct, and argument_accuracy fields.

per_example_results[].example_id

string

Must match an example_id from the [EXAMPLE_SET] input. Non-nullable.

per_example_results[].tool_selection_correct

boolean

true if the model's chosen tool matches the expected tool in the example; false otherwise. Non-nullable.

per_example_results[].argument_accuracy

object

Must contain matched_arguments, missing_arguments, and extra_arguments arrays. Non-nullable.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when testing tool-call accuracy with example sets and how to prevent silent failures in production.

01

Schema Drift Between Examples and Live Tools

What to watch: Example arguments reference parameter names or types that no longer match the live function schema. The model learns the stale signature and produces invalid calls. Guardrail: Version-lock your example set to a specific tool schema hash. Run a pre-flight Example Schema Compliance Check that diffs example arguments against the current function declaration before every test run.

02

Overfitting to Example Tool Selection Patterns

What to watch: The model memorizes which tool was called in each example rather than learning the selection rule. It fails silently on inputs that require a different tool than the nearest example. Guardrail: Include counterexamples where similar inputs require different tools. Measure tool selection accuracy on a held-out set that deliberately varies the input phrasing while keeping the correct tool constant.

03

Hallucinated Required Arguments

What to watch: Examples that always include optional fields train the model to treat them as required. The model invents plausible values for missing optional arguments instead of omitting them. Guardrail: Construct examples that explicitly omit optional parameters. Validate that generated calls never include arguments absent from both the input and the schema's required list.

04

Silent Argument Value Contamination

What to watch: The model copies argument values from examples rather than extracting them from the current input. This is especially dangerous for entity IDs, timestamps, and user-specific data. Guardrail: Use placeholder values in examples (e.g., [USER_ID]) that cannot be valid in production. Flag any output containing example-literal values as a contamination failure.

05

Tool Selection Correctness Without Argument Correctness

What to watch: Accuracy reports that only score tool selection miss the more common failure: correct tool, wrong arguments. The model picks update_order but passes the wrong order_id. Guardrail: Score tool selection and argument correctness independently. Require both scores to pass their respective thresholds. A perfect tool-selection score with a 60% argument score is a failing test.

06

Example Set Lacks Multi-Tool Sequences

What to watch: All examples show single tool calls. When the model encounters inputs requiring sequential tool use, it either calls one tool and stops or chains calls incorrectly. Guardrail: Include multi-turn examples that demonstrate correct tool sequencing. Test with inputs that require 2-3 sequential calls and verify both the order and the argument flow between calls.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality of the accuracy report generated by the Example Set Tool Call Accuracy Test Prompt before relying on it in CI.

CriterionPass StandardFailure SignalTest Method

Schema Compliance

Report is valid JSON matching the [OUTPUT_SCHEMA]

JSON parse error or missing required fields

Automated schema validation against the expected JSON Schema

Tool Selection Accuracy

All tool_name fields in the report match the expected tool for each example

Mismatched tool_name for any example

Automated diff of report tool_name against a pre-computed ground-truth mapping

Argument Correctness

All argument key-value pairs match expected values exactly

Any argument key missing, extra, or with an incorrect value

Automated deep equality check of arguments object against ground truth

Score Calculation

Per-example accuracy_score is 1.0 when tool and arguments match, 0.0 otherwise

accuracy_score is not 0.0 or 1.0, or overall_score is not the mean of per-example scores

Unit test verifying score logic with known pass/fail inputs

Error Handling

Report includes a non-null error field for any example that cannot be evaluated

error field is null when evaluation fails, or contains a non-descriptive string

Inject a malformed example and verify error field is populated with a specific message

Idempotency

Running the prompt twice on the same input set produces identical reports

Fields like timestamp, duration, or score differ between runs

Run the prompt twice and assert byte-level equality of the JSON output

Hallucination Resistance

Report contains no invented tool names, arguments, or scores not present in the input

Report references a tool or argument not defined in the provided [TOOL_SCHEMAS]

Automated check that all tool_name and argument keys exist in the input schema set

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a small hand-curated example set and lighter validation. Focus on tool selection correctness first; skip argument schema strictness. Replace [EXPECTED_TOOL_SIGNATURES] with a simple JSON map of tool names to parameter lists. Run against 5-10 examples and manually review the accuracy report.

Watch for

  • Missing schema checks letting malformed arguments pass
  • Overly broad tool descriptions causing selection ambiguity
  • No baseline accuracy measurement before iteration
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.