Phantom.Icon (phantom_mcp v0.4.4)

Copy Markdown View Source

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"
})

Summary

Types

t()

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

Functions

build(attrs)

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

to_json(icon)

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

to_json_list(icons)

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