Anubis.Protocol.Schema (anubis_mcp v1.14.0)

Copy Markdown

Helpers for building JSON-RPC message schemas inside protocol version modules.

A protocol version owns the full shape of its messages: method names, params schemas, and the JSON-RPC envelope around them. These helpers build the envelope branches for {:multi, :method, branches} schemas and merge the generic params._meta.progressToken slot, so version modules stay focused on what changed between versions.

Summary

Functions

Builds a JSON-RPC notification branch for a {:multi, :method, branches} schema.

Returns the schema fragment for the params._meta.progressToken slot shared by all MCP requests.

Builds a JSON-RPC request branch for a {:multi, :method, branches} schema.

Merges the progress _meta slot into a params schema map.

Functions

notification_branch(method, params_schema)

@spec notification_branch(String.t(), term()) :: map()

Builds a JSON-RPC notification branch for a {:multi, :method, branches} schema.

progress_meta()

@spec progress_meta() :: map()

Returns the schema fragment for the params._meta.progressToken slot shared by all MCP requests.

request_branch(method, params_schema)

@spec request_branch(String.t(), term()) :: map()

Builds a JSON-RPC request branch for a {:multi, :method, branches} schema.

with_progress_meta(schema)

@spec with_progress_meta(term()) :: term()

Merges the progress _meta slot into a params schema map.

Non-map schemas (e.g. :map) pass through unchanged.