McpServer.Tool.Meta.UI (HTTP MCP Server v0.8.0)

View Source

UI metadata for tool definitions.

Links tools to UI resources and controls tool visibility. This struct is used as the ui field inside _meta when attached to tools.

Visibility

Visibility is specified as a list of visibility/0 values:

  • :model - Tool visible to and callable by the agent/model
  • :app - Tool callable by the app (UI view) from this server only

Examples

# Tool visible to both model and app (default)
iex> McpServer.Tool.Meta.UI.new(resource_uri: "ui://weather-server/dashboard")
%McpServer.Tool.Meta.UI{resource_uri: "ui://weather-server/dashboard", visibility: [:model, :app]}

# App-only tool (hidden from model)
iex> McpServer.Tool.Meta.UI.new(resource_uri: "ui://weather-server/dashboard", visibility: [:app])
%McpServer.Tool.Meta.UI{resource_uri: "ui://weather-server/dashboard", visibility: [:app]}

Summary

Functions

Creates a new UI metadata struct.

Types

t()

@type t() :: %McpServer.Tool.Meta.UI{
  resource_uri: String.t() | nil,
  visibility: [visibility()]
}

visibility()

@type visibility() :: :model | :app

Functions

new(opts \\ [])

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

Creates a new UI metadata struct.

Parameters

  • opts - Keyword list of options:
    • :resource_uri - URI of the UI resource (optional)
    • :visibility - List of visibility/0 targets (default: [:model, :app])