Skip to content

fix(schema): use []string for QueryDatalogInput.Inputs to satisfy Gemini API#3

Merged
skridlevsky merged 1 commit into
skridlevsky:mainfrom
rainerkruschwitz:fix/gemini-schema-array-items
Mar 10, 2026
Merged

fix(schema): use []string for QueryDatalogInput.Inputs to satisfy Gemini API#3
skridlevsky merged 1 commit into
skridlevsky:mainfrom
rainerkruschwitz:fix/gemini-schema-array-items

Conversation

@rainerkruschwitz
Copy link
Copy Markdown
Contributor

Problem

When using graphthulhu with Google Gemini-based AI clients, MCP tool registration fails with HTTP 400:

GenerateContentRequest.tools[N].function_declarations[0].parameters.properties[inputs].items: missing field.

The root cause is QueryDatalogInput.Inputs []any — Go's []any generates a JSON Schema array without an items field, which violates the JSON Schema spec. Anthropic's API accepts this silently; Google's API rejects it with a 400 error, making graphthulhu unusable with Gemini-based clients.

Fix

Change Inputs from []any to []string. DataScript query bindings are scalar values (strings, numbers) that can be represented as strings in practice. A small conversion loop in QueryDatalog bridges []string back to []any for the internal DatascriptQuery call.

Changes:

  • types/tools.go: []any[]string
  • tools/search.go: convert []string to []any before passing to DatascriptQuery

Testing

Verified that DataScript queries work correctly after the change:

[:find ?name :where [?p :block/name ?name] [(clojure.string/includes? ?name "mypage")]]

Returns matching page names as expected.

…ini API

When using graphthulhu with Google Gemini-based AI clients, tool
registration fails with HTTP 400:

  tools[N].function_declarations[0].parameters.properties[inputs].items: missing field

The root cause: []any generates a JSON Schema array without an 'items'
field. Anthropic's API accepts this silently; Google's API rejects it.

Fix: change Inputs to []string. DataScript bindings are scalar values
that can be represented as strings. A conversion loop in QueryDatalog
bridges []string back to []any for the internal DatascriptQuery call.
@skridlevsky
Copy link
Copy Markdown
Owner

Clean fix. Thanks for catching this.

@skridlevsky skridlevsky merged commit 883f5bc into skridlevsky:main Mar 10, 2026
1 check passed
@rainerkruschwitz
Copy link
Copy Markdown
Contributor Author

Thanks, helps me a lot with Antigravity

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