MingaAgent.Tool.Registry (Minga v0.1.0)

Copy Markdown View Source

ETS-backed source-owned registry for agent tool specifications.

The registry stores declarative MingaAgent.Tool.Spec structs. Executable callbacks are built later from a per-session MingaAgent.Tool.Context, so registry startup does not close over a process cwd or session state.

Summary

Types

Registration failure reason.

Tool contribution source.

Functions

Returns all registered tool specs.

Converts a ReqLLM.Tool struct to a config-owned MingaAgent.Tool.Spec.

Looks up a tool spec by name.

Registers a tool spec in the registry. Same-source registrations replace existing entries.

Returns true if a tool with the given name is registered.

Starts the registry GenServer that owns the ETS table.

Removes every tool contributed by a source.

Types

register_error()

@type register_error() ::
  {:reserved_tool_name, String.t(), owner_source :: source(),
   attempted_source :: source()}
  | {:duplicate_tool_name, String.t(), existing_source :: source(),
     attempted_source :: source()}
  | {:invalid_spec, term()}

Registration failure reason.

source()

@type source() :: MingaAgent.Tool.Spec.source()

Tool contribution source.

Functions

all()

@spec all() :: [MingaAgent.Tool.Spec.t()]

Returns all registered tool specs.

from_req_tool(tool)

@spec from_req_tool(ReqLLM.Tool.t()) :: MingaAgent.Tool.Spec.t()

Converts a ReqLLM.Tool struct to a config-owned MingaAgent.Tool.Spec.

lookup(name)

@spec lookup(String.t()) :: {:ok, MingaAgent.Tool.Spec.t()} | :error

Looks up a tool spec by name.

register(spec)

@spec register(MingaAgent.Tool.Spec.t() | keyword() | map()) ::
  :ok | {:error, register_error()}

Registers a tool spec in the registry. Same-source registrations replace existing entries.

registered?(name)

@spec registered?(String.t()) :: boolean()

Returns true if a tool with the given name is registered.

start_link(opts \\ [])

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

Starts the registry GenServer that owns the ETS table.

unregister_source(source)

@spec unregister_source(source()) :: :ok

Removes every tool contributed by a source.

unregister_source(table, source)

@spec unregister_source(atom(), source()) :: :ok