TypeError when a message's role, part type, tool-invocation state,
rendered prompt part or provider option is outside what this function
classifies, or is a provider option it refuses because a model adapter
renders it as content. When the conversion itself throws, the TypeError
carries that error as its cause.
Policy text of format-2 messages: the text Mastra renders into the model prompt from them, and every stored model output they carry, joined for policy matching. Tool-call ids, provider metadata such as signatures and item ids, and binary file and image data are not included. File and image media types and decoded text/* payloads, including data: URL payloads, are included. A text/* network URL contributes its URL string; its target is not read. Nor is the encrypted payload, file reference or file data of a provider-executed tool result in an assistant message, where the root of the result's value has the shape a model adapter bundled with Mastra stores for that tool; the same field anywhere else is included, and so is the whole of a result that names a Google server-tool call or answers an Anthropic MCP call, which those adapters send on as content.