Alloy.Tool.Registry (alloy v0.12.4)

Copy Markdown View Source

Builds tool schemas and function maps from tool definitions.

Takes a list of modules implementing Alloy.Tool and/or Alloy.Tool.Inline structs (see Alloy.Tool.inline/1) and produces:

  1. Tool definitions (JSON Schema format for providers)
  2. A dispatch map from tool name → module or inline struct

Summary

Functions

Build tool definitions and dispatch map from a list of tools.

Types

tool()

@type tool() :: module() | Alloy.Tool.Inline.t()

Functions

build(tools)

@spec build([tool()]) :: {[map()], %{required(String.t()) => tool()}}

Build tool definitions and dispatch map from a list of tools.

Each entry is either a module implementing Alloy.Tool or an Alloy.Tool.Inline struct. Returns {tool_defs, tool_fns} where:

  • tool_defs is a list of maps suitable for provider APIs
  • tool_fns maps tool name strings to their implementing tool