File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -394,6 +394,23 @@ Structured results are automatically validated against the output schema
394394generated from the annotation. This ensures the tool returns well-typed,
395395validated data that clients can easily process.
396396
397+ ##### Validation Timing and Side Effects
398+
399+ Output-schema validation happens after the tool function returns. If a tool
400+ performs side effects before returning, those side effects are not rolled back
401+ when structured-output validation fails.
402+
403+ A validation failure means the tool implementation and its declared schema are
404+ out of sync. Treat it as a server bug, not as a signal that the operation was
405+ safe to retry.
406+
407+ For tools with important side effects, prefer patterns that make the state
408+ explicit, for example:
409+
410+ - return an operation or job identifier and expose completion state separately
411+ - separate "start work" from "fetch result" into different tools or resources
412+ - keep the structured result shape stable and version schema changes carefully
413+
397414** Note:** For backward compatibility, unstructured results are also
398415returned. Unstructured results are provided for backward compatibility
399416with previous versions of the MCP specification, and are quirks-compatible
You can’t perform that action at this time.
0 commit comments