fix: Recursively strip examples from Google provider schemas#2644
fix: Recursively strip examples from Google provider schemas#2644Sushmithamallesh wants to merge 4 commits intonextfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
The Please review and fix the vulnerabilities. You can try running: pnpm audit --fix --prodAudit output |
4b57199 to
62d1128
Compare
The Gemini API rejects function declarations containing `examples` fields in parameter schemas. The Python provider only stripped these at the top level of properties, missing nested schemas (e.g. arrays of objects). The TypeScript provider didn't strip them at all. Both providers now use a schema-aware recursive helper that strips `examples` only when it appears as a JSON Schema annotation keyword, not when it appears as a property name in a `properties` mapping. The helper recurses through `properties` (values), `items`, `anyOf`, `oneOf`, `allOf`, and `additionalProperties`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
62d1128 to
57cd107
Compare
…ic loop - Restructured with Steps (Install, Configure API Keys, Create session) - Added agentic loop using Chat API for both Python and TypeScript - Python uses execute_tool_call + Part.from_function_response - TypeScript uses executeToolCall + functionResponse parts - Added groupId/persist tabs for cross-step language sync - Pending full e2e test (blocked on SDK fix PR #2644 for examples stripping) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ic loop - Restructured with Steps (Install, Configure API Keys, Create session) - Added agentic loop using Chat API for both Python and TypeScript - Python uses execute_tool_call + Part.from_function_response - TypeScript uses executeToolCall + functionResponse parts - Added groupId/persist tabs for cross-step language sync - Pending full e2e test (blocked on SDK fix PR #2644 for examples stripping) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| cleaned.additionalProperties = cleanSchema(cleaned.additionalProperties as Record<string, unknown>); | ||
| } | ||
|
|
||
| return cleaned; |
There was a problem hiding this comment.
TypeScript cleanSchema lacks non-object input guard
Low Severity
The Python _clean_schema guards against non-dict inputs at the top (if not isinstance(schema, dict): return schema), but the TypeScript cleanSchema has no equivalent guard. When recursing into anyOf/oneOf/allOf array elements via .map(s => cleanSchema(s)), if any element is null or undefined, Object.entries() will throw a TypeError. If an element is a boolean (valid in JSON Schema as a boolean schema), it silently returns {} instead of preserving the original value, corrupting the schema semantics.
Additional Locations (1)
…der-strip-examples
|
Claude finished @jkomyno's task in 2m 4s —— View job PR Review CompleteI've reviewed this PR according to the documentation review guidelines. Here are my findings: ContextThis PR contains:
Implementation Review (Python & TypeScript Providers)✅ What Works WellThe core fix correctly addresses the stated problem:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| | 6 | `ts/e2e-tests/README.md` | Update 3 code examples with `TIMEOUTS.FIXTURE` | | ||
| | 7 | `ts/e2e-tests/_utils/README.md` | Update TIMEOUTS table + code examples | | ||
| | 8 | `ts/e2e-tests/_utils/src/e2e.ts` | Update JSDoc example | | ||
| | 9 | `ts/e2e-tests/_utils/src/types.ts` | Update JSDoc example | |
There was a problem hiding this comment.
Unrelated plan file accidentally committed with PR
Low Severity
The file plans/refactor-e2e-fixture-timeouts.md is entirely unrelated to this PR, which is about recursively stripping examples from Google provider schemas. This plan document is about bumping e2e fixture beforeAll timeouts and LLM_SHORT, a completely separate task. It also contains internal inconsistencies — the FIXTURE value is listed as 15_000 in the text descriptions (lines 24, 105, 151) but 60_000 in the code block (line 29).


Summary
examplesfields in parameter schemascomposio_google): Only strippedexamplesat the top level of properties, missing nested schemas (e.g. arrays of objects with their ownexamplesfields)@composio/google): Didn't stripexamplesat allBoth providers now use a recursive helper to strip
examplesfrom the entire schema tree before creating function declarations.Test plan
session.tools()with GoogleProvider no longer throws protobuf errors (Python)session.tools()with GoogleProvider no longer causes 400 errors from Gemini API (TypeScript)🤖 Generated with Claude Code