MingaAgent.Tool.Spec (Minga v0.1.0)

Copy Markdown View Source

Specification for an agent tool.

Wraps the metadata needed to register, discover, and execute a tool in the MingaAgent.Tool.Registry. Unlike ReqLLM.Tool (which is provider-facing and tied to the LLM request lifecycle), Spec is the internal, registry-facing representation that adds category, approval level, and extensibility metadata.

Fields

FieldTypeDescription
nameString.t()Unique tool identifier (e.g., "read_file")
descriptionString.t()Human-readable description for the LLM
parameter_schemamap()JSON Schema for the tool's parameters
callback(map() -> term())Function that executes the tool
categoryatom()Grouping: :filesystem, :git, :lsp, etc.
approval_levelatom():auto, :ask, or :deny
metadatamap()Extensible bag for future fields

Summary

Types

Approval level for tool execution.

Tool category for grouping and filtering.

t()

A tool specification.

Functions

Creates a new tool spec from a keyword list.

Creates a new tool spec, raising on validation failure.

Types

approval_level()

@type approval_level() :: :auto | :ask | :deny

Approval level for tool execution.

category()

@type category() :: :filesystem | :git | :lsp | :shell | :memory | :agent | :custom

Tool category for grouping and filtering.

t()

@type t() :: %MingaAgent.Tool.Spec{
  approval_level: approval_level(),
  callback: (map() -> term()),
  category: category(),
  description: String.t(),
  metadata: map(),
  name: String.t(),
  parameter_schema: map()
}

A tool specification.

Functions

new(attrs)

@spec new(keyword()) :: {:ok, t()} | {:error, String.t()}

Creates a new tool spec from a keyword list.

Required keys: :name, :description, :parameter_schema, :callback. Optional keys: :category (default :custom), :approval_level (default :auto), :metadata (default %{}).

new!(attrs)

@spec new!(keyword()) :: t()

Creates a new tool spec, raising on validation failure.