ToolCall.Emit (ToolCall v0.4.0)

Copy Markdown

Dispatches IR to a provider-specific schema.

The IR is intentionally provider-neutral: docs/design.md lists the subset each provider actually accepts.

precompile/1 renders the closed set of provider-call variants at compile time so that a module carries finished schemas as literals; emit/3 renders loose IR values on demand. MCP is not precompiled: its inputSchema is the same parameters object the other targets embed, so ToolCall.emit/3 renders it on demand. Runtime IR is validated before rendering.

Summary

Types

target()

@type target() :: :openai | :anthropic | :mcp | :gemini

Functions

emit(tools_or_tool, target, opts \\ [])

@spec emit([ToolCall.IR.Tool.t()] | ToolCall.IR.Tool.t(), target(), keyword()) ::
  [map()] | map()