Hi, this might be a silly question but I couldn't figure this out on my own. Before creating this issue I looked into documentation and especially type definitions a lot.
NOTE: If I cast the type of .toJSONSchema() TypeScript error disappears but I really would not prefer that. Also I'm aware of there is no example for this usage anywhere (not that I'm aware of) but I wondered if it's possible to use zod schemas here. I really searched through the examples and looked into type definitions before creating this post but since flow completes with this usage too I just wanted to find out proper way to do it this way.
Hi, this might be a silly question but I couldn't figure this out on my own. Before creating this issue I looked into documentation and especially type definitions a lot.
I'm trying to use Zod schemas for
requestedSchemainelicitInput()in MCP server tool registration.Example Code
Things I verified
Even though the zod schema usage gives TypeScript error when I run this code the MCP Client request handler gets the identical payloads. Logs I took from MCP Client request handler, data is request handler parameter.
Logs
If MCP Client request handler returns something that does not match enum options for elicitation requests, MCP Server error block returns the value with correct information, I mean like which step failed and why.
If correct values returned from MCP Client request handler, tool success response returns and elicitation form input data entered is available without any problem.
Before running this flow and get the logs I log the result of zodSchema.toJSONSchema() and compared it. It has 2 extra field only and I'm not sure does that matter because MCP client server communication successfully completes with correct data or returns error with correct rejection reason
`.toJSONSchema()` Output
NOTE: If I cast the type of
.toJSONSchema()TypeScript error disappears but I really would not prefer that. Also I'm aware of there is no example for this usage anywhere (not that I'm aware of) but I wondered if it's possible to use zod schemas here. I really searched through the examples and looked into type definitions before creating this post but since flow completes with this usage too I just wanted to find out proper way to do it this way.