Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(core): strip string formats strict mode rejects (#4936)
## Summary OpenAI structured outputs rejects a strict tool whose string schema carries a `format` outside its accepted list, and the 400 fails the whole request, not just that tool. The strict rewrite (`toStrictJsonSchema` in TypeScript, `to_strict_json_schema` in Python) kept every `format`. So any strict request (OpenAI Responses, OpenAI Agents, Vercel, Mastra in strict mode) that included one of these tools failed: - GitHub tools with `format: "uri"` or a custom `format: "repo.nwo"`, for example `GITHUB_CREATE_A_PULL_REQUEST`. - Any file-uploadable parameter, which gets `format: "path"` when auto upload is enabled. This is the first step of https://github.com/ComposioHQ/composio/issues/4911. Once the `/v4` builder from https://github.com/ComposioHQ/composio/pull/4919 is adopted, source `format` values will reach more requests, so the strict rewrite has to filter them first. Designated PR reviewer: [@jkomyno](mailto:alberto@composio.dev). Part of https://github.com/ComposioHQ/composio/issues/4911 ## Changes - Both strict normalizers strip `format` from a schema that admits strings (`type: "string"`, a type array containing `"string"`, or no `type`) unless it is one of `date-time`, `time`, `date`, `duration`, `email`, `hostname`, `ipv4`, `ipv6`, `uuid`. Each removal is recorded as an `unsupported-keyword-stripped` change. - Formats on number and integer schemas (`int64`, `double`, …) are kept, because the API does not check them. - A property named `format` is untouched; only the keyword is. - `contentEncoding` and `contentMediaType` are left in place: the API accepts both in strict mode. - New shared strict corpus case `string-format-outside-accepted-list-stripped`, regenerated into both language copies. - Changeset: `@composio/core` patch. The Python change ships with the Python SDK. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactor/Chore - [ ] Documentation - [ ] Breaking change ## How Has This Been Tested? - **API contract, probed with strict functions on Chat Completions (gpt-5-mini), one property per request:** - HTTP 400 `'<value>' is not a valid format` for `uri`, `path`, `repo.nwo`, `binary`, `DATE-TIME` (the list is case-sensitive), and for `uri` inside `items`, an `anyOf` branch, and `type: ["string", "null"]`. - HTTP 200 for each of the nine accepted string formats; `int32`, `int64`, `double`, `float`, `foo`, and `uri` on integer or number schemas; `contentEncoding: "base64"`; and `contentMediaType: "image/png"`. - **After the fix:** the strict schemas of the six corpus tools that carried `uri` or `repo.nwo`, plus a `format: "path"` parameter, return HTTP 200. - **Local test runs:** - core: 1883 passed, 2 expected fail. - openai 37, openai-agents 19, vercel 15, mastra 63 passed. - Python: 2322 passed, 108 skipped. - core typecheck, eslint, prettier, ruff, and changeset validation all pass. ## 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 `openai/lib/transform`'s `toStrictJsonSchema` throws on `contentEncoding`, but no Composio provider routes schemas through it, so this PR keeps those keywords.