MCP Resource for LangGraph A developer used MCP's Resource primitive to fix a LangGraph-based support bot that lost conversation context, enabling efficient knowledge graph updates and retrieval across tool calls. The approach centralizes device information in a Resource, allowing the agent to maintain coherent conversations and provide accurate troubleshooting. The developer warns against over-engineering Resources to avoid brittle knowledge graphs. I was recently debugging a support bot built with LangGraph, where the agent would consistently forget the context of the conversation after a few turns. The bot would ask the user to repeat information they had already provided, leading to a frustrating experience. Upon closer inspection, I realized that the issue stemmed from the fact that the agent's knowledge graph was not being properly updated and retrieved across multiple tool calls. The agent was essentially starting from scratch every time it received a new input, which made it impossible to maintain a coherent conversation. This is where MCP's Resource primitive comes into play. The Resource primitive allows us to define a knowledge graph that can be efficiently updated and retrieved across multiple tool calls and conversation turns. By using the Resource primitive, we can create a centralized store of information that the agent can draw upon to inform its decisions and actions. To illustrate this, let's consider an example where we're building a support bot that helps users troubleshoot issues with their devices. We can define a Resource that represents the user's device information, which includes details such as the device type, operating system, and any error messages they've encountered. We can then use this Resource to inform the agent's responses and actions, such as providing troubleshooting steps or escalating the issue to a human support agent. Here's an example of how we might implement this using MCP's Resource primitive and LangGraph: python import langgraph from mcp import Resource Define the device information Resource device info resource = Resource name="device info", attributes= {"name": "device type", "type": "string"}, {"name": "operating system", "type": "string"}, {"name": "error messages", "type": "list