Skip to content

Schemas & Structured Data

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)
Message types in action

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).

  • 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 (structuredContent conforming to the tool’s outputSchema) lets tools return machine-readable results
  • 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 (text field) or binary (blob, base64-encoded)
  • MCP uses JSON-RPC 2.0 as its message format and JSON Schema for tool parameters
  • Notifications have no id and never receive a response
  • Tool descriptions are part of the contract — the model relies on them to select tools

📝 Check your knowledge

1. What field distinguishes a JSON-RPC request from a notification?
2. Which tool definition field is required and describes valid arguments?
3. What JSON Schema dialect do MCP tool schemas use by default?
4. How are MCP resources uniquely identified?
5. How should a client treat tool annotations like readOnlyHint?