Repository navigation
Closed
Labels
priority:lowLow prioritystatus:doneCompletedtype:enhancementNew features, capabilities, or significant additions
Description
Summary
MiniMax-M3 emits tool calls in a namespaced XML dialect that none of the existing parsers in src/server/tool_calls/formats.rs handle. Add a dedicated parser plus streaming delimiters. It becomes user-visible once MiniMax-M3 (#763) lands; the parser itself is model-independent and fully testable standalone.
Format specification
- Namespace token: the literal string
]<]minimax[>[prefixes every tag. - Tool block:
]<]minimax[>[<tool_call>...]<]minimax[>[</tool_call>. - Each invocation:
]<]minimax[>[<invoke name="NAME">...]<]minimax[>[</invoke>; multiple invokes per block are allowed. - Parameters are nested namespaced elements (
]<]minimax[>[<param_name>value]<]minimax[>[</param_name>) and can nest:- repeated tags with the same name fold into an array
- explicit
itemtags form arrays - mixed text plus child elements puts the text under a
$textfield
- Value coercion is schema-aware using the request's tool JSON schema: normalize
int/uint/longto integer,num/floatto number,dictto object,listto array; handleanyOf/oneOf/enum. Values that fail typed parsing fall back to JSON parse, then loose literal parse (numbers, booleans), then raw string. - Arguments serialize to a JSON string in the parsed result. Malformed markup must yield "no parse" (return None), never a panic.
- The model's reasoning marker is
<mm:think>; it matters only for template detection, not for this parser.
Implementation plan
try_minimax_m3insrc/server/tool_calls/formats.rsusing a small recursive-descent parser over the namespaced tags (nesting matters, so do not attempt a regex-only implementation). NewToolCallFormat::MinimaxM3intypes.rs, registry entry inparser.rsordered before the generic JSON parsers.- Streaming: add enter/exit rows for
]<]minimax[>[<tool_call>/]<]minimax[>[</tool_call>toCHAT_DELIMITERSinsrc/server/tool_calls/stream_filter.rs; verifysafe_emit_lengthholds back partial prefixes of the unusual multi-character namespace token. - Unit tests: single call, parallel invokes, nested object and array params, repeated-tag arrays,
$textmixed content, schema coercion for each kind, malformed input, and streaming splits at every byte boundary of the namespace token.
Acceptance criteria
- All new unit tests pass; existing parser ordering tests stay green (hermes and generic_json unaffected).
- With a MiniMax-M3 checkpoint (once available), an end-to-end chat request with tools returns structured
tool_callsin both streaming and non-streaming modes.
Effort: high (largest parser). Related to #763.
Metadata
Metadata
Assignees
Labels
priority:lowLow prioritystatus:doneCompletedtype:enhancementNew features, capabilities, or significant additions
Activity
feat(server): MiniMax-M3 tool-call parser (namespaced XML format) (la…
feat(server): MiniMax-M3 tool-call parser (namespaced XML format) (la…