# `MCPKit.Response`
[🔗](https://github.com/mcostasilva/mcp_kit/blob/v0.2.4/lib/mcp_kit/response.ex#L1)

Helpers for building MCP tool responses.

`structured/2` keeps the payload in `structuredContent` and also mirrors it
into a JSON text block for broad MCP client compatibility.

## Examples

    iex> MCPKit.Response.tool() |> MCPKit.Response.error("boom") |> MCPKit.Response.to_result()
    %{"content" => [%{"text" => "boom", "type" => "text"}], "isError" => true}

# `t`

```elixir
@type t() :: %MCPKit.Response{
  content: [map()],
  is_error: boolean(),
  structured_content: map() | nil
}
```

# `error`

Marks the response as an error with a plain text content block.

# `structured`

Stores structured tool output and mirrors it into text content.

## Examples

    iex> MCPKit.Response.tool() |> MCPKit.Response.structured(%{"ok" => true}) |> MCPKit.Response.to_result()
    %{
      "content" => [%{"text" => ~s({"ok":true}), "type" => "text"}],
      "isError" => false,
      "structuredContent" => %{"ok" => true}
    }

# `to_result`

Converts the response struct into an MCP tool result payload.

# `tool`

Builds a fresh tool response.

## Examples

    iex> MCPKit.Response.tool()
    %MCPKit.Response{content: [], structured_content: nil, is_error: false}

---

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