ExMCP.Types.V20251125 (ex_mcp v0.10.0)

View Source

Type definitions for MCP protocol version 2025-11-25.

This module contains type definitions specific to the 2025-11-25 version of the Model Context Protocol specification.

Key changes from 2025-06-18:

  • Tasks: experimental async state machines for long-running tool calls
  • URL-mode elicitation: server can send URL instead of form schema
  • Icons metadata on tools, resources, prompts, and serverInfo
  • Tool calling in sampling (tools and toolChoice in createMessage)
  • Enhanced OAuth/OIDC authorization with incremental scope
  • Tool name validation (alphanumeric, dots, hyphens, underscores)
  • title/description fields on Implementation
  • size/lastModified fields on resource annotations

Summary

Types

Enhanced tool result.

Client capabilities for 2025-11-25.

Result of creating a task (immediate response to tools/call with task support).

Elicitation result (updated for 2025-11-25 to support URL mode).

Icon metadata for tools, resources, prompts, and server info.

Implementation info with title and description fields (new in 2025-11-25).

Meta field for extensibility.

Prompt with icons (new in 2025-11-25).

Resource with icons, size, and lastModified (new in 2025-11-25).

Resource annotations with lastModified (new in 2025-11-25).

Server capabilities for 2025-11-25. Adds tasks capability.

Task struct representing an async operation.

Task state enum.

Task support configuration on a tool.

Tool definition with icons and execution/task support (new in 2025-11-25).

Tool annotations.

Tool choice for sampling/createMessage.

Tool result content type (result of tool execution).

Tool use content type (model using a tool).

URL-mode elicitation request (new in 2025-11-25). Server sends a URL for the client to navigate to instead of a form schema.

Types

call_tool_result()

@type call_tool_result() :: %{
  optional(:content) => [ExMCP.Types.content()],
  optional(:structuredContent) => any(),
  optional(:resourceLinks) => [ExMCP.Types.V20250618.resource_link()],
  optional(:isError) => boolean(),
  optional(:_meta) => meta()
}

Enhanced tool result.

client_capabilities()

@type client_capabilities() :: %{
  optional(:experimental) => %{required(String.t()) => any()},
  optional(:sampling) => %{required(String.t()) => any()},
  optional(:roots) => %{optional(:listChanged) => boolean()},
  optional(:elicitation) => %{},
  optional(:_meta) => meta()
}

Client capabilities for 2025-11-25.

create_task_result()

@type create_task_result() :: %{
  :taskId => String.t(),
  :state => task_state(),
  optional(:metadata) => map()
}

Result of creating a task (immediate response to tools/call with task support).

cursor()

@type cursor() :: ExMCP.Types.cursor()

elicit_result()

@type elicit_result() :: %{
  :action => String.t(),
  optional(:content) => %{required(String.t()) => any()},
  optional(:_meta) => meta()
}

Elicitation result (updated for 2025-11-25 to support URL mode).

icon()

@type icon() :: %{
  :src => String.t(),
  optional(:mimeType) => String.t(),
  optional(:sizes) => String.t(),
  optional(:theme) => String.t()
}

Icon metadata for tools, resources, prompts, and server info.

implementation()

@type implementation() :: %{
  :name => String.t(),
  :version => String.t(),
  optional(:title) => String.t(),
  optional(:description) => String.t(),
  optional(:websiteUrl) => String.t(),
  optional(:icons) => [icon()]
}

Implementation info with title and description fields (new in 2025-11-25).

json_schema()

@type json_schema() :: map()

json_value()

@type json_value() :: any()

log_level()

@type log_level() :: ExMCP.Types.log_level()

meta()

@type meta() :: %{optional(String.t()) => any()}

Meta field for extensibility.

progress_token()

@type progress_token() :: ExMCP.Types.progress_token()

prompt()

