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

ResourceLink/EmbeddedResource Metadata Loss In MCP To LangChain Conversion

The conversion function only retains uri and mimeType, discarding name, description, size and other metadata from MCP ResourceLink and EmbeddedResource, causing information loss for downstream tools.

highConfidence 75%LangChainChat ModelsVector StoresChains

Origin Analysis

In langchain_mcp_adapters/tools.py, _convert_mcp_content_to_lc_block() does not extract and map all fields from MCP ResourceLink/EmbeddedResource objects to corresponding LangChain content block fields, only using uri and mimeType.
1. Create an MCP tool that returns ResourceLink content with a name field 2. Convert the tool to LangChain format using convert_mcp_tool_to_langchain_tool() 3. Call the tool and inspect the returned content blocks 4. Observe that the name field is missing from the LangChain content block

Fixing Code Block

Edge Case Audit

Attaching 'name' to image blocks as a dynamic attribute is not officially supported and may be lost during serialization or validation. Other metadata (description, size, etc.) are still not preserved and may require extending the LangChain content block schemas or using custom blocks for full fidelity. Rollback: revert to original code to avoid potential serialization issues, but note that original code discards all metadata except uri and mimeType.

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