[BUG] MCP ResourceLink fills up the context window

Resolved 💬 5 comments Opened Aug 19, 2025 by MJohnson459 Closed Jan 8, 2026

Environment

  • Platform (select one): Claude Code
  • Claude CLI version: 1.0.84 (Claude Code)
  • Operating System: Linux 6.12.10-76061203-generic
  • Terminal: nushell

Bug Description

When Claude code calls an MCP tool that returns a ResourceLink to an image, it tries to read the image which almost always fills up the context window. This happens even with small 100KB images.

When using Claude Desktop, it can handle multiple large images being loaded at once so it seems there must be a more efficient way to load images so that they are available?

Steps to Reproduce

  1. Create an MCP that has two endpoints. A tool that returns a ResourceLink to an image and a resource endpoint to return the image as base64 encoded string.
  2. Call the MCP server.

Expected Behavior

  • Claude Code would read the image and answer the question.

Actual Behavior

  • Claude Code ran out of context.

Additional Context

● mytool - get_image_data (MCP)(image_id: "some_image", resolution: "1280x720", quality: "high")
  ⎿  {
       "type": "resource_link",
       "uri": "image://5352b144-1f45-490b-a2c5-705817bcd158",
     … +13 lines (ctrl+r to expand)

● readMcpResource(Read resource "image://5352b144-1f45-490b-a2c5-705817bcd158" from server "mytool")
  ⎿  {
       "contents": [
         {
     … +679 lines (ctrl+r to expand)
  ⎿  Context low · Run /compact to compact & continue

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