ExMCP.ACP.Envelope (ex_mcp v0.12.0)

View Source

Pure JSON-RPC 2.0 envelope builders for ACP messages.

Method-specific modules should own their payload shapes. This module owns only the repeated JSON-RPC frame so request builders can stay pipe-friendly:

Envelope.request("session/new")
|> Envelope.with_params(params)
|> Envelope.with_id(id)

Summary

Functions

error(id, error)

@spec error(integer() | String.t() | nil, map()) :: map()

error(id, code, message, data \\ nil)

@spec error(integer() | String.t() | nil, integer(), String.t(), any()) :: map()

notification(method, params \\ %{})

@spec notification(String.t(), map()) :: map()

request(method)

@spec request(String.t()) :: map()

request(method, params)

@spec request(String.t(), map()) :: map()

request(method, params, id)

@spec request(String.t(), map(), integer() | String.t()) :: map()

response(id, result)

@spec response(integer() | String.t(), any()) :: map()

with_id(envelope, id)

@spec with_id(map(), integer() | String.t() | nil) :: map()

with_params(envelope, params)

@spec with_params(map(), map()) :: map()