protocol
mcp_prompt_protocol
Protocol for Logtalk objects that provide prompts to be exposed via an MCP (Model Context Protocol) server. Implements the MCP 2025-06-18 specification. 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.
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.
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)