Description
MCP allows specifying outputSchema for tools to provide better type information. When specified, tools must populate structuredContent in their result as well as JSON encode structured data in .content text for backwards compatibility.
Currently, there's no way to leverage this type information with AI SDK's MCP client. I'd expect a way to read .structuredContent just as I'd read .content, but with type information from a defined outputSchema.
Spec:
MCPClient.tools() accepts a schemas option for type checking of tool inputs. Currently this only recognizes inputSchema to type tool inputs, while tool outputs are untyped.
Comparatively, regular tool() definitions accept an outputSchema for typed outputs:
AI SDK Version
Code of Conduct
Description
MCP allows specifying
outputSchemafor tools to provide better type information. When specified, tools must populatestructuredContentin their result as well as JSON encode structured data in.contenttext for backwards compatibility.Currently, there's no way to leverage this type information with AI SDK's MCP client. I'd expect a way to read
.structuredContentjust as I'd read.content, but with type information from a definedoutputSchema.Spec:
MCPClient.tools()accepts aschemasoption for type checking of tool inputs. Currently this only recognizesinputSchemato type tool inputs, while tool outputs are untyped.https://ai-sdk.dev/docs/reference/ai-sdk-core/create-mcp-client#tools.options.schemas
https://ai-sdk.dev/docs/ai-sdk-core/mcp-tools#schema-definition
Comparatively, regular tool() definitions accept an outputSchema for typed outputs:
AI SDK Version
Code of Conduct