McpServer.enableOutputSchemaValidation

Opt in to enforcing each tool's declared outputSchema before the result is sent. Per the spec, "If an output schema is provided: Servers MUST provide structured results that conform to this schema." With validation enabled, both halves of that MUST are enforced: a successful result for a tool that declares an outputSchema must (a) carry structuredContent and (b) have it conform to the schema. A handler that omits structuredContent or emits non-conforming structuredContent surfaces a clear internal error (so the bug is caught at the server) rather than silently shipping bad output. Tools without an outputSchema are unaffected; tool-execution errors (isError:true) and MRTR InputRequiredResults are exempt (the MUST governs successful structured results). Off by default to preserve existing behaviour.

class McpServer
@safe
void
enableOutputSchemaValidation
()