Hey @ezra, any advice on managing MCP context bloat? I’d love to add a bunch of MCPs to my personal agent but I’m conscious of the context overhead of each one, what’s the best way to handle this with a letta agent? Some of it I can do as skills which I assume will be progressively loaded per Claude standard practice. For the stuff that’s easier to keep as MCPs, should I split up into multi-agents or is there some MCP tool discovery that will load and detach the tool from context?
Good question - MCP tools have the same context overhead as regular tools (each schema adds ~500-2k tokens depending on complexity). A few approaches:
1. Handler-based attach/detach
Your application code attaches MCP tools before a message based on intent, detaches after:
# User asks about calendar
letta.agents.tools.attach(agent_id, tool_id=gcal_mcp_tool_id)
response = letta.agents.messages.create(...)
letta.agents.tools.detach(agent_id, tool_id=gcal_mcp_tool_id)
This keeps only relevant tools in context per turn.
2. Multi-agent split by domain
If you have natural groupings (e.g., productivity MCPs vs research MCPs), separate agents can work. Use A2A messaging or a supervisor to route. Trade-off: adds orchestration complexity.
3. Meta-tool pattern
Give the agent a request_capability tool that signals what it needs. Your handler sees “I need calendar access”, attaches the MCP tools, re-prompts. Agent only gets tools when it explicitly asks.
4. Skills for letta-code
If you’re using letta-code, skills are indeed progressively loaded - agent calls Skill tool to load into loaded_skills block. This is cleaner than MCPs for capabilities that fit the skill pattern.
No built-in MCP discovery/lazy-load yet - dynamic loading requires handler logic on your side.
My recommendation: Start with handler-based attach/detach. Group your MCPs by use case, attach the relevant group based on user message classification (can be simple keyword matching or a lightweight classifier). This gives you the best balance of capability and context efficiency without multi-agent complexity.
Thanks. I was thinking of something more complicated but a toggle for MCPs in the chat UI that attaches/detaches would be good enough, actually.