Schemas & Structured Data
JSON-RPC 2.0 message types
Section titled “JSON-RPC 2.0 message types”All MCP data-layer messages are JSON-RPC 2.0:
| Type | Has id? |
Expects response? | Example |
|---|---|---|---|
| Request | Yes | Yes | tools/call |
| Response | Yes (matches request) | — | result or error |
| Notification | No | No | notifications/tools/list_changed |
sequenceDiagram participant C as Client participant S as Server C->>S: Request tools/call (id 1) S-->>C: Response (id 1, result or error) S-)C: Notification tools/list_changed (no id, no reply)
Tool definitions use JSON Schema
Section titled “Tool definitions use JSON Schema”Each tool declares a required inputSchema (and optionally an outputSchema) using JSON Schema — the 2020-12 dialect by default — so the model knows exactly what arguments are valid:
{ "name": "get_weather", "title": "Weather Information Provider", "description": "Get current weather for a location", "inputSchema": { "type": "object", "properties": { "location": { "type": "string", "description": "City name or zip code" } }, "required": ["location"] }}Other tool definition fields include optional icons and annotations (behavior hints such as readOnlyHint — clients must treat these as untrusted unless they come from a trusted server).
Why schemas matter
Section titled “Why schemas matter”- The model uses the schema + description to decide when and how to call a tool
- The client/host can validate arguments before sending them
- The server validates inputs again on receipt (never trust the caller)
- Structured output (
structuredContentconforming to the tool’soutputSchema) lets tools return machine-readable results
Resources and structured data
Section titled “Resources and structured data”- Resources are identified by URIs following RFC 3986 (e.g.
file:///path/to/doc.md; custom schemes allowed) - Each resource has metadata:
uri,name,title,description,mimeType,size - Resource contents can be text (
textfield) or binary (blob, base64-encoded)
Key exam points
Section titled “Key exam points”- MCP uses JSON-RPC 2.0 as its message format and JSON Schema for tool parameters
- Notifications have no
idand never receive a response - Tool descriptions are part of the contract — the model relies on them to select tools
Check your knowledge
Section titled “Check your knowledge”📝 Check your knowledge