protocol
mcp_prompt_protocol
Protocol for Logtalk objects that provide prompts to be exposed via an MCP (Model Context Protocol) server. Implementing objects must define the set of prompts available and handle prompt get requests. Prompts are templates for structured LLM interactions that can accept arguments to customize their behavior. Used by both the 2025-06-18 and 2026-07-28 adapters.
logtalk_load(mcp_server(loader))static
Capabilities: Objects providing prompts must declare
promptsin theircapabilities/1predicate (from themcp_tool_protocolprotocol). The server will then advertise thepromptscapability and handleprompts/listandprompts/getrequests.Prompt descriptors: Each prompt is described by a
prompt(Name, Description, Arguments)orprompt(Name, Title, Description, Arguments)term whereNameis an atom,Titleis an optional human-friendly display name (an atom),Descriptionis a human-readable atom, andArgumentsis a list ofargument(ArgName, ArgDescription, Required)terms.Prompt messages: The
prompt_get/3predicate must return a result term containing a list of messages. Each message is amessage(Role, Content)term whereRoleisuserorassistantandContentistext(Text)whereTextis an atom.Multi-round (2026-07-28): For the 2026-07-28 adapter, applications that need additional input during a prompt get implement
prompt_get_round/4from themcp_multiround_protocol. Existingprompt_get/3remains valid and is wrapped as acompleteresult when the round hook is absent.
Public predicates
prompts/1
Returns a list of prompt descriptors available from this object. Each descriptor is a compound term prompt(Name, Description, Arguments) or prompt(Name, Title, Description, Arguments) where Name is the MCP prompt name (an atom), Title is an optional human-friendly display name (an atom), Description is a human-readable description (an atom), and Arguments is a list of argument(ArgName, ArgDescription, Required) terms describing the prompt arguments. ArgName and ArgDescription are atoms, and Required is the boolean true or false.
staticprompts(Prompts)prompts(-list(compound)) - oneprompt_get/3
Handles a prompt get request. Name is the MCP prompt name (as declared in prompts/1), Arguments is a list of ArgumentName-Value pairs provided by the client, and Result is unified with the prompt result. The result must be one of: messages(MessageList) for a list of prompt messages, or messages(Description, MessageList) to also include a description. Each message in the list must be a message(Role, Content) term where Role is user or assistant and Content is text(Text) where Text is an atom.
staticprompt_get(Name,Arguments,Result)prompt_get(+atom,+list(pair),--compound) - oneProtected predicates
(none)
Private predicates
(none)
Operators
(none)