[Bug]: MCP tool `skyvern_finish` schema fails Gemini API validation (missing `items` on array type)
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
{
"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:
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"}(missingitemsspecification)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
- Configure Skyvern MCP in VS Code
mcp.json(or any Gemini-based MCP client):"skyvern": { "type": "http", "url": "https://api.skyvern.com/mcp/", "headers": { "x-api-key": "YOUR_API_KEY", "X-Skyvern-Scope": "lean" } } - Set the active model to Gemini 3.7 Flash or Gemini 2.0 Flash / Pro.
- Send any prompt in the chat.
- 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.
Source: Skyvern-AI/skyvern