AttestoMCP.Server.Registry (attesto_mcp_server v2.8.0)

Copy Markdown View Source

Deterministic, authorization-filtered MCP primitive registry.

Summary

Types

A normalized JSON-compatible primitive definition.

Supported registration categories.

One primitive registration supplied to the atomic batch API.

Functions

Returns definitions matching one wire-level tool name or exact resource URI.

Returns a specification to start this module under a supervisor.

Returns one normalized definition without copying the complete catalog.

Returns definitions for one category in deterministic identity order.

Validates and registers one primitive, rejecting duplicate identities.

Validates and registers a batch atomically, returning its normalized definitions.

Validates and atomically replaces the complete primitive catalog.

Returns the monotonic catalog revision used for invalidation and recovery.

Returns all normalized definitions grouped by primitive category.

Starts the registry; registration is serialized through this process.

Types

definition()

@type definition() :: map()

A normalized JSON-compatible primitive definition.

primitive()

@type primitive() :: :tool | :resource | :template | :prompt | :completion

Supported registration categories.

registration()

@type registration() :: {primitive(), String.t(), map() | keyword()}

One primitive registration supplied to the atomic batch API.

Functions

candidates(pid, type, selector)

@spec candidates(pid(), :tool | :resource, String.t()) :: [definition()]

Returns definitions matching one wire-level tool name or exact resource URI.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

fetch(pid, type, identity)

@spec fetch(pid(), primitive(), term()) :: {:ok, definition()} | :error

Returns one normalized definition without copying the complete catalog.

list(pid, type)

@spec list(pid(), primitive()) :: [definition()]

Returns definitions for one category in deterministic identity order.

register(pid, type, identity, definition)

@spec register(pid(), primitive(), String.t(), map() | keyword()) ::
  :ok | {:error, term()}

Validates and registers one primitive, rejecting duplicate identities.

register_all(pid, registrations)

@spec register_all(pid(), [registration()]) ::
  {:ok, [{primitive(), String.t(), definition()}]} | {:error, term()}

Validates and registers a batch atomically, returning its normalized definitions.

replace_all(pid, registrations)

@spec replace_all(pid(), [registration()]) ::
  {:ok, %{required(primitive()) => %{optional(term()) => definition()}},
   [primitive()]}
  | {:error, term()}

Validates and atomically replaces the complete primitive catalog.

revision(pid)

@spec revision(pid()) :: non_neg_integer()

Returns the monotonic catalog revision used for invalidation and recovery.

snapshot(pid)

@spec snapshot(pid()) :: %{
  required(primitive()) => %{optional(term()) => definition()}
}

Returns all normalized definitions grouped by primitive category.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the registry; registration is serialized through this process.