# `ExMCP.Server.DSL.Result`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/server/dsl/result.ex#L1)

Response helpers for the modern server DSL.

When a module uses `ExMCP.Server.DSL`, this module is aliased as `ToolResult`.
Outside DSL modules, call the functions via `ExMCP.Server.DSL.Result`.

## Building results

    ToolResult.text("hello")
    ToolResult.error("something went wrong")
    ToolResult.structured("done", %{count: 1})

## Normalization

Handlers may also return plain values; the DSL normalizes them:

* binaries and `%{text: ...}` → text content
* `%{content: ...}` maps → used as tool results
* `{:ok, result}` / `{:ok, result, state}` / `{:error, reason}` tuples

# `error`

```elixir
@spec error(any()) :: map()
```

Builds an error tool result.

# `input_required`

```elixir
@spec input_required(map(), term()) :: ExMCP.Server.MRTR.InputRequired.t()
```

Suspends a modern tool, resource, or prompt result for MRTR input.

The optional application state must be JSON encodable. ExMCP seals it into
an opaque `requestState`; handlers can read it on the retry through
`ExMCP.Server.Context.request_state/0`.

# `structured`

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

Builds a tool result with both text and structured content.

# `text`

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

Builds a text tool result.

---

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