Fix db_execute_query parameters input type#110
Merged
nathanjcochran merged 1 commit intomainfrom Nov 19, 2025
Merged
Conversation
…a errors with some models/providers
murrayju
approved these changes
Nov 19, 2025
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.
Some AI models/providers (such as Gemini) were choking on the automatically-generated JSON Schema for the
db_execute_querytool call.This is the schema that was previously being generated for the
db_execute_queryinput type:{ "type": "object", "required": [ "service_id", "query" ], "properties": { "parameters": { "type": "array", "items": true }, "pooled": { "type": "boolean" }, "query": { "type": "string" }, "role": { "type": "string" }, "service_id": { "type": "string" }, "timeout_seconds": { "type": "integer" } }, "additionalProperties": false }It was being auto-generated from this Go type:
The problem was that the
parametersarray didn't specify a type for its elements (because it's[]anyin the Go code), and some models/providers couldn't handle that.This PR fixes the issue by changing the type from
[]anyto[]string, which causes this JSON Schema to be generated instead:{ "type": "object", "required": [ "service_id", "query" ], "properties": { "parameters": { "type": "array", "items": { "type": "string" } }, "pooled": { "type": "boolean" }, "query": { "type": "string" }, "role": { "type": "string" }, "service_id": { "type": "string" }, "timeout_seconds": { "type": "integer" } }, "additionalProperties": false }Notice how the
parameterstype now specifies"items": {"type": "string"}instead of"items": true. This makes it work correctly with Gemini (and probably some other models/providers that couldn't handle an array without an explicit element type).Accepting the query parameters as strings doesn't appear to cause any problems for query execution, even when the placeholders in the Postgres query are expecting different types. The underlying
pgxdriver seems to be able to handle conversions from strings to the correct/expected Postgres types. I asked Claude to test a variety of different queries/parameter types, and they all ran without issue.Fixes #108.