A report export can finish before the agent needs to read it. Return a short summary with a resource link so the host can retrieve the report when the task calls for it. Keep the CSV out of the initial response.

MCP’s resource_link content block identifies a resource without embedding its contents.1 The example below uses it for a CSV export. You’ll need to build the export service yourself; the report names, URIs, and lifecycle rules are illustrative.

1. Decide what belongs in the immediate result

For an export job, the caller needs the completion status, the dataset covered, and a way to retrieve the report.

Keep those answers in the immediate response. Put the full report behind a separate read. Do not use a link to hide a failure or omit a warning that affects whether the result is usable.

The next step determines how much data to return:

  • Return a small answer inline when the next step needs all of it.
  • Return a summary and link when the artifact is optional context or a download.
  • Offer filtering or pagination when the next step needs selected records rather than a complete export.

The tool-result pagination guide covers the last case. Linking and pagination solve different retrieval needs.

2. Return a named artifact

Put this illustrative content array inside a completed tool result. A full JSON-RPC response needs the surrounding envelope:

[
  {
    "type": "text",
    "text": "The requested report is ready. Read the linked CSV for the exported records."
  },
  {
    "type": "resource_link",
    "uri": "report://exports/export_demo_001",
    "name": "report.csv",
    "description": "CSV export for the requested reporting window",
    "mimeType": "text/csv"
  }
]

The tools specification defines resource links with a URI and name, and supports descriptive metadata such as a MIME type. It also states that links returned by tools are not guaranteed to appear in resources/list.1 Your client should open the returned URI directly.

Choose an opaque export identifier and store its ownership separately. Avoid putting customer names, access tokens, or sensitive query parameters into artifact identifiers.

3. Choose the retrieval route

For this example, declare the server’s resources capability and implement a resources/read handler that resolves the report:// URI through the originating MCP server. The resources specification defines both requirements and permits custom URI schemes. It recommends https:// when a client can fetch the resource directly from the web without reading it through the MCP server.2

Also implement resources/list when declaring that capability. Its authorized result set may be empty; it need not expose every tool-linked export.2

Keep artifacts that depend on your MCP service’s access checks behind a server-resolved URI. For a web-fetchable artifact, review the HTTPS URL’s access and expiry policy separately.

Do not assume the host understands a custom scheme merely because it renders a link. Test both display and retrieval in the host you intend to support. MCP leaves resource presentation and context inclusion to the host.2

4. Give artifacts an access and expiry policy

The reporting service needs its own access and expiry records. Implement these checks:

  1. Record the export owner, tenant, creation time, and expiry time.
  2. Authorize every read against the current caller.
  3. Reject unknown, expired, and cross-tenant identifiers without returning report contents.
  4. Resolve identifiers through an artifact table rather than turning arbitrary URI text into a filesystem path.
  5. Cap the artifact size your read handler will return.

The resources specification requires URI validation and calls for access controls and permission checks for sensitive resources.2 Our proposed policy adds concrete checks for this export workflow.

Set a read-size limit before accepting large exports. Reports over that limit need a bounded preview or a separate download route; a full resources/read response would still carry the entire payload.

5. Test report retrieval in the host

Build a small fixture report in a disposable environment. Then verify:

  • The tool returns a summary and the intended link. The CSV stays out of the tool result.
  • An authorized resource read returns the expected fixture contents.
  • Another tenant cannot retrieve the same identifier.
  • Expired and unknown identifiers fail without leaking data.
  • The host exposes a usable retrieval path.
  • A host that cannot open the link reports the retrieval failure. It must never invent a summary of unread contents.

Add these cases to your MCP regression tests. Keep fixture artifacts free of private records.

For context-sensitive workflows, also test a report containing instruction-like text. Verify that the application treats those strings as report data and keeps following the original task. See our tool-output trust guide for that boundary.

FAQ

Do not design around that assumption. Hosts decide how resources become context.2 Verify the actual behavior of your target application.

Must every exported report appear in resources/list?

No. Tool-returned resource links need not appear there.1 Make the returned URI usable through its documented retrieval route.

Is this a replacement for structured tool output?

Use both when your workflow needs both: a small machine-readable status and a separately retrievable artifact. Keep the status contract explicit, and consult our structured-output explainer before designing it.

Sources