# `Phantom.Icon`
[🔗](https://github.com/dbernheisel/phantom_mcp/blob/main/lib/phantom/icon.ex#L1)

An optionally-sized icon that can be displayed in a user interface.

Icons can be provided for the server implementation (via `use Phantom.Router`),
as well as for individual tools, prompts, and resource templates.

## Fields

  - `:src` - (required) A standard URI pointing to an icon resource.
    May be an HTTP/HTTPS URL, a `data:` URI with Base64-encoded image data,
    or an MFA tuple `{module, function, args}` that is called at runtime.
  - `:mime_type` - Optional MIME type override if the source MIME type is missing or generic.
  - `:sizes` - Optional list of strings that specify sizes at which the icon can be used
    (e.g., `["48x48", "96x96"]`, or `["any"]` for SVGs).
  - `:theme` - Optional specifier for the theme this icon is designed for: `"dark"` or `"light"`.

## Example

    Phantom.Icon.build(%{
      src: "https://example.com/icon.png",
      mime_type: "image/png",
      sizes: ["48x48"],
      theme: "light"
    })

# `t`

```elixir
@type t() :: %Phantom.Icon{
  mime_type: String.t() | nil,
  sizes: [String.t()] | nil,
  src: String.t() | mfa(),
  theme: String.t() | nil
}
```

# `build`

```elixir
@spec build(map() | Keyword.t()) :: t()
```

# `to_json`

```elixir
@spec to_json(t()) :: map()
```

# `to_json_list`

```elixir
@spec to_json_list([t()] | nil) :: [map()] | nil
```

---

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