CertSafari
    Anthropic Claude Certified Architect – Professional (CCAR-P) - December 7 onwards· Lessons

    Domain 3 · Lesson 18/39

    Choosing between direct tool calls, MCP and agent handoff

    Connection Mechanism Selection

    17 min read
    2.63% of exam
    10 sources
    Published 18 Nov 2026
    Docs as of 18 Nov 2026

    What you will be able to do

    • Place a capability as a direct client tool, an MCP server, or a handoff to another agent, based on where the code runs and who else needs it
    • Decide between a local stdio MCP server and a remote streamable HTTP MCP server when the task depends on live state or on each user's own identity
    • Spot when an agent-to-agent handoff adds latency and token cost, or loses state, so that it does not fit the constraints

    Key concept

    Connection mechanism — This is the path a capability takes to reach the model. It can be a tool your own process runs, a protocol server that any compatible client can reach, or another agent that does the work and reports back. Each path puts the code, the credentials and the state in a different place, so latency, security and statefulness decide which one fits.

    1.Three ways to connect a capability to Claude

    When Claude needs to reach a ticketing system, a database or a web page, the integration can take one of three shapes. Which one you pick decides where the code runs, who holds the credentials and what survives between calls. No shape is best in general. Each one wins under a particular mix of latency, security and statefulness constraints.

    A direct API tool call is the simplest. You declare a tool in the Messages request. Claude replies with a tool_use block, and your own code does the work. Client tools run in your application: Claude stops with stop_reason: "tool_use", your code runs the operation and sends back a tool_result. Nothing sits between the model and your code except the round trip you already make.

    An MCP server puts the capability behind a protocol instead of inside one application. MCP exists because every pairing of an agent with a tool used to need its own custom integration. With MCP, a team builds one server and any MCP-capable client can use it. The server either runs locally as a subprocess or is hosted remotely behind an HTTP endpoint, and that choice matters a great deal for state and for identity.

    An agent-to-agent handoff passes a whole subtask to another model instance. That agent has its own context and its own tools, and it sends back a result. The capability is the other agent's reasoning, not a single function call.

    Where each mechanism puts the code, the credentials and the state
    MechanismWhere the code runsWhat crosses the boundary
    Client tool (direct API)In your application processA tool_use block out, a tool_result back
    MCP serverA client-launched subprocess (stdio) or a remote endpoint (streamable HTTP)JSON-RPC messages between MCP client and server
    Agent handoffAnother model instance with its own context and toolsA task out, a condensed final message back

    Checkpoint 1 of 9· Match them up

    Match each connection mechanism to where its code runs and what crosses the boundary

    Tap a term, then the definition that fits it.

    Sources123

    2.When a direct client tool wins: one consumer, low latency, credentials already local

    The direct client tool is the default when one application owns the capability. The service declares the tool with an input_schema. When Claude returns tool_use, the service makes the HTTP call with the credentials it already holds and sends the result back as a tool_result block. The secret never leaves the process, and no new component has to be deployed, secured or watched. The general advice is to start with the LLM APIs directly, because many patterns take only a few lines of code.

    Each alternative adds cost that this scenario never pays back. An MCP server adds a process and a protocol hop for a tool that will only ever have one client. Its tool definitions also take up context, which raises response time and cost. A subagent adds a whole extra model turn just to run one HTTP request. Giving the model a bash tool and letting it call the endpoint with curl swaps one narrow, declared operation for general code execution. Running agent-generated code needs a secure environment with sandboxing, resource limits and monitoring, which is overhead that direct tool calls avoid.

    Checkpoint 2 of 9· Check yourself

    A teammate suggests a different setup for the same single-consumer lookup: give Claude a bash tool and let it call the internal endpoint with curl, instead of declaring a narrow client tool. What is the main drawback of the teammate's approach?

    Checkpoint 3 of 9· Exam question

    You are the architect for a Python backend service that calls the Claude Messages API to answer support questions. The service needs exactly one tool: a lookup against an internal REST endpoint your team owns. Only this service will ever use the tool, the call must add as little latency as possible, and the endpoint credentials already sit in the service's own secret store. Which connection mechanism do these constraints favor?

    Sources142

    3.When a remote MCP server wins: many clients, per-user identity, a changing tool set

    The constraints flip when several different clients need the same capability. Suppose Claude Code users, a Claude Desktop pilot group and a custom Agent SDK bot all need the ticketing system. If each one gets its own direct integration, every tool change has to be coded three times. MCP is built for this case: write the integration once as a server, and every MCP-capable client gets the same tools. When the tool set changes often, the change ships once.

    The remote HTTP transport is also what makes per-user identity possible. The MCP authorization spec applies to HTTP-based transports, and its authorization servers must implement OAuth 2.1. MCP clients find the right authorization server through OAuth 2.0 Protected Resource Metadata. That lets each person authorize as themselves, so ticket operations run under that person's own permissions rather than a shared service account. Stdio servers work differently: they do not use this flow and read their credentials from the environment.

    Registering a remote MCP server over the HTTP transport in Claude Codebash
    claude mcp add --transport http example https://mcp.example.com/mcp

    In Claude Code, the form of the configuration tells you which kind of server you have. A URL such as https://mcp.example.com/mcp points to a remote server. A launch command such as npx -y @example/mcp-server runs the server on your machine. OAuth authentication works with HTTP servers. When a client secret is used, it is stored in the system keychain or a credentials file, not in the config. A remote server still has to protect itself: servers must validate the Origin header to prevent DNS rebinding, and should authenticate every connection.

    Two things remote MCP does not give you are easy to assume by mistake. First, MCP does not remove credentials from the picture. OAuth issues tokens to each user, and those tokens have to be handled correctly. That trade-off between per-user and shared credentials is the subject of authentication posture. Second, connecting through MCP does not make a tool's output trustworthy. How to treat tool results as untrusted input belongs to prompt injection controls.

    Checkpoint 4 of 9· Check yourself

    Claude Code users, a Claude Desktop pilot group and a custom Agent SDK bot all need the same ticketing tools. The tool set changes often, and each ticket operation must run under the permissions of the person who asked for it. Which setup fits these constraints?

    Checkpoint 5 of 9· Exam question

    Your platform team maintains a ticketing-system integration that Claude Code users, a Claude Desktop pilot group and a custom Agent SDK triage bot all need. Each person must act with their own ticketing permissions, and the tool set will change often. Which two characteristics of a remote MCP server (streamable HTTP with OAuth) make it the mechanism these constraints favor? Choose two.(Select 2)

    0 of 2 selected

    Sources2567

    4.Statefulness: what survives between calls on each transport

    The two MCP transports handle state very differently, and that difference decides any task where each step depends on live state from the step before. Streamable HTTP sends every message as an HTTP POST to a single endpoint. Each reply is either one JSON object or an SSE stream scoped to that request, and the spec has removed protocol-level sessions. Stdio exchanges messages over the standard streams of a subprocess that the client launches, and that one process keeps running and answers every call in the session.

    How the two MCP transports carry messages, and what that means for live state
    TransportHow messages travelConsequence for multi-step state
    stdioNewline-delimited messages over the standard streams of a client-launched subprocessThe same process answers every call, so in-memory state such as an open page stays available
    Streamable HTTPEach message is an HTTP POST to a single MCP endpoint; replies are JSON or a request-scoped SSE streamNo protocol-level session links calls, so state must be rebuilt or stored outside the protocol

    Take a legacy admin portal. The workflow logs in once, moves through a dozen pages and keeps a half-filled form open until the final submit. A local stdio server can launch one browser when it starts and expose one tool per step, with every tool acting on the same open page. Every other option rebuilds the state on each step. A remote server that opens a new headless browser for each call has to reload the form values every time. A separate script per step has to restore cookies and reopen the page. Handing each page to its own subagent passes only a summary forward, because a subagent's intermediate tool calls stay inside it and only its final message returns. A summary of a form is not a live session.

    A local stdio server has its own security defaults. It reads credentials from its environment rather than through OAuth. Any local HTTP server should bind to 127.0.0.1 and not to all network interfaces.

    Checkpoint 6 of 9· Check yourself

    An agent has to log in to a legacy admin portal once, move through a dozen pages, and keep a half-filled form open until the final submit. Which setup keeps that live page available from one tool call to the next?

    Checkpoint 7 of 9· Exam question

    A Claude Code workflow must drive a legacy admin portal: log in once, move across a dozen pages and keep a partly filled multi-step form until the final submit. Every step depends on the live session state left by the previous step. Which connection mechanism does the statefulness constraint favor?

    Sources738

    5.When an agent-to-agent handoff fits, and what it costs

    A handoff is the right mechanism when the capability you need is reasoning in a separate context, not a single function call. Subagents keep context isolated: a research subagent can read dozens of files, and the parent receives only a short summary. Independent subagents run at the same time, so the work finishes in the time of the slowest one rather than the sum of all of them. Each subagent can also be limited to specific tools. For example, a reviewer that has only Read and Grep can analyse files but never change them.

    A handoff passes back a compact summary, not the sub-agent's full contextpython
    # Get only what's needed, not full history
                order_summary = OrderLookupAgent().lookup_order(order_id)
                # Inject compact summary, not full context
                context = f"Order {order_id}: {order_summary['status']}, purchased {order_summary['date']}"

    Handoffs are expensive, which is why they lose on latency-bound tasks. Multi-agent implementations typically use 3 to 10 times more tokens than one agent doing the same task. They also often take longer overall, because the total amount of computation goes up. Parallel agents give more thorough coverage, not more speed. Teams that split planning, execution and review into separate agents have found lost context at every handoff and more tokens spent coordinating than doing the work.

    How much state a handoff keeps depends on the runtime. In the Agent SDK, a subagent starts a fresh conversation unless it is a fork, and only its final message comes back to the parent. In Claude Managed Agents, a subagent's thread persists, so the coordinating agent can send follow-ups and the subagent retains everything from its earlier turns. All agents in a session share the same sandbox, filesystem and vault credentials. Delegation is one level deep, and a session can have at most 25 child threads at a time. Threads in a dynamic workflow run cannot receive follow-ups and are archived when the run ends. Persistent conversation history is still not the same as a live tool session, so it does not replace a stdio server that holds an open resource.

    Checkpoint 8 of 9· Fill the gap

    In this handoff, the support agent gets order details from a separate lookup agent. Which word completes the comment about what gets injected into the main agent's context?

    # Get only what's needed, not full history
                order_summary = OrderLookupAgent().lookup_order(order_id)
                # Inject compact  ? , not full context
                context = f"Order {order_id}: {order_summary['status']}, purchased {order_summary['date']}"

    Checkpoint 9 of 9· Check yourself

    An incident dashboard has a strict response-time budget. An engineer proposes splitting each query across five parallel subagents to answer sooner. Compared with one agent doing the same task, what should the team expect?

    Sources8910

    Sources

    (10)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Client tools (including user-defined tools and tools with Anthropic-defined schemas, such as bash and text_editor) run in your application.”
      ↩︎ Three ways to connect a capability to Claude
      “Your code runs the operation and sends back a tool_result.”
      ↩︎ When a direct client tool wins: one consumer, low latency, credentials already local
      “It then returns a structured call that your application runs (client tools) or that Anthropic runs (server tools).”
      ↩︎ Key concept
    2. 2.
      “Connecting agents to tools and data traditionally requires a custom integration for each pairing”
      ↩︎ Three ways to connect a capability to Claude
      “Tool descriptions occupy more context window space, increasing response time and costs.”
      ↩︎ When a direct client tool wins: one consumer, low latency, credentials already local
      “Running agent-generated code requires a secure execution environment with appropriate sandboxing, resource limits, and monitoring.”
      ↩︎ When a direct client tool wins: one consumer, low latency, credentials already local
      “developers implement MCP once in their agent and it unlocks an entire ecosystem of integrations.”
      ↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set
      “Tool descriptions occupy more context window space, increasing response time and costs.”
      ↩︎ Exam trap 1
    3. 3.
      “stdio: newline-delimited messages over the standard streams of a client-launched subprocess.”
      ↩︎ Three ways to connect a capability to Claude
      “stdio: newline-delimited messages over the standard streams of a client-launched subprocess.”
      ↩︎ Statefulness: what survives between calls on each transport
    4. 4.
      “We suggest that developers start by using LLM APIs directly: many patterns can be implemented in a few lines of code.”
      ↩︎ When a direct client tool wins: one consumer, low latency, credentials already local
    5. 5.
      “Implementations using an HTTP-based transport SHOULD conform to this specification.”
      ↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set
      “Authorization servers MUST implement OAuth 2.1 with appropriate security measures for both confidential and public clients.”
      ↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set
      “MCP clients MUST use OAuth 2.0 Protected Resource Metadata for authorization server discovery.”
      ↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set
      “Implementations using an STDIO transport SHOULD NOT follow this specification, and instead retrieve credentials from the environment.”
      ↩︎ Exam trap 4
      “Implementations using an STDIO transport SHOULD NOT follow this specification, and instead retrieve credentials from the environment.”
      ↩︎ Checkpoint
    6. 6.
      “A launch command such as npx -y @example/mcp-server: the server runs on your machine.”
      ↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set
      “The client secret is stored securely in your system keychain (macOS) or a credentials file, not in your config”
      ↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set
    7. 7.
      “Servers MUST validate the Origin header on all incoming connections to prevent DNS rebinding attacks.”
      ↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set
      “The client sends every JSON-RPC request or notification as its own HTTP POST.”
      ↩︎ Statefulness: what survives between calls on each transport
      “When running locally, servers SHOULD bind only to localhost (127.0.0.1) rather than all network interfaces (0.0.0.0).”
      ↩︎ Statefulness: what survives between calls on each transport
      “Removal of protocol-level sessions.”
      ↩︎ Exam trap 2
    8. 8.
      “intermediate tool calls and results stay inside the subagent; only its final message returns to the parent.”
      ↩︎ Statefulness: what survives between calls on each transport
      “independent subtasks finish in the time of the slowest one rather than the sum of all of them”
      ↩︎ When an agent-to-agent handoff fits, and what it costs
      “subagents can be limited to specific tools, reducing the risk of unintended actions.”
      ↩︎ When an agent-to-agent handoff fits, and what it costs
      “intermediate tool calls and results stay inside the subagent; only its final message returns to the parent.”
      ↩︎ Checkpoint
    9. 9.
      “multi-agent implementations typically use 3-10x more tokens than single-agent approaches for equivalent tasks.”
      ↩︎ When an agent-to-agent handoff fits, and what it costs
      “The primary benefit of parallelization is thoroughness, not speed.”
      ↩︎ When an agent-to-agent handoff fits, and what it costs
      “they suffered from lost context at each handoff and spent more tokens coordinating than executing.”
      ↩︎ When an agent-to-agent handoff fits, and what it costs
      “multi-agent systems often take longer overall than single-agent systems because of the sheer increase in total computation.”
      ↩︎ Exam trap 3
    10. 10.
      “that subagent retains everything from its previous turns.”
      ↩︎ When an agent-to-agent handoff fits, and what it costs
      “All agents share the same sandbox, filesystem, and vault credentials, but each agent runs in its own session thread”
      ↩︎ When an agent-to-agent handoff fits, and what it costs
      “Delegation is one level deep, and a session can have at most 25 child threads at a time, idle ones included.”
      ↩︎ When an agent-to-agent handoff fits, and what it costs
      “The agent can’t send follow-up messages to a run’s threads, and the server archives each one by the end of its run.”
      ↩︎ When an agent-to-agent handoff fits, and what it costs

    Ready to test yourself?

    Practise Anthropic Claude Certified Architect – Professional (CCAR-P) - December 7 onwards in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.