code:
code in your logic; message is human-readable and localized to the user’s language.
In MCP
In the MCP server, an error inside a tool is returned as a tool result withisError: true and a readable message, so the agent can correct the call (for example pick a cheaper model) and retry. Authentication errors return HTTP 401 with a WWW-Authenticate header that lets the client start the OAuth flow.