vercel/ai · error · MCPClientError
Unsupported request schema. Only ElicitationRequestSchema is
Error message
Unsupported request schema. Only ElicitationRequestSchema is supported.
What it means
onArrowTools/onToolRegistration (mcp-client.ts) accepts an elicitation handler, but only the MCP spec's ElicitationRequestSchema is supported as the request schema. Passing any other schema value (e.g. a different SDK schema object or a mistyped import) is rejected immediately with MCPClientError so unsupported request kinds are never silently registered.
Source
Thrown at packages/mcp/src/tool/mcp-client.ts:1396
return this.getPromptInternal({ name, args, options });
}
complete(
args: CompleteRequestParams & {
options?: RequestOptions;
},
): Promise<CompleteResult> {
return this.completeInternal(args);
}
onElicitationRequest(
schema: typeof ElicitationRequestSchema,
handler: (
request: ElicitationRequest,
) => Promise<ElicitResult> | ElicitResult,
): void {
if (schema !== ElicitationRequestSchema) {
throw new MCPClientError({
message:
'Unsupported request schema. Only ElicitationRequestSchema is supported.',
});
}
this.elicitationRequestHandler = handler;
}
private async onRequestMessage(request: JSONRPCRequest): Promise<void> {
try {
if (request.method === 'ping') {
await this.transport.send({
jsonrpc: '2.0',
id: request.id,
result: {},
});
return;
}View on GitHub (pinned to 69428b1f8b)
Solutions
- Import ElicitationRequestSchema from the same module version the client uses (the package's exported symbol) and pass that exact object as the first argument
- Check your @ai-sdk/mcp (or ai) package version — older versions did not support elicitation; upgrade so the schema and client come from the same release
- If you need a different request kind, do not reuse this API; handle other server requests at the transport level or file/await library support
Example fix
// before
import { ElicitationRequestSchema } from '@modelcontextprotocol/sdk/types.js';
client.experimental_onElicitationRequest(ElicitationRequestSchema, handler);
// after
import { ElicitationRequestSchema } from 'ai/mcp-stdio'; // same package as the client
client.experimental_onElicitationRequest(ElicitationRequestSchema, handler); Defensive patterns
Strategy: validation
Validate before calling
import { ElicitationRequestSchema } from 'ai/mcp-stdio'; // same module the client uses
if (schema !== ElicitationRequestSchema) {
throw new Error('elicitation handler must be registered with ElicitationRequestSchema from this package');
} Try / catch
try {
client.experimental_onElicitationRequest(ElicitationRequestSchema, handler);
} catch (error) {
if (MCPClientError.isInstance(error) && error.message.includes('Unsupported request schema')) {
// fix the schema import/version
}
} Prevention
- Always import ElicitationRequestSchema from the same package/version as the MCP client
- Do not wrap, re-export, or recreate the schema object
- Pin @ai-sdk versions so client and schema come from the same release
When it happens
Trigger: Calling client.experimental_onElicitationRequest (the elicitation handler registration API on DefaultMCPClient) with a first argument that is not the exact ElicitationRequestSchema identity — e.g. passing a re-declared/zod schema, a schema from a different MCP SDK version, or forgetting the argument entirely.
Common situations: Copy-pasting handler registration code from SDKs (like the official TypeScript MCP SDK) that use different schema objects; importing ElicitationRequestSchema from '@modelcontextprotocol/sdk' instead of the AI SDK's mcp package so the identity check (schema !== ElicitationRequestSchema) fails; wrapping or re-exporting the schema.
Related errors
- 'element streams in no-schema mode' functionality not suppor
- 'element streams in object mode' functionality not supported
- 'element streams in enum mode' functionality not supported.
- Unsupported output: ${_exhaustiveCheck}
- Invalid argument for parameter output: Invalid output type.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/a077a155f9057279.
Report an issue: GitHub.