Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
feat: show the model each tool's own JSON Schema in the Vercel, LlamaIndex, and Claude Agent SDK providers (#4940)
## Summary Zod-based providers rendered each tool's Zod schema back into JSON Schema for the model, which drops keywords Zod v3 cannot carry (`format: "binary"`, `contentEncoding`, `contentMediaType`, custom formats such as `repo.nwo`). The direct providers send the source schema, so the same tool looked different to the model depending on the provider. This moves the providers that can do it without changing what they accept: | Provider | Model sees | Arguments validated by | |---|---|---| | Vercel | the tool's JSON Schema (`$ref`s inlined) via the AI SDK's `jsonSchema(schema, { validate })`; in strict mode, the output of `toStrictJsonSchema` the same way | the same v3 Zod schema as before | | LlamaIndex | the tool's JSON Schema (`$ref`s inlined) as `FunctionTool`'s model-facing parameters | the v3 Zod schema, passed to the same constructor | | Claude Agent SDK | a schema built with `@composio/json-schema-to-zod/v4`, which forwards the keywords through `.meta()` | the same v4 schema | | LangChain | unchanged (v3) | unchanged | Core stays on the v3 builder: moving it to `/v4` would require zod `>=4.1.13` for every core user. LangChain and LlamaIndex render v4 schemas in output mode, which across the 930-tool set loses `default` (and makes the field required) in 397 tools, and LangChain also closes free-form objects. So LangChain stays on v3 until it can take a separate model-facing schema or render in input mode. Designated PR reviewer: [@jkomyno](mailto:alberto@composio.dev). Part of https://github.com/ComposioHQ/composio/issues/4911 ## Changes - **Vercel:** `jsonSchema()` with a `validate` backed by the existing Zod schema (available since `ai` 6.0.0, so the `^6 || ^7` range holds). The model now also sees `title`, `default`, `examples`, and OpenAPI `nullable`. In strict mode the strict JSON Schema is sent as is, so Zod no longer adds a `pattern` beside `email`, which OpenAI and Anthropic strict mode reject. `tool.inputSchema` is now an AI SDK `Schema` instead of a Zod schema (minor bump; the changeset shows `asSchema(tool.inputSchema).validate(value)` as the replacement for `.safeParse()`). - **LlamaIndex:** `new FunctionTool(execute, { parameters: jsonSchema }, zodValidator)`; 0.12.0 and 0.12.1 share `@llamaindex/core` 0.6.22. Duplicate `required` entries are now removed after `$ref`s are inlined, using `deduplicateJsonSchemaRequiredArrays` from core. That export first shipped in core 0.14.0, so LlamaIndex's verified core floor in the compatibility check moves from 0.11.0 to 0.14.0, the same floor Anthropic and Cloudflare use for it. The published `>=0.10.0` range is unchanged, like the other providers' floors. - **Claude Agent SDK:** builds with `/v4`; the `zod` peer moves from `^4.0.0` to `^4.1.13` (minor bump), and the package now depends on `@composio/json-schema-to-zod`. It needs the `/v4` release of the converter, whose changeset is already pending on `next`. - `ts/scripts/check-provider-compatibility.ts` packs `@composio/json-schema-to-zod` for providers that import it; without it the minimum lane fails on the unpublished `./v4` subpath. - Vercel AI SDK v6/v7 E2E fixtures check that the source schema reaches the AI SDK. ## Type of change - [ ] Bug fix - [x] New feature - [ ] Refactor/Chore - [ ] Documentation - [x] Breaking change ## How Has This Been Tested? - **Validation parity:** each provider passes all 53 cases and 134 instances of the shared corpus through its real validator (AI SDK `validate`, LlamaIndex's validator, MCP `tools/call` for Claude). For the Claude path, v3 and v4 agree on all 2,790 checks over the 930-tool set. - **New tests:** per provider, `format: "binary"`, `contentEncoding: "base16"`, and `contentMediaType` reach the model-facing schema; in Vercel strict mode `format: "uri"` is stripped and `email` is kept without a `pattern`. - **Live (12 requests):** gpt-5-mini through `@ai-sdk/openai` with the request body captured, and claude-haiku-4-5 with the schema the AI SDK holds, over a synthetic tool, `GITHUB_CREATE_A_PULL_REQUEST`, and `GITHUB_CREATE_A_CODESPACE_FOR_THE_AUTHENTICATED_USER`: - Non-strict: 200 for all six requests across both providers. The request bodies carried `binary`, `base16`, the media type, `repo.nwo`, and `title`. - Strict, OpenAI: 200, 200, 200. - Strict, Anthropic: 200, 200, and **400** on the codespace tool (see Additional context). - **Tests:** core 1884 passed (2 expected fail), json-schema-to-zod 2296, json-schema-to-effect-schema 156, vercel 71, llamaindex 78, claude-agent-sdk 79, langchain 15. - **Other checks:** - typecheck clean for every touched package; `pnpm lint:packages` exit 0; `pnpm validate:changesets` passed. - `pnpm test:provider-compatibility` 5 pass, and `pnpm check:provider-compatibility` passes every lane. - E2E: `vercel-ai-sdk-v6` 21 pass, `vercel-ai-sdk-v7` 24 pass, `claude-agent-sdk` 2 pass (live Anthropic). ## Checklist - [ ] I have read the Code of Conduct and this PR adheres to it - [ ] I have read and understand every line of this diff, including any LLM-generated code - [x] Any third-party docs links or promotional content follow the [third-party links policy](https://github.com/ComposioHQ/composio/blob/next/CONTRIBUTING.md#third-party-links-in-docs) - [x] I ran linters/tests locally and they passed - [x] I updated documentation as needed - [x] I added tests or explain why not applicable - [x] I added a changeset if this change affects published packages ## Additional context **Strict mode and Anthropic:** `VercelProvider({ strict: true })` rewrites each tool's schema into the strict form, but it does not set the AI SDK's per-tool `strict` flag, so neither OpenAI nor Anthropic is asked to enforce it. A live AI SDK 7 check with `GOOGLEDRIVE_CREATE_DRIVE` confirms this: without the flag, both vendors accept the request. With `strict: true` on the tool, Anthropic rejects it ("properties maximum, minimum are not supported") and OpenAI accepts it. So the Anthropic strict-mode rejections seen during development only appear when the flag is set on the tool by hand: - OpenAPI `nullable` on an object, now fixed by https://github.com/ComposioHQ/composio/pull/4997, which this branch includes. - Numeric `minimum`/`maximum`, which 23 of the 816 strict-capable tools carry. Setting the flag is not planned as part of this work. Anthropic strict mode also limits each request, across all strict tools, to 16 union-typed parameters and 24 optional ones, and rejects recursive definitions. The strict rewrite turns every optional parameter into a union, so a request with around ten Composio tools would exceed the limit.