AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

MCP Apps UI Resources Are Silently Converted To Plain Text, Losing Structure And Interactivity

The LangChain MCP adapter currently treats all MCP resources as text, discarding MIME type and UI metadata from the MCP Apps ext-apps specification. This causes UI resources (e.g., .ui.json) to be flattened into raw strings, breaking native rendering and structured consumption. A hotfix is provided to detect and preserve UI resource metadata while returning structured content.

highConfidence 72%LangChainEmbeddingsChainsAgents

Origin Analysis

In langchain-mcp-adapters, the resource-to-tool conversion path assumes every MCP resource is plain text and directly extracts content[0].text, ignoring resource.mimeType and any UI-specific metadata defined by the MCP Apps extension.
1. Configure an MCP server that exposes an ext-apps UI resource with MIME type application/vnd.mcp.app.resource or a URI ending in .ui.json. 2. Load tools using MultiServerMCPClient.get_tools(). 3. Invoke the tool corresponding to the UI resource. 4. Observe that the returned value is a plain string containing the raw JSON/text, with no MIME type or structured representation.

Fixing Code Block

Edge Case Audit

This change returns dict objects for UI resources instead of strings, which may break downstream consumers that expect str. It also assumes the session object is safe for concurrent tool invocations; if the underlying MCP client is not async-safe, wrap calls with a lock. For rollback, revert to the previous text-only conversion. Test under langchain-mcp-adapters versions >=0.1.0 because older versions may not expose mimeType on resource contents.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state