McpServer.Icon (HTTP MCP Server v0.9.0)

View Source

Represents an icon for tools, prompts, and resources.

Icons provide a standardized way for servers to expose visual identifiers for their resources, tools, prompts, and implementations.

Fields

  • src - URL of the icon image (required)
  • mime_type - MIME type of the icon (optional, e.g., "image/png", "image/svg+xml")
  • sizes - List of size strings (optional, e.g., ["48x48", "96x96"])

Examples

iex> McpServer.Icon.new(src: "https://example.com/icon.png")
%McpServer.Icon{src: "https://example.com/icon.png", mime_type: nil, sizes: []}

iex> McpServer.Icon.new(
...>   src: "https://example.com/icon.png",
...>   mime_type: "image/png",
...>   sizes: ["48x48", "96x96"]
...> )
%McpServer.Icon{
  src: "https://example.com/icon.png",
  mime_type: "image/png",
  sizes: ["48x48", "96x96"]
}

Summary

Functions

Creates a new Icon struct.

Types

t()

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

Functions

new(opts)

@spec new(keyword()) :: t()

Creates a new Icon struct.

Parameters

  • opts - Keyword list of icon options:
    • :src (required) - URL of the icon image
    • :mime_type - MIME type of the icon
    • :sizes - List of size strings (default: [])

Examples

iex> McpServer.Icon.new(src: "https://example.com/icon.png")
%McpServer.Icon{src: "https://example.com/icon.png", mime_type: nil, sizes: []}

iex> McpServer.Icon.new(
...>   src: "https://example.com/icon.png",
...>   mime_type: "image/png",
...>   sizes: ["48x48"]
...> )
%McpServer.Icon{src: "https://example.com/icon.png", mime_type: "image/png", sizes: ["48x48"]}