MCP: only the MCP tools each turn needs
Connect a few MCP servers and your agent has a hundred tools, all of them in every prompt. Toolcue lets your MCP host (the app that calls the model) pass only the tools a turn needs, without changing any server.
Toolcue is in early access: join the waitlist.
Where filtering belongs#
Filter in the host, right before the model call. Don't build a proxy that returns a different tools/list per turn: the MCP specification expects a server's tool list not to change with the conversation on a connection, and clients cache it. The host already has every tool from tools/list, so it can choose which ones to send.
The pattern#
- Once per server (and when it sends
tools/list_changed): publish its tools to Toolcue. Prefix names (github__create_issue) when several servers are connected, so names stay unique. - Every user turn: ask Toolcue for the turn's tools and pass the model only those, for the whole tool loop.
- Execution doesn't change: the host still routes each call to the server that owns the tool.
from toolcue import ToolcueClient, tools_from_definitions
toolcue = ToolcueClient()
listed = await session.list_tools() # MCP ClientSession
toolcue.publish_catalog("my-assistant", tools_from_definitions([t.model_dump() for t in listed.tools]))
keys = toolcue.select_names("my-assistant", user_text, history) # every user turn
tools_for_model = [t for t in listed.tools if t.name in keys]tools_from_definitions reads MCP tool definitions (name, description, inputSchema) as they are.
With an agent framework#
Most frameworks load MCP tools into the same tool list as your own tools, so the framework integration filters them too:
- LangChain: MCP tools loaded with the MCP adapters are ordinary tools for
ToolcueMiddleware. - OpenAI Agents SDK: MCP servers take a
tool_filtercallable that can read the same per-turn selection from the run context. - Vercel AI SDK and Pydantic AI: MCP tools join
tools, and the integration's per-step filter covers them.
Using tool search from Anthropic or OpenAI for MCP tools? See how the approaches compare.