MCP: Model Context ProtocolBeginnerModule 05 — Understanding MCP tools

What types of content can MCP tools return?

Question 42 of 43 · Updated

On this page

Direct answer#

MCP tools can return more than plain text. In the historical 2025-06-18 MCP specification, a successful or failed tool invocation can return a result containing a content array with typed blocks: text, images, audio, resource links and embedded resources. One result can combine several block types.

For example, a delivery assistant could receive a shipment status, a photo of the delivery location and a link to the proof-of-delivery document from one tool call.

1. The five content block types#

Block typeImportant fieldsPractical use
texttextStatus messages, explanations or serialized data
imagedata, mimeTypeDelivery photo or chart
audiodata, mimeTypeVoice note or recorded message
resource_linkuri, name; optional metadataReference to a document or other resource
resourceresource containing uri and text or blobInclude a document or other resource's contents directly

The type field identifies each block's representation. Image and audio data are Base64-encoded binary content with a MIME type. Embedded binary resources use a blob field containing Base64 data. A resource link supplies a reference rather than the actual contents.

Not every host or model provider can consume all these representations. The host must decide how to present or process each supported type without silently losing important information.

2. A practical mixed-content response#

Suppose the assistant invokes get_delivery_details for shipment SHP-1042. The following fictional response combines a text status, a link to the proof-of-delivery PDF and an embedded text summary.

JSON
{ "jsonrpc": "2.0", "id": 21, "result": { "content": [ {"type": "text", "text": "Shipment delivered."}, { "type": "resource_link", "uri": "shipment://SHP-1042/proof", "name": "delivery-proof", "mimeType": "application/pdf" }, { "type": "resource", "resource": { "uri": "shipment://SHP-1042/summary", "mimeType": "text/plain", "text": "Delivered to reception." } } ] } }

The result already includes the delivery status and summary. It does not contain the PDF itself. If the host needs the document, it can attempt the appropriate authorized resource retrieval, such as resources/read with the supplied URI when supported by the server.

A resource link returned by a tool is not guaranteed to appear in resources/list. Preserve the originating server and check access when resolving it. The fictional shipment URI is not a public download URL.

3. Image and audio blocks#

An image block contains the actual encoded image bytes:

JSON
{ "type": "image", "mimeType": "image/png", "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGNgYGAAAAAEAAH2FzhVAAAAAElFTkSuQmCC" }

An audio block has a similar shape:

JSON
{ "type": "audio", "mimeType": "audio/wav", "data": "UklGRiUAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQEAAACA" }

These are complete, small test blocks: a 1-by-1 black PNG and a WAV containing one silent sample. They are not actual delivery photographs or voice recordings. Their payloads were successfully decoded locally.

In production, the same fields could carry a delivery photograph or a recorded courier message. Base64 is an encoding, not encryption or compression. It adds roughly one-third to binary payload size before other JSON overhead. Limit message and decoded media sizes, verify the actual format and use suitable parsers.

Choose a resource link when...Choose an embedded resource when...
The document is large or may not be neededThe relevant content is small and needed immediately
The host should retrieve it selectivelyAvoiding another retrieval is useful
You want to keep a reference to identified contentYou want to include the returned content itself

Both representations identify a resource by URI. The embedded form includes text or binary blob inside the resource object. The link does not include the resource body.

For instance, return a short delivery summary directly and link to a large PDF instead of transferring the full PDF on every tracking request. Neither representation grants permission to retrieve or disclose private information.

5. How a host should handle mixed content#

Loading diagram…

A client should preserve block types and order rather than assuming every block has a text field. A text-only model may need a separate authorized media-processing step, or the host may display the media directly to the user.

Treat resource URIs and returned text as untrusted data. Do not automatically fetch arbitrary URLs, forward private content to a model, or obey instructions embedded in a tool result. If media is unsupported, communicate that limitation instead of inventing what it contains.

6. Content is not the same as structuredContent#

The content array carries typed blocks. A text block can contain JSON serialized as a string, but it remains text. The historical 2025-06-18 tool result can also contain an optional structuredContent object for machine-readable output, with an applicable outputSchema contract.

For example, a shipment status in text might be "Shipment delivered." A structured business object could instead be {"status":"delivered"}. These can coexist in a result; the structured object is not another content block.

Also inspect isError when interpreting results. A result can carry an error explanation in its content array. The presence of text or an image is not proof of business success.

Q52 covers structured output, outputSchema and compatibility handling in detail.

Interview-ready answer#

MCP tools can return an array of typed content blocks, including text, Base64-encoded images and audio, resource links and embedded resources. Multiple types can coexist in one result. Resource links identify content for potential later retrieval, whereas embedded resources include their content directly. Clients should preserve types, validate payloads, respect access controls and process only supported representations. StructuredContent is a separate machine-readable result field.

References and verification#

Historical MCP 2025-06-18 baseline; authorized offline research and changelog exceptions applied. Official references were not checked live. Six local Python 3.13.5 checks passed on the three JSON examples, using JSON parsing, strict Base64 decoding, Pillow 12.3.0 for PNG and the standard-library wave reader for WAV. No full MCP schema validator, SDK, real resource retrieval, live transport or model-provider integration was exercised. Mermaid and website rendering remain unverified. Test implementation omitted from the article to keep the lesson focused.

References

  1. 1.
    MCP tools specificationmodelcontextprotocol.io
  2. 2.
    MCP resources specificationmodelcontextprotocol.io
  3. 3.
    MCP historical specificationmodelcontextprotocol.io
  4. 4.

Related questions

Explore other topics:Forward Deployed EngineeringAI AgentsLarge Language ModelsRetrieval-Augmented Generation