Tool/Function Definition Linter

Validate and lint your AI function calling definitions for OpenAI, Anthropic, and Google formats

~/tool-linter

Paste a tool/function JSON definition above to validate it against OpenAI, Anthropic, and Google specs.

Supports OpenAI function calling, Anthropic tool use, and Google Gemini function declarations.

What is an AI Tool Definition Linter?

An AI tool definition linter validates the JSON structures that define functions and tools for large language model APIs. When using function calling (also called tool use) with providers like OpenAI, Anthropic Claude, Google Gemini, or Cohere, you must provide correctly structured JSON definitions that describe your functions — their names, descriptions, and parameter schemas.

Even small errors in these definitions — a misspelled field name, an invalid type, or a missing required property — can cause API calls to fail silently or produce unexpected behavior. A tool definition linter catches these errors before you deploy, saving debugging time and preventing production issues.

Our free linter validates your definitions against four major providers simultaneously (OpenAI, Anthropic, Google, and Cohere), shows you exactly where errors are, and provides actionable suggestions to fix each issue. Mistral AI, xAI (Grok), and DeepSeek use OpenAI-compatible format, so passing OpenAI validation covers them too. It runs entirely in your browser with no data sent to any server.

How to Use This Linter

Using the Tool Definition Linter is simple — just paste and go:

  1. Paste your JSON definition — Copy your tool/function definition from your codebase and paste it into the editor. The linter accepts single tool objects, arrays of tools, or wrapped objects with a `tools` array.
  2. See real-time results — The linter validates automatically as you type (with a brief debounce). No need to click a button. You'll see the detected format, provider compatibility status, and any issues immediately.
  3. Review compatibility — The four provider cards show whether your definition is compatible with OpenAI, Anthropic, Google, and Cohere. Green means compatible, red means there are breaking issues that need fixing.
  4. Fix issues — Each issue shows the affected field path, a clear error message, and a suggestion for how to fix it. Issues are categorized by severity: errors (must fix), warnings (should fix), and info (nice to have).
  5. Copy corrected JSON — Once satisfied, use the "Copy Corrected JSON" button to get a clean, formatted version with basic auto-corrections applied.

Understanding AI Function Calling Formats

Each AI provider has its own format for defining callable functions, though they share the same underlying concept: a name, description, and JSON Schema for parameters.

OpenAI Function Calling

OpenAI wraps tool definitions in a `{ type: "function", function: { ... } }` structure. The inner object contains `name`, `description`, and `parameters` (a JSON Schema object). OpenAI also supports a `strict` mode that enables Structured Outputs — when set to true, the model will always follow the exact schema, but requires `additionalProperties: false`.

Anthropic Tool Use

Anthropic uses a flat structure without a wrapper. Each tool is defined with `name`, `description`, and `input_schema` — note the different field name compared to OpenAI's `parameters`. Anthropic recommends keeping descriptions under 1024 characters for optimal performance. The `cache_control` field can optionally be used for prompt caching.

Google Gemini Function Declarations

Google Gemini uses a flat structure similar to Anthropic but with `parameters` like OpenAI. The key difference is that Google's JSON Schema support is more limited — it does not support `$ref` for schema references and has limited support for composition keywords like `oneOf`, `anyOf`, and `allOf`.

Cohere Tool Use

Cohere uses a unique format with `parameter_definitions` instead of JSON Schema. Each parameter is defined as an object with `type`, `description`, and optionally `required` fields. This is structurally different from the JSON Schema approach used by other providers. Cohere is particularly strong for RAG-based tool use and enterprise workflows with SOC 2 and HIPAA compliance.

OpenAI-Compatible Providers

Several providers — including Mistral AI, xAI (Grok), and DeepSeek — use OpenAI-compatible function calling formats. If your tool definition passes OpenAI validation, it will work with these providers out of the box, making it easy to switch between them without modifying your tool definitions.

Common Errors in Tool Definitions

Based on common patterns we see, here are the most frequent mistakes in AI tool definitions:

  • Wrong schema field name — Using "parameters" when the provider expects "input_schema" (Anthropic) or vice versa. This is the #1 cross-provider compatibility issue.
  • Missing wrapper structure — Forgetting the `{ type: "function", function: { ... } }` wrapper for OpenAI, or including it when targeting Anthropic/Google.
  • Invalid function names — Using spaces, special characters, or names longer than 64 characters. All providers require alphanumeric characters, underscores, and hyphens only.
  • Required fields not in properties — Listing a field in the "required" array that doesn't exist in the "properties" object.
  • Missing "type" in schema objects — Every JSON Schema object needs a "type" field. The root schema should be "type": "object".
  • Missing property descriptions — While technically not always required, property descriptions significantly improve model understanding and tool call accuracy.
  • Strict mode violations — When using OpenAI's strict mode, forgetting to set "additionalProperties": false or not listing all properties as required.

Frequently Asked Questions

What formats does the tool definition linter support?

Our linter validates tool/function definitions against four major AI providers: OpenAI function calling format (with the { type: "function", function: {...} } wrapper), Anthropic tool use format (using input_schema), Google Gemini function declarations (using parameters), and Cohere tool use (using parameter_definitions). Mistral AI, xAI (Grok), and DeepSeek use OpenAI-compatible format. It auto-detects the format you paste and checks compatibility with all providers.

What is the difference between OpenAI, Anthropic, and Google function calling formats?

The main differences are structural. OpenAI wraps tool definitions in { type: "function", function: {...} } and uses "parameters" for the JSON schema. Anthropic uses a flat structure with "input_schema" instead of "parameters". Google also uses a flat structure with "parameters" but has more limited JSON Schema support. Cohere uses a unique "parameter_definitions" format where each parameter is an object with type and description, rather than JSON Schema. Mistral AI, xAI (Grok), and DeepSeek all use the OpenAI-compatible format.

Does the linter catch all possible errors?

The linter catches the most common structural errors: missing required fields, invalid names (must be 1-64 alphanumeric characters with underscores/hyphens), malformed JSON Schema (invalid types, required fields not in properties, missing items for arrays), and format-specific issues (wrong wrapper structure, wrong schema field name). It does not validate business logic or whether the function description is effective for model understanding.

Can I validate tool definitions with nested parameters?

Yes, the linter validates nested JSON Schema structures up to 5 levels deep. It checks each nested object for proper type definitions, validates enum arrays, array items schemas, and ensures required fields reference properties that actually exist at each nesting level.

Is the "Copy Corrected JSON" feature safe to use?

The corrected JSON applies safe, non-destructive fixes: pretty-printing the JSON, adding missing "type": "object" where needed, and removing required entries that reference non-existent properties. It does not change your function name, description, or property definitions. Always review the corrected output before using it in production.

Related Tools

Explore more tools to help you build with AI APIs:

Related Tools