' MCP protocol constants for JSON-RPC based local AI tool servers.
#IF NOT %DEF(PBX_MCP_PROTOCOL_PBI)
#DEFINE PBX_MCP_PROTOCOL_PBI
#INCLUDE ONCE "Legacy/Network/json_rpc2.inc"

%EQUATE `MCP_PROTOCOL_VERSION_2024_11_05 = "2024-11-05"
%EQUATE `MCP_PROTOCOL_VERSION_2025_03_26 = "2025-03-26"
%EQUATE `MCP_PROTOCOL_VERSION_2025_06_18 = "2025-06-18"
%EQUATE `MCP_FIELD_PROTOCOL_VERSION = "protocolVersion"
%EQUATE `MCP_FIELD_CAPABILITIES = "capabilities"
%EQUATE `MCP_FIELD_CLIENT_INFO = "clientInfo"
%EQUATE `MCP_FIELD_SERVER_INFO = "serverInfo"
%EQUATE `MCP_FIELD_NAME = "name"
%EQUATE `MCP_FIELD_VERSION = "version"
%EQUATE `MCP_FIELD_TOOLS = "tools"
%EQUATE `MCP_FIELD_RESOURCES = "resources"
%EQUATE `MCP_FIELD_PROMPTS = "prompts"
%EQUATE `MCP_FIELD_CONTENT = "content"
%EQUATE `MCP_FIELD_INPUT_SCHEMA = "inputSchema"
%EQUATE `MCP_FIELD_OUTPUT_SCHEMA = "outputSchema"
%EQUATE `MCP_FIELD_ARGUMENTS = "arguments"
%EQUATE `MCP_FIELD_TEXT = "text"
%EQUATE `MCP_FIELD_URI = "uri"
%EQUATE `MCP_FIELD_MIME_TYPE = "mimeType"
%EQUATE `MCP_FIELD_IS_ERROR = "isError"

%EQUATE `MCP_METHOD_INITIALIZE = "initialize"
%EQUATE `MCP_METHOD_INITIALIZED = "notifications/initialized"
%EQUATE `MCP_METHOD_PING = "ping"
%EQUATE `MCP_METHOD_TOOLS_LIST = "tools/list"
%EQUATE `MCP_METHOD_TOOLS_CALL = "tools/call"
%EQUATE `MCP_METHOD_RESOURCES_LIST = "resources/list"
%EQUATE `MCP_METHOD_RESOURCES_READ = "resources/read"
%EQUATE `MCP_METHOD_RESOURCES_SUBSCRIBE = "resources/subscribe"
%EQUATE `MCP_METHOD_RESOURCES_UNSUBSCRIBE = "resources/unsubscribe"
%EQUATE `MCP_METHOD_PROMPTS_LIST = "prompts/list"
%EQUATE `MCP_METHOD_PROMPTS_GET = "prompts/get"
%EQUATE `MCP_METHOD_LOGGING_SET_LEVEL = "logging/setLevel"
%EQUATE `MCP_METHOD_COMPLETION_COMPLETE = "completion/complete"
%EQUATE `MCP_METHOD_ROOTS_LIST = "roots/list"
%EQUATE `MCP_NOTIFY_CANCELLED = "notifications/cancelled"
%EQUATE `MCP_NOTIFY_PROGRESS = "notifications/progress"
%EQUATE `MCP_NOTIFY_MESSAGE = "notifications/message"
%EQUATE `MCP_NOTIFY_RESOURCE_UPDATED = "notifications/resources/updated"
%EQUATE `MCP_NOTIFY_TOOL_LIST_CHANGED = "notifications/tools/list_changed"
%EQUATE `MCP_NOTIFY_RESOURCE_LIST_CHANGED = "notifications/resources/list_changed"
%EQUATE `MCP_NOTIFY_PROMPT_LIST_CHANGED = "notifications/prompts/list_changed"

%EQUATE `MCP_ROLE_USER = "user"
%EQUATE `MCP_ROLE_ASSISTANT = "assistant"
%EQUATE `MCP_CONTENT_TEXT = "text"
%EQUATE `MCP_CONTENT_IMAGE = "image"
%EQUATE `MCP_CONTENT_AUDIO = "audio"
%EQUATE `MCP_CONTENT_RESOURCE = "resource"

%EQUATE `MCP_ERR_TOOL_NOT_FOUND = -32001
%EQUATE `MCP_ERR_RESOURCE_NOT_FOUND = -32002
%EQUATE `MCP_ERR_PROMPT_NOT_FOUND = -32003
%EQUATE `MCP_ERR_INVALID_TOOL_RESULT = -32004
%EQUATE `MCP_ERR_CANCELLED = -32005

#ENDIF
