object
mcp_server_2025_06_18_spec
MCP 2025-06-18 protocol handler. Transport-agnostic message handling; returns abstract outcomes for stdio or Streamable HTTP transports to render. Synchronous elicitation requires stdio_input/1 and stdio_output/1 options.
logtalk_load(mcp_server(loader))static, context_switching_callsPublic predicates
supported_specs/1
Specs this handler can negotiate, preferred first.
staticsupported_specs(Versions)supported_specs(-list) - onecurrent_options/1
Merged options established by prepare/2.
staticcurrent_options(Options)current_options(-list) - zero_or_oneelicit_request/5
Sends an elicitation/create request to the client and reads the response (2025-06-18 synchronous model).
staticelicit_request(Input,Output,Message,RequestedSchema,Answer)elicit_request(+stream,+stream,+atom,+compound,--compound) - oneProtected predicates
handle_initialize/4
Handles the initialize request and returns a reply/1 outcome. Overridable by later 2025 family specs (e.g. 2025-11-25).
statichandle_initialize(Message,Id,Options,Outcome)handle_initialize(+nonvar,+nonvar,+list,-nonvar) - onehandle_ping/2
Handles the ping request and returns a reply/1 outcome.
statichandle_ping(Id,Outcome)handle_ping(+nonvar,-nonvar) - onehandle_tools_list/3
Handles the tools/list request. Overridable so later specs can enrich tool descriptors (e.g. icons).
statichandle_tools_list(Id,Options,Outcome)handle_tools_list(+nonvar,+list,-nonvar) - onehandle_tools_call/4
Handles the tools/call request and returns a reply/1 outcome.
statichandle_tools_call(Message,Id,Options,Outcome)handle_tools_call(+nonvar,+nonvar,+list,-nonvar) - onehandle_prompts_list/3
Handles the prompts/list request. Overridable so later specs can enrich prompt descriptors (e.g. icons).
statichandle_prompts_list(Id,Options,Outcome)handle_prompts_list(+nonvar,+list,-nonvar) - onehandle_prompts_get/4
Handles the prompts/get request and returns a reply/1 outcome.
statichandle_prompts_get(Message,Id,Options,Outcome)handle_prompts_get(+nonvar,+nonvar,+list,-nonvar) - onehandle_completion_complete/4
Handles the completion/complete request and returns a reply/1 outcome.
statichandle_completion_complete(Message,Id,Options,Outcome)handle_completion_complete(+nonvar,+nonvar,+list,-nonvar) - onehandle_resources_list/3
Handles the resources/list request. Overridable so later specs can enrich resource descriptors (e.g. icons).
statichandle_resources_list(Id,Options,Outcome)handle_resources_list(+nonvar,+list,-nonvar) - onehandle_resources_templates_list/3
Handles the resources/templates/list request. Overridable so later specs can enrich resource template descriptors (e.g. icons).
statichandle_resources_templates_list(Id,Options,Outcome)handle_resources_templates_list(+nonvar,+list,-nonvar) - onehandle_resources_read/4
Handles the resources/read request and returns a reply/1 outcome.
statichandle_resources_read(Message,Id,Options,Outcome)handle_resources_read(+nonvar,+nonvar,+list,-nonvar) - onegenerate_elicit_id/1
Generates a new elicitation id.
dynamicgenerate_elicit_id(ElicitId)generate_elicit_id(-non_negative_integer) - onebuild_capabilities/2
Builds the server capabilities object from application capability atoms (tools is always present; prompts, resources, completions, and the MCP Apps UI extension are optional).
staticbuild_capabilities(ApplicationCapabilities,Capabilities)build_capabilities(+list,-compound) - onebest_supported_spec/3
Selects the highest supported spec that is less than or equal to the client-requested spec. Fails when no such spec exists.
staticbest_supported_spec(Supported,ClientVersion,Best)best_supported_spec(+list,+atom,-atom) - zero_or_onePrivate predicates
client_capabilities_/1
Client capabilities.
dynamicclient_capabilities_(Capabilities)client_capabilities_(-nonvar) - oneelicit_counter_/1
Elicitation current counter.
dynamicelicit_counter_(Counter)elicit_counter_(-non_negative_integer) - oneinitialized_/0
Initialization completed flag.
dynamicinitialized_ - zero_or_oneserver_options_/1
Server options.
dynamicserver_options_(Options)server_options_(-list(compound)) - oneOperators
(none)