StubTransport (hermes_mcp v0.14.1)

Simple mock transport for MCP protocol testing. Records all messages sent through it for inspection in tests.

Summary

Functions

Returns a specification to start this module under a supervisor.

Clears all recorded messages.

Gets the count of messages sent.

Gets all messages sent through this transport.

Sets the test process to receive message notifications.

Starts the mock transport.

Types

state()

@type state() :: %{
  messages: [String.t()],
  client: GenServer.name() | nil,
  session_id: String.t(),
  test_pid: pid() | nil
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear(transport \\ __MODULE__)

Clears all recorded messages.

count(transport \\ __MODULE__)

Gets the count of messages sent.

get_last_message(transport \\ __MODULE__)

get_messages(transport \\ __MODULE__)

Gets all messages sent through this transport.

send_to_client(transport \\ __MODULE__, response)

set_client(transport \\ __MODULE__, client)

set_test_pid(transport \\ __MODULE__, test_pid)

Sets the test process to receive message notifications.

start_link(opts \\ [])

Starts the mock transport.

Options

  • :name - Process name (defaults to MODULE)