Skip to content

Resources panel can show stale content for the wrong selected resource #1266

@nicbarrett

Description

@nicbarrett

Summary

The Resources panel can render the wrong resource payload after switching between already-read resources.

In my local repro, resources/list returns three distinct resources, and raw resources/read returns three distinct payloads, but Inspector's detail pane can show the payload for a different resource than the one currently selected.

Environment

  • MCP Inspector: v0.21.2
  • Container image in use locally: ghcr.io/modelcontextprotocol/inspector:latest
  • Image labels: 0.21.2-hotfix-3, revision adfcccca529088099d41d08459f55214bfb9b874
  • Transport: Streamable HTTP
  • Connection type: Direct

Repro

  1. Connect to an MCP server that supports resources/list and resources/read.
  2. List resources.
  3. Click resource A and let Inspector read/display it.
  4. Click resource B and let Inspector read/display it.
  5. Click resource A again.

Expected

The detail pane should display resource A's payload again.

Actual

The detail pane can continue showing resource B's payload, even though the selected item and heading indicate resource A.

I also saw this related symptom:

  • clicking Build a Report approved tools showed a detail payload whose uri field was mcp://benefitsolver/report/context-md

Server-side validation

I verified the server responses independently with raw JSON-RPC calls:

  • resources/list returns distinct resources
  • resources/read returns distinct payloads for each URI

So this appears to be a client-side Inspector state/rendering bug, not a server bug.

Likely cause

I traced this locally and found two issues in the client:

  1. The Resources tab renders a single global resourceContent string instead of the content for selectedResource.uri.
  2. readResource() short-circuits if a URI is already cached, so re-selecting a cached resource does not repopulate the visible pane.

That combination leaves the detail pane showing stale content from the last-read resource.

Suggested fix

  • Derive displayed content from resourceContentMap[selectedResource.uri]
  • Keep Refresh as a real refresh by bypassing the cache check when explicitly requested

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions