module

ActionMCP::Protocol

Constants

LATEST_VERSION = "2025-11-25"
PROTOCOL_VERSIONS = ["2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"]
SCHEMA_URI = "https://json-schema.org/draft/2020-12/schema"
TYPE_WORDS = {"String" => "a string", "String?" => "a string", "Int32" => "an integer", "Int32?" => "an integer", "Int64" => "an integer", "Int64?" => "an integer", "Float64" => "a number", "Float64?" => "a number", "Bool" => "a boolean", "Bool?" => "a boolean", "Array(String)" => "an array", "Array(String)?" => "an array"}

Class methods

accept_ok?(accept : String | Nil) : Bool
Source
content_type_ok?(ct : String | Nil) : Bool
Source
dispatch(server : ActionMCP::Server.class, payload : JSON::Any, key : ApiKey | Nil) : RpcResponse
Source
error(id : JSON::Any | Nil, code : Int32, message : String, data : String) : String

Dispatch-level JSON-RPC error (carries "data").

Source
guard(status : Int32, code : Int32, message : String) : RpcResponse
Source
guard_body(code : Int32, message : String) : String

Transport-guard error (no "data" member — oracle: accept_missing, content_type_wrong, parse_error, batch_rejected, get_405).

Source
handle_post(server : ActionMCP::Server.class, body : String, key : ApiKey | Nil) : RpcResponse

POST body → RpcResponse. server is the mounted ActionMCP::Server subclass; key is the authenticated ApiKey (nil in open mode). Notification bodies (no "id") are accepted with 202 before dispatch.

Source
initialize_result(server : ActionMCP::Server.class, id : JSON::Any | Nil, params : JSON::Any | Nil) : String
Source
not_acceptable
Source
result(id : JSON::Any | Nil, result_json : String) : String
Source
tools_call(server : ActionMCP::Server.class, id : JSON::Any | Nil, params : JSON::Any | Nil, key : ApiKey | Nil) : RpcResponse
Source
tools_list_json(server : ActionMCP::Server.class) : String
Source
unsupported_media_type
Source
validate_arguments(server : ActionMCP::Server.class, name : String, args : Hash(String, JSON::Any)) : String | Nil

SDK-style argument validation messages (oracle: call_missing_required, call_wrong_type_int, call_wrong_type_string). Returns nil when valid.

Source
value_matches?(type : String, value : JSON::Any) : Bool
Source
write_id(io : IO, id : JSON::Any | Nil) : Nil
Source