ExMCP.Tasks.Extension (ex_mcp v1.0.0-rc.8)

Copy Markdown View Source

Capability and wire helpers for the MCP Tasks extension.

The extension is defined for the modern protocol era under io.modelcontextprotocol/tasks. It is deliberately separate from the experimental tasks capability used by MCP 2025-11-25; declaring one never implies support for the other.

Summary

Functions

Returns extension result types enabled by the declared capabilities.

Returns whether a capabilities object declares the modern extension.

Returns the canonical extension identifier.

Returns the task-state notification method.

Adds the Tasks extension to a client or server capabilities object.

Returns the client-to-server methods defined by the extension.

Returns the capability fragment required by modern task operations.

Returns the result discriminator reserved by the extension.

Validates a task handle or detailed task-state result.

Types

validation_error()

@type validation_error() :: {:invalid_task_field, String.t()}

Functions

allowed_result_types(capabilities)

@spec allowed_result_types(term()) :: [String.t()]

Returns extension result types enabled by the declared capabilities.

declared?(capabilities)

@spec declared?(term()) :: boolean()

Returns whether a capabilities object declares the modern extension.

identifier()

@spec identifier() :: String.t()

Returns the canonical extension identifier.

notification_method()

@spec notification_method() :: String.t()

Returns the task-state notification method.

put_capability(capabilities \\ %{})

@spec put_capability(map()) :: map()

Adds the Tasks extension to a client or server capabilities object.

request_methods()

@spec request_methods() :: [String.t()]

Returns the client-to-server methods defined by the extension.

required_capabilities()

@spec required_capabilities() :: map()

Returns the capability fragment required by modern task operations.

result_type()

@spec result_type() :: String.t()

Returns the result discriminator reserved by the extension.

validate_task_result(result, mode \\ :create)

@spec validate_task_result(map(), :create | :detailed) ::
  :ok | {:error, validation_error()}

Validates a task handle or detailed task-state result.