A control_request frame. Claude Code sends these to the bridge (for example mcp_message and can_use_tool), and the bridge sends them to Claude Code (initialize and interrupt). Both directions share this shape, so outbound frames decode back to this struct.
request is a tagged sum over the request subtypes the bridge handles:
{:mcp_message, %{server_name, message}}wheremessageis the raw JSON-RPC 2.0 map for the named SDK MCP server.{:can_use_tool, %{tool_name, input, tool_use_id}}{:initialize, %{sdk_mcp_servers, system_prompt, append_system_prompt}}wheresystem_promptis a list of strings ornil.:interrupt{:unknown_request, subtype}for any other subtype. The bridge must still answer it, usually with an error response, because Claude Code waits for a reply.
request_id is chosen by the sender and echoed by the matching control_response and any control_cancel_request.
Summary
Functions
Decodes a control_request frame.
Types
@type mcp_message() :: %{ server_name: String.t(), message: MingaClaudeBridge.Wire.Field.json_map() }
@type request() :: {:mcp_message, mcp_message()} | {:can_use_tool, can_use_tool()} | {:initialize, initialize()} | :interrupt | {:unknown_request, subtype :: String.t()}
Functions
@spec from_wire(MingaClaudeBridge.Wire.Field.json_map()) :: {:ok, t()} | :error
Decodes a control_request frame.