Architecture

MCP and Agent Frameworks: How Agents Consume Tools

How MCP hosts and agent frameworks use tools — official progressive discovery, programmatic tool calling, and why stable MCP servers beat one-off function calling.

10 min read Published July 14, 2026 Updated July 14, 2026

Division of labor

ComponentRoleOfficial basis
MCP serverReliable tools + resources + promptsServer concepts
MCP clientConnection + protocol sessionArchitecture
MCP host / agent frameworkPlanning, UI, multi-step loops, which tools enter contextClient best practices
ModelChooses tools given definitions/resultsHost-dependent

MCP does not dictate how apps use LLMs (architecture note) — only how context is exchanged.

Why MCP helps frameworks

  1. Swap hosts without rewriting integrations
  2. Share tools across IDE agents and backend agents
  3. Centralize secrets and audit at the server
  4. Scale tool sprawl with progressive discovery patterns published for hosts

Progressive discovery (official host pattern)

When many servers expose hundreds of tools, loading every definition into the model wastes tokens and hurts quality. Official client best practices describe:

  1. Fetch tools/list but defer injecting all definitions
  2. Expose a lightweight search_tools meta-tool
  3. Load full schemas only for candidates
  4. Optionally connect/disconnect whole servers dynamically

Guidelines include caching definitions, refreshing on notifications/tools/list_changed, and grouping tools by server.

Implication for server authors: write excellent names/descriptions; keep tools cohesive per server so search works.

Programmatic tool calling / code mode

The same client-best-practices page describes composing multi-tool workflows in a sandbox so intermediate payloads don’t flood the model. Security notes:

  • Per-call authorization still applies (human-in-the-loop policy)
  • Sandbox has no direct network; host brokers tools/call
  • Credentials stay in the host, not model-generated code
  • Respect isError: true tool results (tools error handling)

Design servers for agents

PracticeWhy
Idempotent tools when possibleAgent retries
Actionable isError messagesModel self-correction (tools)
Optional outputSchemaBetter typed composition in code mode
Avoid 100-tool dumps on one serverDiscovery quality
Resources for large contextDon’t force multi‑MB tool returns

Hosting implication

Frameworks assume tools are reachable. Remote Streamable HTTP + auth (transports, connect remote) is what makes shared agent platforms real.

Worked scenario: Hundreds of tools, one confused model

You connect twelve MCP servers to an agent host. Every turn injects the full tools/list for all of them. Quality drops; latency rises; cost spikes—before any tool even runs.

You implement progressive discovery patterns from official client best practices: search tools meta-API, load full schemas only for candidates, connect servers on demand. For multi-step ETL-like tool chains, you experiment with programmatic tool calling so intermediate payloads skip the model context.

Server authors help by writing clear names/descriptions and keeping servers domain-scoped.

Checklist for this topic

  • Avoid dumping all tool definitions into every turn at scale
  • Group tools by server with clear naming
  • Provide solid tool descriptions for search/discovery
  • Consider outputSchema for structured composition
  • Keep credentials in the host/broker, not model-written code
  • Apply human-in-the-loop to sandbox-originated calls too

Topic-specific failure modes

FailureLikely causeFix
Context window blownNaive tool loadingProgressive discovery
Wrong tool selectedAmbiguous descriptionsBetter names + smaller catalogs
Sandbox exfil riskNetworked code modeBrokered calls only; no sandbox net
Framework lock-inNative tools onlyExpose via MCP for multi-host use

Coding agents · Tools primitives · Client vs host

In practice: host-side knobs

Even with perfect servers, hosts must:

  • Cap how many servers connect at once for a task
  • Prefer search-then-load for large catalogs
  • Show users which tools will run (human-in-the-loop)
  • Keep credentials in the broker when using code-mode sandboxes

Document those host settings next to your server catalog so app engineers do not “fix” quality by attaching every server globally.

Server author checklist for framework-friendly tools

  • Stable names; no silent renames
  • Descriptions that state preconditions and side effects
  • Small result payloads; paginate large lists
  • Optional outputSchema when returning structured data
  • Clear isError messages
  • Domain-scoped servers (repo tools separate from CRM tools)

Frameworks and hosts can only orchestrate well if the tool surface is boring and predictable.

Takeaways

For MCP and Agent Frameworks: How Agents Consume Tools, remember three things:

  1. Be specific to this problem — the worked scenario “Hundreds of tools, one confused model” is the failure mode you should design against, not a generic outage narrative.
  2. Progressive tool discovery and tight schemas beat dumping hundreds of tools into one context window.
  3. Framework orchestration cannot fix vague tool descriptions or unbounded result payloads.

If you only remember one habit: design tools for the model that will choose them, not only for the engineer who wrote them. Framework teams should treat MCP servers as versioned dependencies: pin URLs or package versions, review tool diffs on upgrade, and refuse silent renames from server owners.

Sources

Next steps

Coding agents · Observability

FAQs

Frequently Asked Questions

  • Do I need a special framework to use MCP?

    No. Any MCP-compatible host/client works. Frameworks help with multi-step orchestration, memory, and routing on top of MCP tools.

  • Why not only use framework-native tools?

    MCP decouples tool servers from a single framework so Cursor, Claude, VS Code, and custom agents can share the same backend. Official client best practices also address scaling to hundreds of tools across many servers.