ToolCall.Schema.Gemini (ToolCall v0.4.0)

Copy Markdown

Target-level schema adaptation that does not require ToolCall.IR.

to_gemini/2 rewrites a JSON Schema into Gemini's OpenAPI 3.0 parameters subset. It is the transformation ToolCall.Emit.Gemini applies after rendering a tool, exposed for callers that already hold a schema. It deliberately does not perform the strict rewrite: that needs ToolCall.IR.Param.required and remains owned by ToolCall.Emit.Schema. The root must be an object schema; a multi-type type array raises instead of widening to {}, and a null-only schema raises because Gemini has no null type.

Local $defs references are controlled by :on_ref:

  • :raise (default) refuses the schema, matching ToolCall.emit/3;
  • :drop removes $defs and $ref, leaving their sibling keywords;
  • :inline substitutes non-recursive definitions and raises on a cycle.

Summary

Functions

Rewrites schema into Gemini's parameters subset.

Types

on_ref()

@type on_ref() :: :raise | :drop | :inline

Functions

to_gemini(schema, opts \\ [])

@spec to_gemini(map(), keyword()) :: map()

Rewrites schema into Gemini's parameters subset.

Options:

  • :on_ref - :raise (default), :drop or :inline; see the module documentation.
  • :name - the tool name used in the reference error message.