Hermes.Transport.Behaviour behaviour (hermes_mcp v0.10.2)

Defines the behavior that all transport implementations must follow.

Summary

Types

The JSON-RPC message encoded

t()

Callbacks

Returns the list of MCP protocol versions supported by this transport.

Types

message()

@type message() :: String.t()

The JSON-RPC message encoded

reason()

@type reason() :: term() | Hermes.MCP.Error.t()

t()

@type t() :: GenServer.server()

Callbacks

send_message(t, message)

@callback send_message(t(), message()) :: :ok | {:error, reason()}

shutdown(t)

@callback shutdown(t()) :: :ok | {:error, reason()}

start_link(keyword)

@callback start_link(keyword()) :: GenServer.on_start()

supported_protocol_versions()

@callback supported_protocol_versions() :: [String.t()]

Returns the list of MCP protocol versions supported by this transport.

Examples

iex> MyTransport.supported_protocol_versions()
["2024-11-05", "2025-03-26"]