const MAX_GRAMMAR_TOOL_CALLS_ENV: &str = "GGLIB_MAX_GRAMMAR_TOOL_CALLS";Expand description
Build the GBNF grammar for one or more dialect tool calls, from the
same DialectSpec the parser reads.
The envelope is exactly what the DelimitedToolCallParser prefers to
parse — the JSON body codec, {"name": …, "arguments": {…}} in that
key order (the order the models were trained on) — wrapped in the
spec’s markers with the spec’s emission newlines. name is an enum of
the demanded tools; arguments is constrained to well-formed JSON.
Malformed envelopes, truncated JSON, and invented tool names all become
unrepresentable at decode time.
Returns None when a marker cannot be embedded in a GBNF literal
(gbnf_string_literal) — the caller falls back to unconstrained
decode rather than risk a grammar llama-server cannot compile.
Overrides the grammar’s tool-call bound. Numeric; clamped to at least 1.