@type prompt() :: %{
  :name => String.t(),
  optional(:title) => String.t(),
  optional(:description) => String.t(),
  optional(:arguments) => [ExMCP.Types.prompt_argument()],
  optional(:annotations) => ExMCP.Types.annotations(),
  optional(:icons) => [icon()],
  optional(:_meta) => meta()
}

Prompt with icons (new in 2025-11-25).

request_id()

@type request_id() :: ExMCP.Types.request_id()

resource()

@type resource() :: %{
  :uri => String.t(),
  optional(:title) => String.t(),
  optional(:name) => String.t(),
  optional(:description) => String.t(),
  optional(:mimeType) => String.t(),
  optional(:annotations) => resource_annotations(),
  optional(:icons) => [icon()],
  optional(:size) => integer(),
  optional(:lastModified) => String.t(),
  optional(:_meta) => meta()
}

Resource with icons, size, and lastModified (new in 2025-11-25).

resource_annotations()

@type resource_annotations() :: %{
  optional(:audience) => [ExMCP.Types.role()],
  optional(:priority) => float(),
  optional(:lastModified) => String.t()
}

Resource annotations with lastModified (new in 2025-11-25).

server_capabilities()

@type server_capabilities() :: %{
  optional(:experimental) => %{required(String.t()) => any()},
  optional(:prompts) => %{optional(:listChanged) => boolean()},
  optional(:resources) => %{
    optional(:subscribe) => boolean(),
    optional(:listChanged) => boolean()
  },
  optional(:tools) => %{
    optional(:listChanged) => boolean(),
    optional(:outputSchema) => boolean()
  },
  optional(:logging) => %{},
  optional(:completions) => %{},
  optional(:tasks) => %{},
  optional(:_meta) => meta()
}

Server capabilities for 2025-11-25. Adds tasks capability.

task()

@type task() :: %{
  :taskId => String.t(),
  :status => task_state(),
  optional(:statusMessage) => String.t(),
  :createdAt => String.t(),
  :lastUpdatedAt => String.t(),
  :ttl => integer(),
  optional(:pollInterval) => integer()
}

Task struct representing an async operation.

task_state()

@type task_state() :: :working | :input_required | :completed | :failed | :cancelled

Task state enum.

task_support()

@type task_support() :: %{
  optional(:taskSupport) => :required | :optional | :forbidden
}

Task support configuration on a tool.

tool()

@type tool() :: %{
  :name => String.t(),
  optional(:title) => String.t(),
  optional(:description) => String.t(),
  :inputSchema => json_schema(),
  optional(:outputSchema) => json_schema(),
  optional(:annotations) => tool_annotations(),
  optional(:icons) => [icon()],
  optional(:execution) => task_support(),
  optional(:_meta) => meta()
}

Tool definition with icons and execution/task support (new in 2025-11-25).

tool_annotations()

@type tool_annotations() :: %{
  optional(:title) => String.t(),
  optional(:readOnlyHint) => boolean(),
  optional(:destructiveHint) => boolean(),
  optional(:idempotentHint) => boolean(),
  optional(:openWorldHint) => boolean()
}

Tool annotations.

tool_choice()

@type tool_choice() :: %{optional(:mode) => String.t()}

Tool choice for sampling/createMessage.

tool_result_content()

@type tool_result_content() :: %{
  :type => String.t(),
  :toolUseId => String.t(),
  :content => [ExMCP.Types.content()],
  optional(:isError) => boolean()
}

Tool result content type (result of tool execution).

tool_use_content()

@type tool_use_content() :: %{
  type: String.t(),
  id: String.t(),
  name: String.t(),
  input: map()
}

Tool use content type (model using a tool).

url_elicit_request()

@type url_elicit_request() :: %{
  :message => String.t(),
  :url => String.t(),
  :mode => String.t(),
  :elicitationId => String.t(),
  optional(:_meta) => meta()
}

URL-mode elicitation request (new in 2025-11-25). Server sends a URL for the client to navigate to instead of a form schema.

Functions

protocol_version()