Skip to content

fix: Add Gemini tool schema sanitization to MCP tools as well - #1232

Closed
necaris wants to merge 5 commits into
anomalyco:devfrom
necaris:test/gemini-sanitize
Closed

necaris wants to merge 5 commits into
anomalyco:devfrom
necaris:test/gemini-sanitize

Conversation

@necaris

@necaris necaris commented Jul 23, 2025

Copy link
Copy Markdown
Contributor

In addition to built-in tools in TOOL_MAPPING, add Gemini tool sanitization to MCP.tools() as well. This should have broader effects -- like fixing #1052 .

@necaris
necaris force-pushed the test/gemini-sanitize branch 3 times, most recently from ae235d5 to 7091508 Compare July 28, 2025 12:57
@necaris

necaris commented Jul 28, 2025

Copy link
Copy Markdown
Contributor Author

@thdxr turns out my previous fix didn't go far enough, would appreciate 👀 here too.

necaris and others added 4 commits August 4, 2025 13:34
Extends existing Gemini compatibility by applying provider-specific
transformations at the middleware level, ensuring consistent tool schema
handling for both built-in and MCP tools.

Co-Authored-By: opencode <[email protected]>
Fixed syntax error in session/index.ts where an if statement inside a .then()
block was missing its closing brace, causing TypeScript compilation to fail.

🤖 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <[email protected]>
Implemented the missing transformToolSchema function that converts Zod schemas
to JSON schemas and applies provider-specific transformations. This method is
used by the session chat functionality to transform tool schemas for different
providers, particularly applying Gemini-specific sanitization for Google provider.

The function handles both Zod schemas and plain JSON schema objects, and includes
error handling with logging for failed transformations.

🤖 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <[email protected]>
@necaris
necaris force-pushed the test/gemini-sanitize branch from 7091508 to 7e472f3 Compare August 4, 2025 18:16
@necaris
necaris marked this pull request as draft August 13, 2025 04:50
@thdxr thdxr closed this Sep 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants