Skip to content

@effect/ai-google: Gemini rejects primitive tool results (requires object) #6008

@lucas-barake

Description

@lucas-barake

What version of Effect is running?

  • @effect/ai-google: 0.12.1
  • effect: 3.19.15

What steps can reproduce the bug?

Define a tool with a primitive success or failure schema (e.g., Schema.String, Schema.Number):

const SearchTool = Tool.make("search", {
  description: "Search for items",
  parameters: { query: Schema.String },
  success: Schema.String, // or failure: Schema.String with failureMode: "return"
})

When the tool executes and returns a primitive value, the agentic loop fails on iteration 2 (when the tool result is sent back to Gemini) with:

Invalid value at 'contents[2].parts[0].function_response.response' (type.googleapis.com/google.protobuf.Struct), "Found 5 results"

What is the expected behavior?

Primitive tool results should work with Gemini.

What do you see instead?

Gemini's function_response.response field requires a Struct (object), but primitive values are sent directly, causing a 400 error when the tool result is sent back on iteration 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions