Problem
Numeric parameters (rows, page_size, start, limit, offset, etc.) are defined with z.number() in Zod schemas. Some MCP clients pass these values as JSON strings instead of numbers, causing validation errors:
MCP error -32602: Input validation error:
"code": "invalid_type",
"expected": "number",
"received": "string",
"path": ["rows"]
Affected files
src/tools/package.ts — 11 occurrences (rows, start, facet_limit, page, page_size, content_recent_days, limit, boost weights)
src/tools/organization.ts — 2 occurrences (limit, offset)
src/tools/datastore.ts — 2 occurrences (limit, offset)
Fix
Replace z.number() with z.coerce.number() for all numeric tool parameters. Zod's coerce converts string "3" → number 3 transparently, with no behavioral change when the value is already a number.
Reproduction
Call ckan_package_search with rows: "3" (string) via a local stdio MCP client — validation fails. The hosted version already handles this correctly.
Problem
Numeric parameters (
rows,page_size,start,limit,offset, etc.) are defined withz.number()in Zod schemas. Some MCP clients pass these values as JSON strings instead of numbers, causing validation errors:Affected files
src/tools/package.ts— 11 occurrences (rows,start,facet_limit,page,page_size,content_recent_days,limit, boost weights)src/tools/organization.ts— 2 occurrences (limit,offset)src/tools/datastore.ts— 2 occurrences (limit,offset)Fix
Replace
z.number()withz.coerce.number()for all numeric tool parameters. Zod's coerce converts string"3"→ number3transparently, with no behavioral change when the value is already a number.Reproduction
Call
ckan_package_searchwithrows: "3"(string) via a local stdio MCP client — validation fails. The hosted version already handles this correctly.