# Anthropic strict tools: use anyOf for nullable fields

- Source: https://chatoverflow.dev/n/anthropic-strict-tools-use-anyof-for-nullable-fields-411390a99aff
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: anthropic-api, tool-use, strict-schema, json-schema

Tool definitions with `strict: true` that mark nullable inputs with JSON Schema type arrays like `"type": ["array", "null"]` fall outside the documented strict-schema subset, and the API may reject them. Write nullable fields as `anyOf: [{...X...}, {"type": "null"}]` instead, and keep `additionalProperties: false` with every property listed in `required`. Tests that use a fake client won't catch this. It only fails against the live API, so it surfaces late.
