# `ExMCP.ACP.Envelope`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/acp/envelope.ex#L1)

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)

# `error`

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

Builds a JSON-RPC error response from an error map.

# `error`

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

Builds a JSON-RPC error response from code, message, and optional data.

# `notification`

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

Builds a JSON-RPC notification envelope.

# `request`

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

Builds a JSON-RPC request envelope without params.

# `request`

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

Builds a JSON-RPC request envelope with params.

# `request`

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

Builds a JSON-RPC request envelope with params and id.

# `response`

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

Builds a JSON-RPC success response envelope.

# `with_id`

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

Adds an id to an existing JSON-RPC envelope.

# `with_params`

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

Adds params to an existing JSON-RPC envelope.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
