protocol
mcp_multiround_protocol
Protocol for multi-round tool/prompt/resource operations (MRTR) used by the MCP 2026-07-28 specification. Implementing objects may define the round hooks to request additional input from the client (elicitation, sampling, roots) and to resume with input responses and opaque request state. Existing applications that do not implement these hooks continue to use tool_call/3, prompt_get/3, resource_read/3, or auto-dispatch; the 2026 adapter wraps those results as complete(Result). The 2026 adapter never invokes the 2025-06-18 tool_call/4 elicitation API.
logtalk_load(mcp_server(loader))static
Request context: Each round hook receives a
request_context(ClientCapabilities, InputResponses, RequestState, Progress)term.ClientCapabilitiesis the curly-term advertised by the client.InputResponsesis a list ofinput_response(Key, Response)terms (or empty on the first round).RequestStateis application-owned opaque data (ornone).Progressis a callable closure for emitting progress notifications when the client supplied a progress token; it is only meaningful under the 2026 adapter.Complete results: A hook returns
complete(Result)whereResultuses the existing canonical vocabulary:text(Atom),error(Atom),results(List),structured(StructuredContent),structured(Items, StructuredContent)for tools;messages(MessageList)ormessages(Description, MessageList)for prompts;contents(ContentList)for resources.Input-required results: A hook returns
input_required(InputRequests, RequestState).InputRequestsis a nonempty list of uniquely keyedinput_request(Key, Request)terms, and/orRequestStateis non-none. An input-required result must contain a nonempty request list, non-nonestate, or both.Allowed request forms:
Requestmay beform_elicitation(Message, Schema),url_elicitation(Message, URL),sampling(Messages, ModelPreferences, SystemPrompt, IncludeContext), orroots.Input responses: On a subsequent round the adapter supplies
InputResponseswith the same keys. Response values areaccept(Content),decline,cancel(elicitation), sampling results, or roots results. Unrecognized keys are ignored. Malformed known values yield a-32602error. Missing required responses cause the adapter to re-issue the corresponding input requests.State integrity:
RequestStateis opaque to the adapter. Applications that use it for authorization or business decisions must integrity-protect, bind, and validate it themselves.
Public predicates
tool_call_round/4
Handles one round of a multi-round tool call. Name is the MCP tool name, Arguments is a list of ArgumentName-Value pairs, Context is a request_context(ClientCapabilities, InputResponses, RequestState, Progress) term, and RoundResult is unified with either complete(Result) or input_required(InputRequests, RequestState). If not defined, the 2026 adapter falls back to tool_call/3 (or auto-dispatch) and wraps the outcome as complete.
statictool_call_round(Name,Arguments,Context,RoundResult)tool_call_round(+atom,+list(pair),+compound,--compound) - zero_or_oneprompt_get_round/4
Handles one round of a multi-round prompt get. Name is the MCP prompt name, Arguments is a list of ArgumentName-Value pairs, Context is a request_context/4 term, and RoundResult is unified with either complete(Result) or input_required(InputRequests, RequestState). If not defined, the 2026 adapter falls back to prompt_get/3 and wraps the outcome as complete.
staticprompt_get_round(Name,Arguments,Context,RoundResult)prompt_get_round(+atom,+list(pair),+compound,--compound) - zero_or_oneresource_read_round/4
Handles one round of a multi-round resource read. URI is the resource identifier, Arguments is a list of ArgumentName-Value pairs (currently unused by most applications), Context is a request_context/4 term, and RoundResult is unified with either complete(Result) or input_required(InputRequests, RequestState). If not defined, the 2026 adapter falls back to resource_read/3 and wraps the outcome as complete.
staticresource_read_round(URI,Arguments,Context,RoundResult)resource_read_round(+atom,+list(pair),+compound,--compound) - zero_or_oneProtected predicates
(none)
Private predicates
(none)
Operators
(none)