fix(tools): make object schemas OpenAI-safe - #1232
Merged
Merged
Conversation
Contributor
Author
|
The issue I'm fixing here is that with Codex, the agent fails to use the |
Contributor
Greptile SummaryThe PR makes agent-tool object arguments compatible with strict OpenAI schemas and normalizes their alternate wire representations before dispatch.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/gateway/src/mcp_agent_tools.rs | Replaces the MCP environment map schema with strict-compatible entries and normalizes them before service dispatch. |
| crates/home-assistant/src/tool.rs | Adds JSON-string alternatives for Home Assistant data objects and validates them before live operations. |
| crates/tools/src/webhook_tool.rs | Expands the webhook patch schema and normalizes stringified configuration objects and nested null filters. |
Reviews (2): Last reviewed commit: "fix(tools): make object schemas OpenAI-s..." | Re-trigger Greptile
OpenAI strict tool schemas close objects with additionalProperties=false.
Unspecified patch and map schemas therefore forced Codex to send null or
empty values instead of the requested data.
Declare the webhook patch fields, represent MCP environment variables as
fixed name/value entries, and provide JSON-string alternatives for
free-form webhook configuration and Home Assistant data objects.
Normalize these representations before dispatch, including
strict-generated nulls in nested webhook filters.
I changed the MCP `env` tool argument from a free-form object to an
array of `{name, value}` entries so it's expressible under strict OpenAI
schemas. There is no need to preserve backwards compatibility with the
old format here: it's a rarely used tool, and models are expected to
respond with the new format now based on schema they receive with every
request.
Nullable webhook fields were already not clearable with any provider,
this is not a regression. This change enables ordinary OpenAI updates
but does not lift that pre-existing limitation.
IlyaBizyaev
force-pushed
the
fix/tool-schemas
branch
from
August 24, 2026 16:47
300cfc7 to
831eb78
Compare
Contributor
Author
|
#1226 happened to do the |
Collaborator
|
@greptileai review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenAI strict tool schemas close objects with
additionalProperties=false. Unspecified patch and map schemas therefore forced Codex to send null or empty values instead of the requested data.Declare the webhook patch fields, represent MCP environment variables as fixed name/value entries, and provide JSON-string alternatives for free-form webhook configuration and Home Assistant data objects. Normalize these representations before dispatch, including strict-generated nulls in nested webhook filters.
I changed the MCP
envtool argument from a free-form object to an array of{name, value}entries so it's expressible under strict OpenAI schemas. There is no need to preserve backwards compatibility with the old format here: it's a rarely used tool, and models are expected to respond with the new format now based on schema they receive with every request.Nullable webhook fields were already not clearable with any provider, this is not a regression. This change enables ordinary OpenAI updates but does not lift that pre-existing limitation.