ExMCP.Registry (ex_mcp v0.10.0)
View SourceRegistry for managing tools, resources, and prompts in ExMCP.
The Registry provides a centralized way to register and lookup MCP capabilities. It supports dynamic registration and efficient lookup operations.
Summary
Functions
Returns a specification to start this module under a supervisor.
Lists all capabilities of a given type.
Lists all capabilities.
Looks up a capability by type and name.
Registers a capability.
Starts the registry.
Unregisters a capability.
Types
@type capability() :: %{ name: String.t(), type: capability_type(), module: module(), metadata: map() }
@type capability_type() :: :tool | :resource | :prompt
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec list(GenServer.server(), capability_type()) :: [capability()]
Lists all capabilities of a given type.
@spec list_all(GenServer.server()) :: [capability()]
Lists all capabilities.
@spec lookup(GenServer.server(), capability_type(), String.t()) :: {:ok, capability()} | {:error, :not_found}
Looks up a capability by type and name.
@spec register(GenServer.server(), capability_type(), String.t(), module(), map()) :: :ok
Registers a capability.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the registry.
@spec unregister(GenServer.server(), capability_type(), String.t()) :: :ok
Unregisters a capability.