# Tool Call Auditor: Check Agent Tool Calls Against Schemas

> Audit tool calling and function calling in your AI agent's real logs: every call and JSON output checked against its declared schema, unknown tools and broken arguments flagged, PASS or FAIL for CI.

Tool Call Auditor: Check Agent Tool Calls Against Schemas is a paid AI agent skill on Agensi by AGI Tools, in Testing & Debugging. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9.99 (one-time purchase)
- Creator: [AGI Tools](https://www.agensi.io/creators/agi-tools)
- Category: [Testing & Debugging](https://www.agensi.io/skills/testing-debugging)
- Version: 1.0.2
- Last updated: 2026-11-28
- Security: scan passed (2026-11-28); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/tool-call-auditor-check-agent-tool-calls-against-schemas
- Tags: testing, ai-agents, llm-ops, python, json-schema, tool-calling, function-calling, structured-outputs

## About this skill

### The problem
Agents fail quietly where the model meets your tools: a tool that does not exist, a date sent as a number, a required field missing, argument JSON cut off mid-string, a JSON answer without the field your code reads. Each one becomes an error, a wrong action or a silent retry, and most teams find out from a user.

### What Tool Call Auditor does
It reads your agent's real logs and checks every tool call and every structured output against the schema it was declared with, using a real program (`scripts/audit.py`, Python standard library only). The same logs always give the same findings.

- **Contract violations (they fail the gate):** unknown or hallucinated tools, arguments that are not valid JSON, schema violations with the JSON path and the rule (missing required field, wrong type, value outside the enum, pattern, bounds, undeclared property and more), and final answers that are not JSON or break their declared schema.
- **Patterns to review (they do not fail the gate by default):** the same call made three times or more, a call retried unchanged after an error, a call left without a result, a result without a call. These can be real loops and blind retries, or legitimate polling and deliberate retries, so they are listed separately for a person to judge. Make any of them blocking with `--fail-on` if your workflow treats it as an error.
- **Log formats:** OpenAI Chat Completions and Responses API, Anthropic Messages, and chat transcripts, in JSONL or JSON. Tool definitions come from the logs or from an OpenAI, Anthropic or MCP tool list. Parallel calls, legacy function calls and multiple choices are handled.
- **CI gate:** exit code 0 (PASS) or 1 (FAIL), Markdown and JSON reports with a per-tool table, and JUnit XML.

### Fails closed
Calls with no tool definition to check against, logs where nothing could be audited, and an empty or unknown gate setting all fail. Schema keywords the audit does not check (for example `format`) are listed under "Not checked" in every report: nothing is assumed valid.

### What you get
- `scripts/audit.py`: the audit and the gate. Python 3.9+, standard library only. No install, no account, no API key.
- `SKILL.md`: the workflow your agent follows, from collecting logs to fixing the cause.
- `reference/checks.md`: log shapes, how results are matched to calls, every check and rule, gate rules and report fields.
- A reproducible demo (`examples/demo.py`) on synthetic logs, with the reports it produces.
- 78 automated tests, run on Linux and Windows with Python 3.9 and 3.13. macOS has not been verified.

### Limits
- It checks the contract, not judgement: it does not tell whether a call was the right action or whether an answer is correct.
- It checks a subset of JSON Schema; other keywords are reported as not checked.
- Repeats and retries are detected only for identical arguments, and tool errors only in common formats.

### Privacy
Runs locally and sends nothing anywhere. Reads only the log and schema files you name and writes only the report files you name. Report excerpts are at most 80 characters, with keys, tokens, credentials, emails, card numbers and international phone numbers masked; `--no-values` leaves values out entirely.

Not affiliated with Agensi, Anthropic or OpenAI. Built by AGI Tools.

## Requires

- Python 3.9+

Exported logs of your agent (JSONL or JSON). The skill itself needs no model access and no API key.

## Known limitations

It checks each call and output against its declared schema; it does not judge whether a call was the right action or whether an answer is correct.
JSON Schema subset: keywords such as format, if/then and remote $ref are reported as not checked, not validated.
Repeated calls and retries are detected only when the arguments are identical; tool errors are recognized in common formats only.
Masking in report excerpts covers the listed formats; other personal data is not detected (use --no-values).

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Tool Call Auditor: Check Agent Tool Calls Against Schemas skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### Does it call my model or my tools?

No. It only reads exported logs. It never calls a model, a tool or a network service.

### Is every repeated call or retry an error?

No. Repeated calls, retries after errors and calls without a result are listed as patterns to review, separate from contract violations, and do not fail the gate unless you choose them with --fail-on. Polling a status or retrying a transient failure can be legitimate.

### Which log formats does it read?

OpenAI Chat Completions and Responses API logs, Anthropic Messages logs and chat transcripts, in JSONL or JSON. If the logs carry no tool definitions, pass an OpenAI, Anthropic or MCP tool list with --tools: calls with nothing to check against fail the gate instead of passing silently.

### Is my data safe?

It runs locally and sends nothing anywhere. Report excerpts are at most 80 characters with keys, tokens, credentials, emails, card numbers and international phone numbers masked, and --no-values removes values entirely. Masking covers these formats only, so check reports before sharing them outside your team.

### Does it check every JSON Schema keyword?

No. It checks the common keywords: types, required, properties, enums, patterns, lengths and bounds, arrays, anyOf/oneOf/allOf/not and local $ref. Anything else, such as format, is listed under Not checked in every report.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
