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

Modern DSL for defining MCP server primitives next to their handlers.

Use this module with `ExMCP.Server.Handler`:

    defmodule MyServer do
      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
        param :tags, {:array, :string}, default: []

        run fn %{message: message}, state ->
          {:ok, message, state}
        end
      end
    end

Param types include `:string`, `:integer`, `:number`, `:boolean`,
`:object`/`:map`, and `{:array, item_type}`. Bare `:array` is rejected at
compile time.

Invalid declarations fail at compile time with file/line and fix hints
(missing handlers, duplicate names, wrong instructions per kind, etc.).

Inside DSL modules, `ToolResult` is an alias for `ExMCP.Server.DSL.Result`.
See the project DSL guide for full details.

# `annotations`
*macro* 

# `arg`
*macro* 

# `description`
*macro* 

# `execution`
*macro* 

# `handle`
*macro* 

# `icons`
*macro* 

# `input_schema`
*macro* 

# `meta`
*macro* 

# `mime_type`
*macro* 

# `name`
*macro* 

# `output_schema`
*macro* 

# `param`
*macro* 

# `prompt`
*macro* 

Defines a prompt with a co-located renderer.

# `read`
*macro* 

# `render`
*macro* 

# `resource`
*macro* 

Defines a static resource with a co-located read handler.

# `resource_template`
*macro* 

Defines a resource template with a co-located read handler.

# `run`
*macro* 

# `size`
*macro* 

# `title`
*macro* 

# `tool`
*macro* 

Defines a tool with a co-located handler.

---

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