Skip to content

Agent chat fails with Gemini: artifacts tool schema has invalid array type without items #96

@mj-deving

Description

@mj-deving

Bug

The Chrome extension agent chat (and /v1/agent API) fails with a 400 Bad Request when using Gemini models with automation enabled.

Error

GenerateContentRequest.tools[0].function_declarations[5].parameters.properties[content].any_of[2].items: missing field

Root Cause

In dist/esm/daemon/agent.js, the artifacts tool definition has:

content: {
    description: "Content to store (string or JSON-serializable object)",
    type: ["string", "object", "array", "number", "boolean", "null"],
},

Gemini's API internally converts type: [...] arrays into an anyOf schema. The "array" variant (index 2) requires an items field to be valid, but none is provided. This causes the 400 error.

Other providers (OpenAI, Anthropic) are more lenient and accept the union type without items, so this only affects Gemini.

Reproduction

curl -s -X POST "http://127.0.0.1:8787/v1/agent" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "automationEnabled": true,
    "messages": [{"role": "user", "content": "Hello"}],
    "model": "google/gemini-2.0-flash",
    "tools": ["summarize", "navigate", "repl", "ask_user_which_element", "skill", "artifacts"]
  }'

Workaround

Change the content property type in the artifacts tool definition to a simple string:

content: {
    description: "Content to store (string or JSON-serializable object). For arrays or complex objects, pass as a JSON string.",
    type: "string",
},

Environment

  • summarize v0.11.1
  • Windows 11
  • Model: google/gemini-2.0-flash
  • Chrome extension with automation enabled

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions