Skip to content

feat(server): MiniMax-M3 tool-call parser (namespaced XML format) #770

Closed

Description

@inureyes

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 item tags form arrays
    • mixed text plus child elements puts the text under a $text field
  • Value coercion is schema-aware using the request's tool JSON schema: normalize int/uint/long to integer, num/float to number, dict to object, list to array; handle anyOf/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

  1. try_minimax_m3 in src/server/tool_calls/formats.rs using a small recursive-descent parser over the namespaced tags (nesting matters, so do not attempt a regex-only implementation). New ToolCallFormat::MinimaxM3 in types.rs, registry entry in parser.rs ordered before the generic JSON parsers.
  2. Streaming: add enter/exit rows for ]<]minimax[>[<tool_call> / ]<]minimax[>[</tool_call> to CHAT_DELIMITERS in src/server/tool_calls/stream_filter.rs; verify safe_emit_length holds back partial prefixes of the unusual multi-character namespace token.
  3. Unit tests: single call, parallel invokes, nested object and array params, repeated-tag arrays, $text mixed 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_calls in both streaming and non-streaming modes.

Effort: high (largest parser). Related to #763.

Activity

  1. added
    type:enhancement
    priority:low
    status:ready
    status:in-progress
    status:review
    status:done
    and removed
    status:ready
    status:in-progress
    status:review
    on Jul 13, 2026
  2. added a commit that references this issue on Jul 30, 2026
    4d36e85
  3. self-assigned this
    on Aug 31, 2026
  4. added a commit that references this issue on Oct 27, 2026
    c2fbdcb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority:lowstatus:donetype:enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions