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

Behaviour and schema DSL for MCP tool modules.

A tool module declares its JSON-schema-like input contract with `schema/1`
and implements `execute/2` to return an `MCPKit.Response`.

Example:

    defmodule MyApp.MCP.Tools.Ping do
      use MCPKit.Tool

      alias MCPKit.Response

      schema do
        field :message, :string, required: true
      end

      def execute(arguments, context) do
        {:reply, Response.tool() |> Response.structured(arguments), context}
      end
    end

Supported schema nodes today:
- `field/2`
- `field/3`
- `embeds_many/2`
- `embeds_many/3`

# `description`

```elixir
@callback description() :: String.t() | nil
```

Returns the description shown in `tools/list`.

# `execute`

```elixir
@callback execute(map(), map()) :: {:reply, MCPKit.Response.t(), map()}
```

Executes the tool and returns an `MCPKit.Response`.

The context map currently includes at least `:session`.

# `input_schema`

```elixir
@callback input_schema() :: map()
```

Returns the JSON-schema-like MCP input schema generated from `schema/1`.

# `validate_arguments`

```elixir
@callback validate_arguments(map()) :: {:ok, map()} | {:error, String.t()}
```

Validates and normalizes incoming tool arguments.

This callback is generated by `schema/1` unless overridden.

# `schema`
*macro* 

Declares the MCP input schema for a tool.

This macro generates `input_schema/0` and `validate_arguments/1` for the tool
module.

---

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