The spec is inconsistent about whether outputSchema must have type: "object" at the root level.
Prose docs (does not require object)
docs/specification/draft/server/tools.mdx describes outputSchema without any type restriction:
outputSchema: Optional JSON Schema defining expected output structure
- Follows the JSON Schema usage guidelines
- Defaults to 2020-12 if no
$schema field is present
This contrasts with inputSchema, which explicitly requires type: "object".
JSON schema (requires object)
schema/draft/schema.json requires type: "object":
"outputSchema": {
"properties": {
"type": {
"const": "object",
"type": "string"
}
},
"required": ["type"],
...
}
Implementations
The Python SDK implemented the prose interpretation, allowing arrays and primitives. The TypeScript SDK implemented the schema interpretation, rejecting non-object schemas. This breaks interoperability for tools that want to return arrays (e.g. list operations) or primitives.
See: modelcontextprotocol/typescript-sdk#1149
Proposal
We should make things consistent one way or the other. I don't mind too much either way but we should choose one!
For making it permissive: It's an awkward restriction that makes defining JSON schemas more fiddly. Additionally, this would be less likely to break existing implementations.
For making it object: I'm not sure how many people are using the Python SDK in the permissive way which would be a breaking change, but changing it to require type: "object" would bring it into harmony with inputSchema.