ExMCP.ACP.Types (ex_mcp v0.9.2)
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 ACP agent capabilities.
Creates an audio content block.
Creates an authentication method advertised by an agent.
Error code indicating authentication is required.
Creates an available_commands_update session update notification.
Creates client info for the initialize handshake.
Creates a config_option_update session update notification.
Creates a config option value for select-style session config.
Creates a current_mode_update session update notification.
Creates an environment variable entry for a stdio MCP server.
Creates an HTTP header entry for an HTTP/SSE MCP server.
Creates an HTTP MCP server config for ACP session setup.
Creates an image content block.
Creates params for a new session request.
Creates a stable ACP plan session update notification.
Creates a plan entry.
Creates a stable ACP plan session update notification.
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 select-style session config option.
Creates session capability metadata.
Creates a session info entry returned by session/list.
Creates a session_info_update session update notification.
Creates an SSE MCP server config for ACP session setup.
Creates a stdio MCP server config for ACP session setup.
Creates a text content block.
Types
@type agent_capabilities() :: %{ optional(:auth) => %{optional(:logout) => map() | nil}, 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, optional(:resume) => session_resume_capabilities() | nil, optional(:close) => session_close_capabilities() | nil } }
@type agent_message_chunk_update() :: %{ sessionUpdate: :agent_message_chunk, content: content_block() }
@type agent_thought_chunk_update() :: %{ sessionUpdate: :agent_thought_chunk, content: content_block() }
@type available_commands_update() :: %{ sessionUpdate: :available_commands_update, availableCommands: [map()] }
@type close_session_request() :: %{sessionId: String.t()}
@type config_option_update() :: %{ sessionUpdate: :config_option_update, configOptions: [config_option()] }
@type content_block() :: text_block() | image_block() | audio_block() | resource_link_block() | resource_block()
@type current_mode_update() :: %{ sessionUpdate: :current_mode_update, currentModeId: String.t() }
@type file_read_request() :: %{ :sessionId => String.t(), :path => String.t(), optional(:line) => non_neg_integer(), optional(:limit) => non_neg_integer() }
@type http_mcp_server() :: %{ type: :http, name: String.t(), url: String.t(), headers: [http_header()] }
@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(:authMethods) => [auth_method()], optional(:protocolVersion) => pos_integer() }
@type list_sessions_response() :: %{ :sessions => [session_info()], optional(:nextCursor) => String.t() }
@type load_session_request() :: %{ sessionId: String.t(), cwd: String.t(), mcpServers: [mcp_server()] }
@type mcp_server() :: stdio_mcp_server() | http_mcp_server() | sse_mcp_server()
@type new_session_request() :: %{cwd: String.t(), 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() :: %{sessionUpdate: :plan, entries: [plan_entry()]}
@type plan_entry() :: %{ content: String.t(), priority: :high | :medium | :low, status: :pending | :in_progress | :completed }
@type prompt_request() :: %{sessionId: String.t(), prompt: [content_block()]}
@type prompt_response() :: %{stopReason: String.t()}
@type resource_block() :: %{type: :resource, resource: embedded_resource()}
@type resume_session_request() :: %{ :sessionId => String.t(), :cwd => String.t(), optional(:mcpServers) => [mcp_server()] }
@type session_close_capabilities() :: map()
@type session_list_capabilities() :: map()
@type session_resume_capabilities() :: map()
@type session_update() :: user_message_chunk_update() | agent_message_chunk_update() | agent_thought_chunk_update() | tool_call() | tool_call_update() | plan() | 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 sse_mcp_server() :: %{ type: :sse, name: String.t(), url: String.t(), headers: [http_header()] }
@type stdio_mcp_server() :: %{ type: :stdio, name: String.t(), command: String.t(), args: [String.t()], env: [env_variable()] }
@type text_block() :: %{type: :text, text: String.t()}
@type thinking_update() :: %{sessionUpdate: :thinking, content: String.t()}
@type user_message_chunk_update() :: %{ sessionUpdate: :user_message_chunk, content: content_block() }
Functions
Creates ACP agent capabilities.
Supported options: :load_session, :http_mcp, :sse_mcp, :image,
:audio, :embedded_context, :session_list, :session_resume,
:session_close, and :logout.
Creates an audio content block.
Creates an authentication method advertised by an agent.
@spec auth_required_code() :: integer()
Error code indicating authentication is required.
Creates an available_commands_update session update notification.
Creates client info for the initialize handshake.
Creates a config_option_update session update notification.
Creates a config option value for select-style session config.
Creates a current_mode_update session update notification.
Creates an environment variable entry for a stdio MCP server.
Creates an HTTP header entry for an HTTP/SSE MCP server.
Creates an HTTP MCP server config for ACP session setup.
Creates an image content block.
Creates params for a new session request.
Options
:mcp_servers- list of MCP server maps, preferably fromstdio_mcp_server/3,http_mcp_server/3, orsse_mcp_server/3
Creates a stable ACP plan session update notification.
Creates a plan entry.
Creates a stable ACP plan session update notification.
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 select-style session config option.
Creates session capability metadata.
Creates a session info entry returned by session/list.
Creates a session_info_update session update notification.
Creates an SSE MCP server config for ACP session setup.
Creates a stdio MCP server config for ACP session setup.
Creates a text content block.