Skip to main content
Alan types a question into his chat window. The language model decides it needs to call a shipping tool to answer. The model selects a tool using three pieces of information the host provides for each tool: its name, its description, and its inputSchema. If the inputSchema doesn’t constrain arguments precisely, the model may guess and send the wrong type — causing runtime failures. Example: the model built and sent this request:
But Alan’s tool expects a shipment reference like PL-4417 (a string). Because the inputSchema did not require a string, the model sent a number (4417) instead of a string. The server returned a 500 error and the user saw a failure. The missing schema constraint was a single line:
With that line added to the tool’s inputSchema, the model sent "PL-4417" and the call succeeded. Before fixing the schema, let’s review the three kinds of messages used by this protocol. Message types
  • Request: includes an id and expects a response.
  • Response: contains the same id and either a result or an error (never both).
  • Notification: has no id and therefore expects no reply.
Table: Message types at a glance Request example:
Response examples:
or
Notification example (no id):
Client sends requests; the server sends responses and notifications. In this specification, servers do not initiate requests to clients — requests flow one-way (client → server).
Servers must not assume they can initiate requests to clients. Requests are one-way (client → server) in the current protocol; servers should only send responses or notifications back.
Every tool exposed by the server must include an inputSchema written using JSON Schema. A complete inputSchema does the following:
  • Names each argument.
  • Declares each argument’s type (string, number, object, etc.).
  • Marks which arguments are required.
The inputSchema is required for every tool. If an argument is unconstrained (e.g., any), the model may choose the wrong type and cause runtime errors on the server. Correct inputSchema for get_shipment:
There is also an optional outputSchema that describes the structure of the response the tool returns. Providing an outputSchema is not mandatory, but it makes it much easier for host and client code to consume structured results. Example outputSchema (optional):
Why the schema matters (three critical places)
  1. The model reads the inputSchema to decide which tool to call and to construct the arguments.
  2. The client validates arguments against the inputSchema before sending the request.
  3. The server validates arguments against the inputSchema on arrival and should reject requests that violate the schema, even if they originated from a trusted client.
Always validate on the server. Client-side validation can be bypassed; the server must enforce the schema to prevent runtime failures and protect backend logic.
After Alan’s server was updated with the correct inputSchema, the model requested the tool again and sent the shipment as a string ("PL-4417"). The call succeeded and the server returned both a structured result and a human-readable text summary. Human-readable text (for display):
Structured machine-readable result (matches outputSchema):
Structured results help downstream code consume responses reliably, while the text summary is useful for user-facing chat. Resources (files/documents) are handled differently from tools. You don’t “call” a resource like a function; you look it up by its address (URI), similar to opening a URL in a browser. Every resource includes:
  • uri (its identity)
  • name
  • optional title and description
  • mimeType (e.g., text/plain, application/pdf)
  • optional size
  • contents as either text (for text data) or a base64-encoded blob (for binary)
Examples of resource metadata and content:
Text resource example:
Binary resource example (contents carried as base64-encoded string in blob):
Now the whole flow:
  1. The host discovers a server and lists the tools and resources it offers.
  2. The host assembles the tool names, descriptions, and schemas into the model context.
  3. The user asks a question.
  4. The model decides a tool is needed and selects one based on the provided schemas and descriptions.
  5. The host requests user approval (if applicable).
  6. Once approved, the host sends a tools/call request to the server.
  7. The server executes the tool and returns a result.
  8. The host feeds the result back to the model, which produces the final user-facing answer.
An infographic titled "The Whole Flow" showing a model (chip) on the left, a host/chat interface in the center (with the query "Where is PL-4417?"), and an MCP server on the right. Below the diagram are numbered workflow steps such as tools/list, Tool list, Context, Question, Pick a tool, Approve, tools/call, Execute, and Result.
The model never talks to the server directly. It only sees the name, description, and inputSchema the host provides, and then it emits a request describing the tool name and arguments to pass. Example: what the model sees (model context) vs. what the host sends when calling the tool
Because every call includes the tool name, arguments, and the relevant schema, servers can be swapped or upgraded without the user noticing — provided the schemas remain compatible. References and further reading

Watch Video