---
title: Tool interfaces and MCP
url: https://doc.liz6.com/en/ai/03-agent-systems/02-tools-and-mcp
locale: en
area: ai
tags:
- Models & agents
- Agent Execution Systems
date: 2026-06-30
modified: 2026-09-10
description: Once an executor can call functions, how does it integrate several external services? MCP standardizes capability exchange; the host still maps model tools to specific servers and handles identity, versions and results. This article focuses on invocation contracts; reusable task methods follow in Skills.
---

# Tool interfaces and MCP

Once an executor can call functions, how does it integrate several external services? MCP standardizes capability exchange; the host still maps model tools to specific servers and handles identity, versions and results. This article focuses on invocation contracts; reusable task methods follow in Skills.

## Host, Client, and Server

MCP (Model Context Protocol) defines the protocol for applications and services to exchange context and capabilities. The Host is the application using the model, the Client is the component within the Host that connects to a specific Server, and the Server provides tools, resources, or prompt templates. A Host can connect to multiple Servers; they do not need to use the same business APIs or be deployed on the same machine. [MCP Architecture](https://modelcontextprotocol.io/docs/2026-07-28/learn/architecture)

<svg viewBox="0 0 760 368.1576232910156" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Host organizes models and context, Client connects to specific MCP Servers" style="max-width:100%;height:auto" font-family="Source Han Sans CN,Microsoft YaHei,sans-serif">
<defs><marker id="mcp-host-arrow" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto"><path d="M0,0 L8,4 L0,8 Z" fill="#64748b"></path></marker></defs>
<rect width="760" height="368.1576232910156" rx="12" fill="#f8fafc"></rect>


<g transform="translate(0 0)"><rect x="25" y="67" width="440" height="225" rx="8" fill="#eef2ff" stroke="#c7d2fe" stroke-dasharray="5 4"></rect><text x="45" y="95" font-size="15" fill="#334155" text-anchor="start" font-weight="600">Host: Permissions, tool mapping, context, presentation</text><rect x="50" y="142" width="165" height="90" rx="8" fill="#e0e7ff" stroke="#c7d2fe"></rect><text x="132.5" y="184.0" font-size="15" fill="#1e293b" text-anchor="middle" font-weight="600">Model and Scheduler</text><text x="132.5" y="206.0" font-size="12" fill="#475569" text-anchor="middle" font-weight="400">Select actions, verify results</text><rect x="275" y="120" width="165" height="55" rx="8" fill="#e0e7ff" stroke="#c7d2fe"></rect><text x="357.5" y="152.5" font-size="15" fill="#1e293b" text-anchor="middle" font-weight="600">Client A</text><rect x="540" y="120" width="190" height="55" rx="8" fill="#ccfbf1" stroke="#c7d2fe"></rect><text x="635.0" y="152.5" font-size="15" fill="#1e293b" text-anchor="middle" font-weight="600">Documentation Server</text><line x1="215" y1="187" x2="270" y2="147" stroke="#64748b" stroke-width="1.8" marker-end="url(#mcp-host-arrow)"></line><line x1="440" y1="147" x2="535" y2="147" stroke="#64748b" stroke-width="1.8" marker-end="url(#mcp-host-arrow)"></line><rect x="275" y="220" width="165" height="55" rx="8" fill="#e0e7ff" stroke="#c7d2fe"></rect><text x="357.5" y="252.5" font-size="15" fill="#1e293b" text-anchor="middle" font-weight="600">Client B</text><rect x="540" y="220" width="190" height="55" rx="8" fill="#ccfbf1" stroke="#c7d2fe"></rect><text x="635.0" y="252.5" font-size="15" fill="#1e293b" text-anchor="middle" font-weight="600">Ticket Server</text><line x1="215" y1="187" x2="270" y2="247" stroke="#64748b" stroke-width="1.8" marker-end="url(#mcp-host-arrow)"></line><line x1="440" y1="247" x2="535" y2="247" stroke="#64748b" stroke-width="1.8" marker-end="url(#mcp-host-arrow)"></line></g><text x="24" y="29" font-size="19" fill="#0f172a" text-anchor="start" font-weight="700"><tspan x="24" dy="0">Host organizes models and context, Client connects to specific MCP Servers</tspan></text><text x="24" y="325" font-size="13" fill="#475569" text-anchor="start" font-weight="400"><tspan x="24" dy="0">MCP defines interface exchange; what the model can see and what it is allowed to execute is still controlled jointly by </tspan><tspan x="24" dy="17.55">the application and the service.</tspan></text>
</svg>

The tool invocation format of model vendors and MCP messages are not the same protocol. The Host usually maps MCP tool descriptions into tools visible to the model, converts model invocations into MCP requests, and converts service results back into observations for this round. This adaptation layer needs to handle name mapping, parameters, result types, errors, and invocation correlation; you cannot directly pass the Server list as input that all models can understand.

The common "M×N becomes M+N" explanation refers to the benefits of interface reuse: if M applications each connect to N systems, a large amount of adaptation is implemented repeatedly; a standard protocol allows some work on the application side and the service side to be reusable. However, authentication, business semantics, capability compatibility, and user experience still need to be integrated; the actual integration cost will not strictly equal M+N, nor will it disappear automatically.

### Transport and Execution Location

Local stdio usually exchanges protocol messages via subprocess standard input and output; logs should not be mixed into the protocol output stream arbitrarily. Streamable HTTP uses HTTP to carry requests and optional streaming capabilities. The former is often used for local processes, while the latter is suitable for service-oriented connections, but the transport method itself does not provide business permission isolation. [MCP Transport Overview](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http)

For example, if a local file Server inherits the user's broad file permissions, the model may access these files once it selects it; "local" does not mean a small access scope. Remote Servers also need to know the request subject, allowed scope, and credential validity; "already connected" only proves that the communication layer is established.

## Three Types of Server Capabilities

| Capability | What it Provides | Example in Ticket Report |
|---|---|---|
| tools | Executable operations | Query tickets meeting specific conditions |
| resources | Readable context materials | Team field definitions, raw report materials |
| prompts | Reusable interaction templates | Prompt for users to select a time range for the report |

The three are distinguished by intent, although the actual interface may differ: a resource might also be read by a tool, and a tool might only read data. What matters is that the caller understands "this is an action," "this is a resource," or "this is an optional interaction template," rather than elevating all returned text into task instructions. [MCP Primitives](https://modelcontextprotocol.io/docs/2026-07-28/learn/architecture)

Both MCP prompts and Skills can contain method information, but their organization differs. A prompt is a template provided by the service via the protocol; a Skill is a distributable package containing instructions and optional files, which may be associated with scripts, templates, and multiple reference documents. They can overlap; you cannot draw a boundary solely based on "prompts are temporary, Skills are permanent": prompt templates can also be reused long-term.

## The Boundary from Discovery to Invocation

### Protocol Versions Precede Example Code

The protocol evolves. The **2026-07-28** version being reviewed uses `server/discover` to find supported versions and capabilities, and carries protocol version information in request metadata; do not mix stateful initialization flows from older versions with requests in this version. When maintaining old clients, check the specification according to the version they actually support, and upgrading the SDK also requires verifying peer compatibility. [Versioned Architecture Description](https://modelcontextprotocol.io/docs/2026-07-28/learn/architecture)

Statelessness at the protocol layer does not mean the service cannot maintain shopping carts, browser pages, or long-running tasks. Business state can still exist, but requires clear identity and state positioning, such as explicit resource handles; you cannot assume that the next tool invocation automatically binds to the previous business object just because the TCP connection is still alive.

### Discovery Does Not Mean Dumping Everything into Context

The Host can obtain the tool directory and then choose the exposure scope based on the current task. MCP capability discovery and the Host's semantic tool search are two different things; integrating MCP does not automatically guarantee that all tool schemas are loaded on demand. Tool selection, caching, and context budget belong to Host design.

Assume two services both provide `search`; the Host must maintain a mapping that accurately locates the service source. You cannot just display tools with the same name and let the invocation fall to the wrong backend; nor can you rely on the service's self-reported name to determine it is a trusted original service. The mapping should rely on connection identities configured and confirmed by the Host.

Below is an MCP tool definition object, omitting the outer protocol message. Note the use of `inputSchema`; it is different from the `input_schema` field in some model APIs.

```json
{
  "name": "search_tickets",
  "description": "Read-only query for tickets within a specified project; returns entries and subsequent pagination positions.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "project": {"type": "string"},
      "query": {"type": "string"}
    },
    "required": ["project", "query"],
    "additionalProperties": false
  }
}
```

MCP tools support discovery, invocation, and structured description; results may contain various content types, and execution errors can be indicated via `isError`. Schema or annotations are not security proofs: the server must still validate parameters and access permissions, and the Host cannot blindly trust untrusted services claiming to be read-only. [MCP Tools Specification](https://modelcontextprotocol.io/specification/2026-07-28/server/tools)

### There Are Multiple Failure Points Even After Successful Connection

| Phenomenon | Priority Check Location | Do Not Blame Directly On |
|---|---|---|
| Service process cannot start | Executable file, working directory, dependencies, configuration | The model will not use the tool |
| Connection established but discovery fails | Version, transport, identity, and capability discovery | Tool description is too short |
| Tool listed but model didn't select it | Host exposure scope, description, current task | The MCP protocol is definitely broken |
| Request rejected | Parameters, permissions, rate limiting, and peer errors | Increasing reasoning effort will solve it |
| Tool has results but answer is incorrect | Type mapping, truncation, evidence, and task understanding | The Server must return an error |

This layered troubleshooting avoids repeatedly modifying prompts when the transport is not connected, and avoids unconditionally expanding business permissions just to make the model "see more tools."

### Two search tools: which one runs?

Connecting two servers does not make locally unique tool names globally unique. Establish connection identity and map model-visible names to tools; name resolution and JSON-RPC correlation are distinct responsibilities.

**Two search tools: which one runs?**

Tool names are unique within one server; the host routing table must preserve server identity and correlate responses.


## Connecting to task methods

The tool catalog describes callable capabilities; the host selects and maps them. Reporting methods, field meanings and templates belong in [Skills and reusable task methods](/ai/03-agent-systems/03-skills-and-task-context). Connect them through concrete tool names, arguments and result structures, and revalidate those dependencies after interface changes.

Continue with：[Skills and reusable task methods](/ai/03-agent-systems/03-skills-and-task-context)。
