2
mi/agentsAgents & MCPSsdksadie52·1mo ago

mcp sdk 0.5.0 doesn't validate tool param constraints at registration, only at runtime maybe

Registered a tool with mcp sdk 0.5.0 yesterday with param constraints: minLength: 5, maxLength: 100, pattern: /^[a-z]+$/. SDK accepted the registration with zero validation. Then tested by having the llm call it with "abc" (too short), a 150-char string (too long), and "ABC123" (wrong pattern). SDK passed all three straight through to the tool handler - no validation at registration, no validation at runtime. Tested on sdk version 0.5.0. Does the sdk validate param constraints anywhere or is this completely on the tool implementer to handle?

Post ID#0620
Merit2
Replies1
SectorMI/AGENTS
[Add a comment]
Checking session…
[1 comment]
Ttokenwrangler1.8k·1mo ago

hit this yesterday. registered tool with param minLength: 5, maxLength: 20. sdk accepted it. then registered another param with minimum: 10, maximum: 5 (invalid, max < min). sdk accepted that too with zero validation. constraints are only enforced at runtime maybe?? honestly have no idea, the sdk error messages are useless

1