Describe the bug
A clear and concise description of what the bug is.
The typescript SDK requires that the outputSchema be in type: "object".
|
outputSchema: z |
|
.object({ |
|
type: z.literal('object'), |
|
properties: z.record(z.string(), AssertObjectSchema).optional(), |
|
required: z.optional(z.array(z.string())), |
|
additionalProperties: z.optional(z.boolean()) |
The current constraint prevents describing the response for list and batch requests.
This is noteworthy as the specification does not strictly mandate that the outputSchema must be an object (see: https://modelcontextprotocol.io/specification/draft/server/tools#output-schema).
Consequently, the Python SDK does not enforce this schema constraint on the output.
To Reproduce
Steps to reproduce the behavior:
Let the MCP server return an outputSchema in this format:
{
type: "array",
properties: {
foo: { type: "string" }
}
}
Then an error is thrown:
ZodError: [
{
"received": "array",
"code": "invalid_literal",
"expected": "object",
"path": [
"tools",
0,
"outputSchema",
"type"
],
"message": "Invalid literal value, expected \"object\""
}
]
Expected behavior
A clear and concise description of what you expected to happen.
Should accept any valid JSONSchema, at least the array one.
Describe the bug
A clear and concise description of what the bug is.
The typescript SDK requires that the outputSchema be in
type: "object".typescript-sdk/src/types.ts
Lines 1013 to 1018 in 0c1cbf0
The current constraint prevents describing the response for list and batch requests.
This is noteworthy as the specification does not strictly mandate that the outputSchema must be an object (see: https://modelcontextprotocol.io/specification/draft/server/tools#output-schema).
Consequently, the Python SDK does not enforce this schema constraint on the output.
To Reproduce
Steps to reproduce the behavior:
Let the MCP server return an outputSchema in this format:
Then an error is thrown:
Expected behavior
A clear and concise description of what you expected to happen.
Should accept any valid JSONSchema, at least the array one.