The Model Context Protocol (MCP) relies on JSON-RPC 2.0 as its core wire format to enable seamless communication between LLM clients and servers. These methods are separated by direction and functionality, managing everything from lifecycle initialization to specific resource, tool, and prompt capabilities.
Client-to-Server Requests
These methods are invoked by the AI client to query capabilities, manage sessions, or execute actions on the server.
Lifecycle & Session
Method
Purpose
initialize
Establishes the connection and negotiates protocol capabilities.
ping
Performs a standard connectivity and health check.
Tools Feature
Method
Purpose
tools/list
Requests a comprehensive list of all executable tools available on the server.
tools/call
Instructs the server to execute a specific tool with designated parameters.
Resources Feature
Method
Purpose
resources/list
Discovers context data and files exposed by the server.
resources/read
Retrieves the raw content of a specific resource.
resources/templates/list
Lists modular URI templates available to dynamically fetch data.
resources/subscribe
Requests continuous real-time updates for a resource.
resources/unsubscribe
Cancels an active resource data subscription.
Prompts Feature
Method
Purpose
prompts/list
Discovers pre-built prompt templates available on the server.
prompts/get
Retrieves the specific structure and layout of a chosen prompt template.
Configuration & Utilities
Method
Purpose
logging/setLevel
Adjusts the verbosity thresholds for the server's logging outputs.
roots/list
Requests a list of underlying file system roots accessible to the client.
Server-to-Client Requests
These methods allow the server to ask the client for additional user context, file visibility, or model completions.
Method
Purpose
ping
Server-initiated connectivity verification to check client status.
sampling/createMessage
Requests the LLM client to generate a message or text completion.
elicitation/create
Prompts the host client to safely gather explicit human input.
completion/complete
Requests auto-completion string matching from the client.
Notifications (Asynchronous Events)
Notifications do not include an id field and do not expect a returned response object. They primarily track real-time changes.
Notification
Purpose
notifications/initialized
Sent by the client to signal that initialization is finalized.
notifications/cancelled
Signals that a running asynchronous operation has been cancelled.
notifications/progress
Provides step-by-step progress tracking for long-running actions.
notifications/tools/list_changed
Notifies the client that the server's tool availability matrix has updated.
notifications/resources/list_changed
Broadcasts changes regarding underlying data resources.
notifications/prompts/list_changed
Alerts the client that server prompt templates have been modified.
notifications/message
Transmits live logging data records from the server to the client console.
Model Context Protocol (MCP) Primitives
Model Context Protocol (MCP) primitives are the core building blocks defined in the data layer that let AI clients and servers share context, structure interactions, and execute tasks. They split into server-side capabilities (tools, resources, prompts) and client-side control features (sampling, elicitation, roots).
Server-Side Primitives
Primitive
Description
Tools
Model-controlled executable functions that let the LLM perform actions like API calls, file updates, or database queries.
Resources
Application-controlled data sources providing ambient reference data and context like file contents or database records.
Prompts
User-controlled reusable templates and slash commands that standardize workflows and interactions.
Client-Side Primitives
Primitive
Description
Sampling
Server-initiated requests allowing an MCP server to safely query the host's LLM for agentic or recursive behaviors.
Elicitation
Mid-task requests where a server asks the user for missing details or confirmation instead of guessing.
Roots
Security boundaries defining which specific directories or files a server can access.
Elicitation Requests
An elicitation request is a runtime mechanism in the Model Context Protocol that allows a server to dynamically prompt a user for missing details or confirmation during tool execution rather than failing. It supports form collection for structured data and secure URL redirects for sensitive tasks.
Key Modes & Actions
Mode / Action
Description
Form Mode
Collects in-band structured inputs and primitives using optional validation schemas.
URL Mode
Sends users out-of-band to a browser for secure flows like OAuth or payments.
Response Actions
User interactions follow an accept, decline, or cancel framework.
Important Note
Elicitation enables MCP servers to request additional information from users safely and explicitly, avoiding assumptions during task execution while supporting structured forms and secure external workflows.
No comments:
Post a Comment