@devries-cameron20 / composio Mirror · read-only / commits / a1e7a6f71
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 09:45 UTC

fix(json-schema-to-zod): keep guarded tool schemas as objects (#4686)

This PR: - fixes two regressions from https://github.com/ComposioHQ/composio/pull/4316 in the whole-schema guard - keeps the converted schema's Zod kind: guarded nodes now subclass their own class instead of `z.any().pipe(...)`, so an object tool schema stays a `ZodObject` with a `shape` - LangChain, Vercel, and LlamaIndex emitted `{"allOf":[{},{"type":"object",...}]}` for any tool with `anyOf`/`oneOf`/`allOf`/`$ref`/… anywhere; OpenAI returned 400 `schema must be a JSON Schema of 'type: "object"'` and Anthropic returned 400 `input_schema.type: Field required` - Claude Agent SDK (MCP `tools/list`) collapsed those tools to empty parameters - gives the guard's interpreter Unicode-mode spellings of patterns (`toUnicodePattern`): `@cfworker/json-schema` compiles with the `u` flag, so identity escapes like `\_` failed every call with `Invalid regular expression … Invalid escape` - keeps the guard validating raw input before defaults, composes nested guards, and survives `.describe()` - adds regression tests in `test/semantic-regressions.test.ts` (both fail on `next`) ## Verification - live calls through the LangChain and Vercel providers: OpenAI (`gpt-4.1-mini`) and Anthropic (`claude-haiku-4-5`) return 200 with tool calls that parse; before, 400 on both - Claude Agent SDK `tools/list` reports the full object schema - `@composio/json-schema-to-zod` 257 passed; `@composio/core` 1658 passed (2 expected fail); langchain, vercel, llamaindex, claude-agent-sdk, mastra provider suites pass; typecheck, oxlint, prettier clean

Alberto Schiabel committed Sep 30, 2026 at 12:35 UTC a1e7a6f71a2ec4433aa82a419f48642673a3d552

No changes.