Anubis.Protocol.Behaviour behaviour (anubis_mcp v0.17.1)

Copy Markdown

Behaviour that each MCP protocol version module must implement.

Each protocol version (e.g., 2024-11-05, 2025-03-26, 2025-06-18) implements this behaviour to isolate version-specific logic. This makes it trivial to add support for new MCP spec versions without scattering conditionals across the codebase.

Version differences

  • 2024-11-05: Initial spec, SSE transport, basic tools/resources/prompts
  • 2025-03-26: Added Streamable HTTP, JSON-RPC batching, authorization framework, tool annotations
  • 2025-06-18: Removed batching, added structured tool output, elicitation, resource_link type

Summary

Callbacks

All notification methods supported by this version.

Peri schema for validating notification params by method for this version.

Progress notification params schema for this version.

All request methods supported by this version.

Peri schema for validating request params by method for this version.

List of features/capabilities this protocol version supports.

Returns the version string this module implements (e.g., '2025-03-26').

Types

feature()

@type feature() :: atom()

message()

@type message() :: map()

method()

@type method() :: String.t()

params()

@type params() :: map()

version()

@type version() :: String.t()

Callbacks

notification_methods()

@callback notification_methods() :: [method()]

All notification methods supported by this version.

notification_params_schema(method)

@callback notification_params_schema(method()) :: term()

Peri schema for validating notification params by method for this version.

progress_params_schema()

@callback progress_params_schema() :: map()

Progress notification params schema for this version.

request_methods()

@callback request_methods() :: [method()]

All request methods supported by this version.

request_params_schema(method)

@callback request_params_schema(method()) :: term()

Peri schema for validating request params by method for this version.

supported_features()

@callback supported_features() :: [feature()]

List of features/capabilities this protocol version supports.

version()

@callback version() :: version()

Returns the version string this module implements (e.g., '2025-03-26').