contextpulse
Back to all articles
Engineering 10 min readPublished Sep 4, 2026

MCP Tool Schemas: Validation Patterns That Reduce Agent Retries

Design MCP input schemas that are explicit for developers, usable by agents, and resilient to common model-generated argument shapes.

MC
Maya Chen
Staff Infrastructure Engineer

JSON Schema is the lingua franca of MCP tool definitions. However, standard JSON Schema validators are designed for deterministic software clients, not probabilistic large language models.

When an LLM formats tool arguments, it frequently converts numeric strings to integers, emits nulls for optional parameters, or omits required keys when uncertain. If your server rejects these payloads with an uninformative 'Invalid params' error, the agent will loop 3-5 times until hitting maximum retry limits.

Pattern 1: Permissive Coercion with Strict Ingestion. Use libraries like Zod or Pydantic with pre-parsers that coerce strings into numbers or strip unknown extraneous keys instead of hard failing.

Pattern 2: Rich Error Messages in the Tool Result. Instead of a protocol error, return a helpful suggestion in the tool response: 'Parameter startDate must be ISO 8601 (YYYY-MM-DD), received 2026/09/04. Please format as 2026-09-04.'

Tracking tool error types across Claude, Cursor, and ChatGPT shows that schema friction accounts for over 64% of early agent task abandonment.