ExMCP.ACP.Types (ex_mcp v0.9.0)
View SourceType specifications and builder functions for the Agent Client Protocol (ACP).
ACP uses JSON-RPC 2.0 as its wire format (same as MCP). All types are plain maps matching the ex_mcp convention — no structs for protocol types.
Content Blocks
ACP supports text and image content blocks in prompts and responses:
text_block("Hello, world!")
image_block("image/png", "base64data...")Session Management
Sessions track agent conversations. Create with new_session_params/2,
send prompts with prompt_params/2.
Summary
Functions
Creates an audio content block.
Error code indicating authentication is required.
Creates client info for the initialize handshake.
Creates an image content block.
Creates params for a new session request.
Creates a plan entry.
Creates a plan_update session update.
Creates params for a prompt request.
Creates a resource content block.
Creates a resource link content block.
Error code indicating a resource was not found.
Creates a text content block.
Types
@type agent_capabilities() :: %{ optional(:loadSession) => boolean(), optional(:promptCapabilities) => %{ optional(:image) => boolean(), optional(:audio) => boolean(), optional(:embeddedContext) => boolean() }, optional(:mcpCapabilities) => %{ optional(:http) => boolean(), optional(:sse) => boolean() }, optional(:sessionCapabilities) => %{ optional(:list) => session_list_capabilities() | nil } }
@type agent_message_chunk_update() :: %{ sessionUpdate: :agent_message_chunk, content: content_block() }
@type available_commands_update() :: %{ sessionUpdate: :available_commands_update, commands: [map()] }
@type content_block() :: text_block() | image_block() | audio_block() | resource_link_block() | resource_block()
@type current_mode_update() :: %{ sessionUpdate: :current_mode_update, modeId: String.t() }
@type file_range() :: %{ optional(:start) => non_neg_integer(), optional(:end) => non_neg_integer() }
@type file_read_request() :: %{ :sessionId => String.t(), :path => String.t(), optional(:range) => file_range() }
@type initialize_request() :: %{ :clientInfo => client_info(), optional(:clientCapabilities) => client_capabilities(), optional(:protocolVersion) => pos_integer() }
@type initialize_response() :: %{ :agentInfo => agent_info(), optional(:agentCapabilities) => agent_capabilities(), optional(:protocolVersion) => pos_integer() }
@type list_sessions_request() :: %{optional(:cursor) => String.t()}
@type list_sessions_response() :: %{ :sessions => [session_info()], optional(:nextCursor) => String.t() }
@type load_session_request() :: %{ :sessionId => String.t(), optional(:cwd) => String.t(), optional(:mcpServers) => [mcp_server()] }
@type new_session_request() :: %{ optional(:cwd) => String.t(), optional(:mcpServers) => [mcp_server()] }
@type new_session_response() :: %{sessionId: String.t()}
@type permission_request() :: %{ sessionId: String.t(), toolCall: tool_call_info(), options: [permission_option()] }
@type plan_entry() :: %{ content: String.t(), priority: :high | :medium | :low, status: :pending | :in_progress | :completed }
@type plan_update() :: %{sessionUpdate: :plan_update, entries: [plan_entry()]}
@type prompt_request() :: %{sessionId: String.t(), prompt: [content_block()]}
@type prompt_response() :: %{stopReason: String.t()}
@type session_list_capabilities() :: %{optional(:supportsNameFilter) => boolean()}
@type session_update() :: user_message_chunk_update() | agent_message_chunk_update() | tool_call_update() | plan_update() | available_commands_update() | config_option_update() | current_mode_update() | session_info_update() | thinking_update() | status_update()
@type session_update_params() :: %{sessionId: String.t(), update: session_update()}
@type text_block() :: %{type: :text, text: String.t()}
@type thinking_update() :: %{sessionUpdate: :thinking, content: String.t()}
@type tool_call_update() :: %{ :sessionUpdate => :tool_call_update, :toolCallId => String.t(), :title => String.t(), :status => String.t(), optional(:content) => [content_block()] }
@type user_message_chunk_update() :: %{ sessionUpdate: :user_message_chunk, content: content_block() }
Functions
Creates an audio content block.
@spec auth_required_code() :: integer()
Error code indicating authentication is required.
Creates client info for the initialize handshake.
Creates an image content block.
Creates params for a new session request.
Options
:mcp_servers- list of MCP server maps with:uriand optional:name
Creates a plan entry.
Creates a plan_update session update.
Creates params for a prompt request.
Content can be a string (auto-wrapped as text block) or a list of content block maps.
Creates a resource content block.
Creates a resource link content block.
@spec resource_not_found_code() :: integer()
Error code indicating a resource was not found.
Creates a text content block.