You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Calling a tool with structured output that returns an array of objects throws an error #872
Describe the bug
I am using the cli option to get a tool result of a tool with structured output that returns an array of objects. But instead of getting the result I get the following error:
I was reviewing older issues and noticed this mentions returning an array, but structuredContent can only be an object per the MCP schema:
"structuredContent": {
"additionalProperties": {},
"description": "An optional JSON object that represents the structured result of the tool call.",
"type": "object"
}
Activity
feat: skip outputSchema generation for array root responses
feat: skip outputSchema generation for array root responses (#26)
olaservo commentedon Dec 4, 2025
I was reviewing older issues and noticed this mentions returning an array, but
structuredContentcan only be an object per the MCP schema:This is a known limitation. (btw, [SEP-834](modelcontextprotocol/modelcontextprotocol#834) proposes loosening this restriction to allow any JSON (including arrays) validated by
outputSchema.)Workaround: Wrap the array in an object:
With a corresponding
outputSchema:{ "type": "object", "properties": { "sessions": { "type": "array", "items": { ... } } } }