AgentLearn

Model Context Protocol

MCP standardizes how applications connect to tools and context. It does not replace authorization or validate the truth of a tool result.

A protocol is a contract, not intelligence

A host application connects through clients to servers exposing capabilities such as tools, resources, and prompts. This reduces one-off integration work. The model still needs useful descriptions, and the application still needs policy checks before executing an operation. Treat results from an external server as untrusted data.

How it works

Pin the protocol revision and verify the transport, authentication, and capability requirements for that revision. This course references the July 28, 2026 specification, whose architecture uses self-contained requests and per-request capability negotiation. Older examples may assume a different initialization lifecycle. The exercise only illustrates argument validation; it is not a complete MCP client or wire message.

A concrete example

The shop exposes a read-only policy search tool with a required query string. A client can discover what the tool expects. That schema does not establish which customer's records the server may return, and a tool description cannot grant itself new privileges.

Apply it to your assistant

Try an empty query and inspect the contract failure. Before running the exercise, predict the result. Afterward, explain which assumption changed and add one case where the system should refuse, ask for clarification, or escalate.

All exercise inputs and outputs are deterministic teaching examples. No language model is called. Run the same idea against a versioned dataset before making a production claim.

Key takeaway

Use MCP for interoperability, with version-pinned contracts and independent trust boundaries.

JavaScript exercise: Model Context Protocol · code experiment

Try an empty query and inspect the contract failure.

const tool = { name: 'search_policy', required: ['query'] };
function validate(args) {
  return tool.required.every(key => typeof args[key] === 'string' && args[key].trim().length > 0);
}
console.log({ tool: tool.name, valid: validate({ query: 'returns' }) });
console.log('Conceptual schema check, not an MCP protocol implementation.');

Knowledge check

What does discovering a tool schema establish?

  1. The declared argument shape, not permission to access all data
  2. That all tool outputs are safe instructions
  3. That protocol versions never matter
Answer and explanation

The declared argument shape, not permission to access all data

Discovery describes an interface. Authentication, authorization, data validation, and version compatibility remain separate responsibilities.

Sources

Read this lesson as Markdown

Continue learning

  • Model Context Protocol — MCP standardizes how applications connect to tools and context. It does not replace authorization or validate the truth of a tool result.
  • Agent-to-agent communication — When work crosses agent-system boundaries, explicit tasks and artifacts are more dependable than an informal chat transcript.
  • Choosing integration contracts — Tool integration, remote task delegation, and reusable instructions solve different problems. Pick the contract for the boundary you actually have.
  • Reusable agent skills — A skill packages instructions and supporting resources for a repeatable task. It is executable guidance, not a new trust level.