Skip to main content

Module tool_schema

Module tool_schema 

Source
Expand description

Tool-catalog renderer — Phase 2 of action-grain unification (2026-04-20).

Renders Tool grains with kind = Definition into the wire format of a target LLM provider (OpenAI, Anthropic, Gemini, MCP, Hermes, Llama 3.1, Markdown, SML). Every adapter accepts a Phase-1-validated definition and produces output that is legal for its target provider by construction.

Adapter outputs are deterministic — same input, same bytes — so CAL template rendering is stable across replicas.

See docs/facts/tool-formats.md for output shape examples.

Re-exports§

pub use parse::parse;
pub use parse::ParseError;
pub use parse::ParsedToolCall;

Modules§

anthropic
Anthropic Messages API tool adapter.
escape
Shared escape helpers for text-format tool adapters (SR-F1).
gemini
Google Gemini function-declaration adapter.
hermes
Hermes-2-Pro-style text envelope (<tool>…</tool> + fenced JSON).
llama31
Llama 3.1 prompt-format text envelope.
markdown
Markdown-with-fenced-JSON adapter.
mcp
MCP tools/list adapter — MCP 2025-06-18 spec.
openai
OpenAI Chat Completions + Responses adapters.
parse
Parse-back helper — Phase 3 of action-grain unification (2026-04-20).
sml
SML (an XML-like) tool envelope.

Enums§

ProviderKind
Target provider for tool-catalog rendering.

Functions§

render_any
Convenience wrapper — returns Value::String for text providers, native JSON for JSON providers. Useful for CAL format dispatch.
render_json
Render an Tool into provider-native JSON.
render_text
Render an Tool into provider-native text (Hermes, Llama31, Markdown, SML).