# `ExMCP.Server.Tools.Builder`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/server/tools/builder.ex#L1)

Simplified tool builder that reduces metaprogramming complexity.

> #### Deprecated {: .warning}
>
> Part of the deprecated `ExMCP.Server.Tools` API. **Planned for removal in 2.0.0.**
> Use `ExMCP.Server.DSL` instead.

Instead of heavy AST manipulation, this module uses a cleaner builder pattern
with explicit data structures and runtime registration.

# `annotations`

```elixir
@spec annotations(ExMCP.Server.Tools.Builder.Tool.t(), map() | any()) ::
  ExMCP.Server.Tools.Builder.Tool.t()
```

Sets annotations for the tool.

# `build`

```elixir
@spec build(ExMCP.Server.Tools.Builder.Tool.t()) ::
  {:ok, map()} | {:error, String.t()}
```

Builds the final tool definition.

Generates input schema from params if not explicitly set.

# `description`

```elixir
@spec description(ExMCP.Server.Tools.Builder.Tool.t(), String.t()) ::
  ExMCP.Server.Tools.Builder.Tool.t()
```

Sets the tool's description.

# `handler`

```elixir
@spec handler(ExMCP.Server.Tools.Builder.Tool.t(), function()) ::
  ExMCP.Server.Tools.Builder.Tool.t()
```

Sets the handler function.

# `input_schema`

```elixir
@spec input_schema(ExMCP.Server.Tools.Builder.Tool.t(), map() | any()) ::
  ExMCP.Server.Tools.Builder.Tool.t()
```

Sets the input schema explicitly.

# `new`

```elixir
@spec new(String.t()) :: ExMCP.Server.Tools.Builder.Tool.t()
```

Creates a new tool builder.

## Example

    ExMCP.Server.Tools.Builder.new("echo")
    |> description("Echo back the input")
    |> param(:message, :string, required: true)
    |> handler(fn %{message: msg}, state -> {:ok, %{text: msg}, state} end)
    |> build()

# `output_schema`

```elixir
@spec output_schema(ExMCP.Server.Tools.Builder.Tool.t(), map() | any()) ::
  ExMCP.Server.Tools.Builder.Tool.t()
```

Sets the output schema for validation.

# `param`

```elixir
@spec param(
  ExMCP.Server.Tools.Builder.Tool.t(),
  atom(),
  atom() | {atom(), any()},
  keyword()
) ::
  ExMCP.Server.Tools.Builder.Tool.t()
```

Adds a parameter to the tool.

# `title`

```elixir
@spec title(ExMCP.Server.Tools.Builder.Tool.t(), String.t()) ::
  ExMCP.Server.Tools.Builder.Tool.t()
```

Sets the tool's title (optional).

---

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