Tools change. Schemas drift. Models update. Without a test that fails when the contract drifts, your agent quietly degrades for weeks before someone notices. Tool contract tests are the cheapest insurance you can buy.
Start with three test shapes:
- Schema validity: every tool definition is a valid JSON Schema and round-trips through your provider's SDK without warnings. This is one fast unit test.
- Selection accuracy: a fixture file pairs prompts with the tool that should be called. Run a small model (cheap) over each prompt, check the tool name, and report a pass/fail rate. You are not measuring the model's intelligence; you are measuring whether your descriptions still steer correctly.
- Argument correctness: for a smaller fixture set, also assert key arguments. Did the model pass
customer_id="C-9"from the user's message? Did it format the date correctly? Argument tests catch description regressions.
The trap is over-testing. Do not assert exact wording of the model's prose between tool calls — that drifts every release for no good reason. Assert structure: which tool, what arguments, did the loop terminate. Save the prose assertions for end-to-end tests that you tolerate flaking on.
Run these tests in CI when tool descriptions or schemas change, and on a nightly cadence with the latest model from your provider. The first time you catch a model upgrade silently changing your selection rate, you will understand why this was always a real category of test.