Models do not emit one universal tool-call syntax. AFM detects several native formats and lets you decide whether to preserve, repair, or expose their output.
Three modes
| Mode | Start option | Use it when |
|---|---|---|
| Native | Default | You want the model family's narrow parser and parity with its documented format. |
| Repair | --tool-call-parser afm_adaptive_xml | A real client needs resilience to JSON-in-XML, type mistakes, nullable schemas, or fuzzy names. |
| Raw | --tool-call-parser none | You are inspecting the exact emitted markup or diagnosing a template/parser mismatch. |
# Production-oriented repair mode
afm mlx -m <model> \
--tool-call-parser afm_adaptive_xml \
--fix-tool-args
# Parser-free inspection
afm mlx -m <model> --tool-call-parser noneModel-native formats
AFM detects tool conventions using the model configuration and chat template. Supported families include JSON, Qwen XML, Gemma, GLM, Kimi, MiniMax, LFM2, and related variants. Detection is not a claim that every checkpoint was trained equally well for tools; it selects the compatible parser.
Tool choice
| Value | Meaning |
|---|---|
auto | The model may answer normally or call a tool. |
none | Tool calls are disabled for the request. |
required | The response must select a tool. |
| Named function | Force one declared function. |
Streaming responses expose OpenAI-style tool-call deltas while ordinary assistant content continues through normal content chunks.
Structured output is a separate layer
response_format: { "type": "json_object" } and JSON-schema response requests tell AFM what the client expects. Token-level enforcement is enabled only when the server starts with --enable-grammar-constraints.
SCHEMA=$(jq -c . schema.json)
afm mlx -m <model> \
--guided-json "$SCHEMA" \
--enable-grammar-constraintsA server-level --guided-json schema applies when an individual request omits response_format. Tools, grammar-constrained output, logprobs, and stop sequences also make speculative MTP/EAGLE3 requests ineligible for their fast path.
Client patterns that matter
- OpenCode and Cline: stable, long system prompts benefit from
--enable-prefix-caching. - Multiple tabs or sessions: set
--concurrent Nto the number of active conversations you intend to serve. - OpenClaw:
--openclaw-configemits a provider block with detected model metadata. - Required API key field: use any placeholder value; AFM does not authenticate localhost requests by default.