GenAI.Tool.Source behaviour (GenAI Core v0.3.4)

Copy Markdown

Dependency-neutral contract for a source of callable tools.

A source may be an MCP client, an in-process harness, a database facade, or any other adapter. genai_core deliberately does not know how the source is transported or authenticated.

Summary

Types

context()

@type context() :: term()

options()

@type options() :: keyword()

source()

@type source() :: term()

tool_descriptor()

@type tool_descriptor() :: GenAI.Tool.t() | map() | keyword()

Callbacks

call_tool(source, t, map, context, options)

@callback call_tool(source(), String.t(), map(), context(), options()) ::
  {:ok, term()} | {:error, term()}

list_tools(source, context, options)

@callback list_tools(source(), context(), options()) ::
  {:ok, [tool_descriptor()]} | {:error, term()}