Toolnexus.Adapters (toolnexus v0.9.4)

Copy Markdown View Source

Provider adapters — turn the uniform tool list into each LLM's tool schema (SPEC §0.7).

Execution is identical for every provider: read the tool name + args the model returned, call execute(name, args), feed output back. All emitted maps are string-keyed so their JSON encoding is byte-identical across ports.

Summary

Functions

Anthropic shape: {name, description, input_schema} per tool.

Gemini shape: a single-element list wrapping all declarations — [%{functionDeclarations: [{name, description, parameters}, …]}]. The wrapper is emitted even for an empty tool list (JS parity).

OpenAI shape: {type: "function", function: {name, description, parameters}} per tool.

Functions

to_anthropic(tools)

@spec to_anthropic([Toolnexus.Tool.t()]) :: [map()]

Anthropic shape: {name, description, input_schema} per tool.

to_gemini(tools)

@spec to_gemini([Toolnexus.Tool.t()]) :: [map()]

Gemini shape: a single-element list wrapping all declarations — [%{functionDeclarations: [{name, description, parameters}, …]}]. The wrapper is emitted even for an empty tool list (JS parity).

to_openai(tools)

@spec to_openai([Toolnexus.Tool.t()]) :: [map()]

OpenAI shape: {type: "function", function: {name, description, parameters}} per tool.