What happens
The MCP server fails tools/list outright — clients load zero tools — whenever any tool's input schema contains a z.date() field. With trigger.dev@4.6.0:
trigger: npx trigger.dev@latest mcp - ! Connected · tools fetch failed — Date cannot be represented in JSON Schema
Reproduce directly against the CLI:
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"p","version":"1"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
| npx trigger.dev@4.6.0 mcp
# -> {"jsonrpc":"2.0","id":2,"error":{"code":-32603,"message":"Date cannot be represented in JSON Schema"}}
Expected
tools/list succeeds and date fields serialize to a JSON Schema string (e.g. { "type": "string", "format": "date-time" }), matching how the Zod 3 path already handles z.date().
Root cause
In @trigger.dev/schema-to-json, convertZod4Schema() (packages/schema-to-json/src/index.ts) calls z4.toJSONSchema() without the unrepresentable option, so it defaults to "throw". Any z.date() throws Date cannot be represented in JSON Schema, which aborts the entire conversion and fails the whole tools/list response.
Version info
- Broken:
trigger.dev@4.6.0 (also present on main).
- Works:
4.5.16, 4.5.0, 4.4.6.
Suggested fix
Pass unrepresentable: "any" to z4.toJSONSchema() so unrepresentable nodes emit {} and reach the existing override callback, and add a date case to override rewriting to { type: "string", format: "date-time" }. (Happy to open a PR.)
What happens
The MCP server fails
tools/listoutright — clients load zero tools — whenever any tool's input schema contains az.date()field. Withtrigger.dev@4.6.0:Reproduce directly against the CLI:
Expected
tools/listsucceeds and date fields serialize to a JSON Schema string (e.g.{ "type": "string", "format": "date-time" }), matching how the Zod 3 path already handlesz.date().Root cause
In
@trigger.dev/schema-to-json,convertZod4Schema()(packages/schema-to-json/src/index.ts) callsz4.toJSONSchema()without theunrepresentableoption, so it defaults to"throw". Anyz.date()throwsDate cannot be represented in JSON Schema, which aborts the entire conversion and fails the wholetools/listresponse.Version info
trigger.dev@4.6.0(also present onmain).4.5.16,4.5.0,4.4.6.Suggested fix
Pass
unrepresentable: "any"toz4.toJSONSchema()so unrepresentable nodes emit{}and reach the existingoverridecallback, and add adatecase tooverriderewriting to{ type: "string", format: "date-time" }. (Happy to open a PR.)