#8611·skyvern

[Bug]: MCP tool `skyvern_finish` schema fails Gemini API validation (missing `items` on array type)

Author: ankit-jhaCreated Sep 18, 2026Updated Sep 18, 2026
LabelsbugBackend

Summary

When connecting Skyvern's MCP server to AI clients backed by Google Gemini models (e.g. Gemini 1.5/2.0/3.7 via VS Code GitHub Copilot / Cursor / Gemini CLI), all chat requests immediately fail with HTTP 400 INVALID_ARGUMENT.

Environment & Setup

  • Server: https://api.skyvern.com/mcp/
  • Scopes Tested: all, lean
  • Client: VS Code Copilot / MCP Client using Gemini 3.7 / 2.0 / 1.5 models

Error Details

json
{
  "error": {
    "code": 400,
    "message": "* GenerateContentRequest.tools[0].function_declarations[...].parameters.properties[output].any_of[1].items: missing field.\n",
    "status": "INVALID_ARGUMENT"
  }
}

Root Cause

In skyvern/cli/mcp_tools/output_tools.py, the skyvern_finish tool defines its output field as:

python
output: Annotated[
    Any,
    Field(
        description="Optional final JSON value: object, array, string, number, boolean, or null",
        # Any generates an empty schema; directory listing requires every param to carry a type.
        json_schema_extra={"type": ["object", "array", "string", "number", "boolean", "null"]},
    ),
] = None,

When converted to an OpenAPI / JSON Schema anyOf representation:

  • any_of[0]: {"type": "object"}
  • any_of[1]: {"type": "array"} (missing items specification)
  • any_of[2]: {"type": "string"}
  • ...

While OpenAI (GPT) and Anthropic (Claude) APIs tolerate array schemas without an items field, the Google Gemini Function Calling API strictly requires items for every schema definition of type: "array". Because items is missing, Gemini rejects the entire function declaration list with HTTP 400.

Steps to Reproduce

  1. Configure Skyvern MCP in VS Code mcp.json (or any Gemini-based MCP client):
    json
    "skyvern": {
        "type": "http",
        "url": "https://api.skyvern.com/mcp/",
        "headers": {
            "x-api-key": "YOUR_API_KEY",
            "X-Skyvern-Scope": "lean"
        }
    }
  2. Set the active model to Gemini 3.7 Flash or Gemini 2.0 Flash / Pro.
  3. Send any prompt in the chat.
  4. Request fails with INVALID_ARGUMENT: ...properties[output].any_of[1].items: missing field.

Suggested Fix

Ensure that the array branch in the schema definition specifies items: {} (or appropriate item schema), or sanitize the tool schema generation to always provide an empty schema {} for items when an array type is declared without specific element typing.