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

DSL for defining MCP tools in server handlers.

> #### Deprecated {: .warning}
>
> `ExMCP.Server.Tools` is **deprecated**, retained throughout 1.x, and planned for
> **removal in 2.0.0**.
> Use `ExMCP.Server.Handler` with `ExMCP.Server.DSL` instead (tools, resources,
> and prompts in one API). See the project DSL guide for migration examples.
>
> `use ExMCP.Server.Tools` emits a compile-time warning.

This module provides a declarative way to define tools with automatic
schema generation and validation. Prefer `ExMCP.Server.DSL` for new code.

## Migration

    # Deprecated
    use ExMCP.Server.Handler
    use ExMCP.Server.Tools

    tool "echo", "Echo back the input" do
      param :message, :string, required: true
      handle fn %{message: message}, _state ->
        {:ok, text: message}
      end
    end

    # Preferred
    use ExMCP.Server.Handler
    use ExMCP.Server.DSL, name: "my-server", version: "1.0.0"

    tool "echo", "Echo back the input" do
      param :message, :string, required: true
      run fn %{message: message}, state ->
        {:ok, message, state}
      end
    end

# `annotations`
*macro* 

> This macro is deprecated. Use ExMCP.Server.DSL instead. ExMCP.Server.Tools will be removed in 2.0.0..

Set annotations for a tool.

# `description`
*macro* 

> This macro is deprecated. Use ExMCP.Server.DSL instead. ExMCP.Server.Tools will be removed in 2.0.0..

Set the description for a tool.

# `handle`
*macro* 

> This macro is deprecated. Use ExMCP.Server.DSL instead. ExMCP.Server.Tools will be removed in 2.0.0..

Define the handler function for a tool.

The handler receives the arguments and state, and should return
{:ok, response} or {:ok, response, new_state}.

# `input_schema`
*macro* 

> This macro is deprecated. Use ExMCP.Server.DSL instead. ExMCP.Server.Tools will be removed in 2.0.0..

Set the input schema for a tool.

# `output_schema`
*macro* 

> This macro is deprecated. Use ExMCP.Server.DSL instead. ExMCP.Server.Tools will be removed in 2.0.0..

Set the output schema for a tool.

# `param`
*macro* 

> This macro is deprecated. Use ExMCP.Server.DSL instead. ExMCP.Server.Tools will be removed in 2.0.0..

Define a parameter for a tool.

This macro is used within a tool definition to specify parameters.

## Examples

    param :name, :string, required: true
    param :age, :integer, default: 0
    param :tags, {:array, :string}

# `title`
*macro* 

> This macro is deprecated. Use ExMCP.Server.DSL instead. ExMCP.Server.Tools will be removed in 2.0.0..

Set the title for a tool (2025-06-18 feature).

# `tool`
*macro* 

> This macro is deprecated. Use ExMCP.Server.DSL instead. ExMCP.Server.Tools will be removed in 2.0.0..

Define a tool using the DSL.

## Examples

    tool "echo", "Echo back the input" do
      param :message, :string, required: true
      handle fn %{message: message}, _state ->
        {:ok, text: message}
      end
    end

---

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