Wymcp.Plugs.Validate (Wymcp v0.7.1)

View Source

Message validation: checks the parsed body against the era's compiled protocol schema (Wymcp.JsonRpc.validate_mcp_request/2) and answers a non-conforming message with HTTP 400 plus -32600, carrying the validator's distilled error — the one-line summary as the envelope's message, one entry per instance location under data.errors. This body's reader is the human debugging a client rather than an LLM, since no LLM authors a JSON-RPC message, so it keeps per-location detail where the tool-arguments path is tuned for a next action. The message a client sends back is not reflected: the client already holds it, and a body of junk answered with a copy of itself doubled the bytes on the wire for nothing.

Two message kinds bypass validation, each because validating it could only produce an answer the protocol forbids:

  • a JSON-RPC response — a client's answer to a server-initiated request. It is not a protocol request at all, and Wymcp.Plugs.Dispatch delivers it to the session that minted its id. That bypass is legacy-only: a client's answer to a server-initiated request reaches wymcp only on the legacy lane. The contract survives via MRTR on the modern lane, and the bypass goes at the legacy decommission.
  • a modern-lane notificationWymcp.Plugs.Dispatch answers it with the acceptance whatever its body, and JSON-RPC forbids an error response to a notification.

What the legacy schema checks is framing, not vocabulary: a legacy body naming a method outside the legacy method table passes it, and so does one naming a notification's method beside an id, or a request's method without one. Which bodies reach a method at all, and which methods wymcp acts on, is Wymcp.Plugs.Dispatch's to decide, there — by message classification first, then its table.

An unset era assign reads :legacy: era classification exists only on the POST pipeline, and the default lane for a signal-less request is the legacy one. The default is legacy-only: it exists only because two eras do, and it goes at the legacy decommission.