# `vllm_mlx.tool_parsers.qwen3_xml_tool_parser`

Qwen 3.5 XML tool call parser for vllm-mlx.

[View the complete module source at #L1-L1559](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1-L1559).

## API details

Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.

::: vllm_mlx.tool_parsers.qwen3_xml_tool_parser
    options:
      members:
        - logger
        - DeltaFunctionCall
        - DeltaToolCall
        - DeltaMessage
        - ChatCompletionToolsParam
        - _FunctionDef
        - _ToolDef
        - StreamingXMLToolCallParser
        - Qwen3XMLToolParser
      filters: []
      show_if_no_docstring: true

## Complete contract reference

Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaFunctionCall" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaFunctionCall</code> · class</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaFunctionCall(name: Optional[str] = None, arguments: str = '')
```

Incremental function name and argument payload used by the XML parser.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `Optional[str]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `arguments` | `str` | `no` | `''` | Optional constructor field; defaults to `''`. |

**Returns**

- Constructs: `vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaFunctionCall`

**Exceptions and behavior**

Class `DeltaFunctionCall` declares 0 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L54-L58](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L54-L58).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaToolCall" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaToolCall</code> · class</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaToolCall(index: int = 0, id: Optional[str] = None, type: str = 'function', function: Optional[DeltaFunctionCall] = None)
```

Incremental indexed tool call produced by the XML parser shim.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `index` | `int` | `no` | `0` | Optional constructor field; defaults to `0`. |
| `id` | `Optional[str]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `type` | `str` | `no` | `'function'` | Optional constructor field; defaults to `'function'`. |
| `function` | `Optional[DeltaFunctionCall]` | `no` | `None` | Optional constructor field; defaults to `None`. |

**Returns**

- Constructs: `vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaToolCall`

**Exceptions and behavior**

Class `DeltaToolCall` declares 0 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L62-L68](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L62-L68).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaMessage" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaMessage</code> · class</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaMessage(content: Optional[str] = None, tool_calls: Optional[list[DeltaToolCall]] = None, role: Optional[str] = None, reasoning_content: Optional[str] = None)
```

Incremental content, reasoning, and tool calls from the parser shim.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `content` | `Optional[str]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `tool_calls` | `Optional[list[DeltaToolCall]]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `role` | `Optional[str]` | `no` | `None` | Optional constructor field; defaults to `None`. |
| `reasoning_content` | `Optional[str]` | `no` | `None` | Optional constructor field; defaults to `None`. |

**Returns**

- Constructs: `vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaMessage`

**Exceptions and behavior**

Class `DeltaMessage` declares 0 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L72-L78](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L72-L78).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef</code> · class</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef(d: dict)
```

Wrap a function definition dict for attribute access.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `d` | `dict` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Constructs: `vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef`

**Exceptions and behavior**

Class `_FunctionDef` declares 3 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L85-L99](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L85-L99).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.__init__" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.__init__</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.__init__(d: dict) -> not annotated
```

Method `_FunctionDef.__init__` updates `self._d`.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `d` | `dict` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `_FunctionDef.__init__` updates `self._d`.
No direct `raise` statement appears in this definition.

[View source #L90-L91](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L90-L91).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.name" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.name</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.name() -> str
```

Method `_FunctionDef.name` calls `self._d.get`; returns `self._d.get('name', '')`.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `str`
- Direct return expressions: `self._d.get('name', '')`

**Exceptions and behavior**

Method `_FunctionDef.name` calls `self._d.get`; returns `self._d.get('name', '')`.
No direct `raise` statement appears in this definition.

[View source #L94-L95](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L94-L95).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.parameters" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.parameters</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.parameters() -> dict
```

Method `_FunctionDef.parameters` calls `self._d.get`; returns `self._d.get('parameters', {})`.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `dict`
- Direct return expressions: `self._d.get('parameters', {})`

**Exceptions and behavior**

Method `_FunctionDef.parameters` calls `self._d.get`; returns `self._d.get('parameters', {})`.
No direct `raise` statement appears in this definition.

[View source #L98-L99](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L98-L99).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef</code> · class</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef(d: dict)
```

Wrap a tool definition dict for attribute access.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `d` | `dict` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Constructs: `vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef`

**Exceptions and behavior**

Class `_ToolDef` declares 3 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L102-L117](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L102-L117).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.__init__" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.__init__</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.__init__(d: dict) -> not annotated
```

Method `_ToolDef.__init__` updates `self._d`, `self._func`; calls `_FunctionDef`, `d.get`.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `d` | `dict` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `_ToolDef.__init__` updates `self._d`, `self._func`; calls `_FunctionDef`, `d.get`.
No direct `raise` statement appears in this definition.

[View source #L107-L109](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L107-L109).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.type" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.type</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.type() -> str
```

Method `_ToolDef.type` calls `self._d.get`; returns `self._d.get('type', 'function')`.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `str`
- Direct return expressions: `self._d.get('type', 'function')`

**Exceptions and behavior**

Method `_ToolDef.type` calls `self._d.get`; returns `self._d.get('type', 'function')`.
No direct `raise` statement appears in this definition.

[View source #L112-L113](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L112-L113).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.function" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.function</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.function() -> _FunctionDef
```

Method `_ToolDef.function` returns `self._func`.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `_FunctionDef`
- Direct return expressions: `self._func`

**Exceptions and behavior**

Method `_ToolDef.function` returns `self._func`.
No direct `raise` statement appears in this definition.

[View source #L116-L117](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L116-L117).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser</code> · class</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser()
```

Streaming XML parser for Qwen 3.5 ``<tool_call>`` format.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Constructs: `vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser`

**Exceptions and behavior**

Class `StreamingXMLToolCallParser` declares 27 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L126-L1427](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L126-L1427).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.__init__" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.__init__</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.__init__() -> not annotated
```

Method `StreamingXMLToolCallParser.__init__` updates `self.tools`, `self.tool_call_start_token`, `self.tool_call_end_token`, `self.function_start_token`; calls `self.reset_streaming_state`.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser.__init__` updates `self.tools`, `self.tool_call_start_token`, `self.tool_call_end_token`, `self.function_start_token`; calls `self.reset_streaming_state`.
No direct `raise` statement appears in this definition.

[View source #L146-L156](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L146-L156).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.reset_streaming_state" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.reset_streaming_state</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.reset_streaming_state() -> not annotated
```

Reset streaming parsing state

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser.reset_streaming_state` updates `self.deltas`, `self.tool_call_index`, `self.current_call_id`, `self.last_completed_call_id`; calls `ParserCreate`, `self.setup_parser`.
No direct `raise` statement appears in this definition.

[View source #L158-L208](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L158-L208).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.parse_single_streaming_chunks" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.parse_single_streaming_chunks</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.parse_single_streaming_chunks(xml_chunk: str) -> DeltaMessage
```

Parse single streaming XML chunk and return Delta response This is the actual streaming interface that receives chunks one by one and maintains internal state Args: xml_chunk: Single XML chunk string Returns: DeltaMessage: Contains delta information generated by this chunk, returns empty response if no complete elements

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `xml_chunk` | `str` | `yes` | `none` | Single XML chunk string |

**Returns**

- Type: `DeltaMessage`
- Direct return expressions: `result_delta`; `text_delta`; `DeltaMessage(content=None)`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser.parse_single_streaming_chunks` updates `self.streaming_buffer`, `self.text_content_buffer`; calls `len`, `self._process_complete_xml_elements`, `xml_chunk.count`, `sum`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L210-L330](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L210-L330).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._escape_xml_special_chars" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._escape_xml_special_chars</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._escape_xml_special_chars(text: str) -> str
```

Escape XML special characters Args: text: Original text Returns: Escaped text

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `text` | `str` | `yes` | `none` | Original text |

**Returns**

- Type: `str`
- Direct return expressions: `text`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._escape_xml_special_chars` calls `xml_escapes.items`, `text.replace`; returns `text`.
No direct `raise` statement appears in this definition.

[View source #L332-L351](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L332-L351).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._process_complete_xml_elements" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._process_complete_xml_elements</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._process_complete_xml_elements() -> bool
```

Process complete XML elements in buffer Returns: bool: Whether complete elements were found and processed

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `bool`
- Direct return expressions: `found_any`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._process_complete_xml_elements` updates `self.last_processed_pos`, `self.text_content_buffer`, `self._current_raw_element`; calls `len`, `self._find_next_complete_element`, `self._should_skip_element`, `self._preprocess_xml_chunk`; returns `found_any`.
No direct `raise` statement appears in this definition.

[View source #L353-L438](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L353-L438).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._should_skip_element" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._should_skip_element</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._should_skip_element(element: str) -> bool
```

Determine whether an element should be skipped Args: element: Element to evaluate Returns: bool: True means should skip, False means should process

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `element` | `str` | `yes` | `none` | Element to evaluate |

**Returns**

- Type: `bool`
- Direct return expressions: `False`; `True`; `not element`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._should_skip_element` updates `self.text_content_buffer`; calls `element.startswith`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L440-L474](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L440-L474).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._looks_like_partial_tool_open" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._looks_like_partial_tool_open</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._looks_like_partial_tool_open(fragment: str) -> bool
```

True if `fragment` could complete into a tool-related XML tag.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `fragment` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `bool`
- Direct return expressions: `False`; `True`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._looks_like_partial_tool_open` calls `fragment.startswith`, `prefix.startswith`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L488-L501](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L488-L501).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._find_next_complete_element" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._find_next_complete_element</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._find_next_complete_element(start_pos: int) -> tuple[Optional[str], int]
```

Find next complete XML element from specified position Args: start_pos: Position to start searching Returns: (Complete element string, element end position), returns (None, start_pos) if no complete element found

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `start_pos` | `int` | `yes` | `none` | Position to start searching |

**Returns**

- Type: `tuple[Optional[str], int]`
- Direct return expressions: `(None, start_pos)`; `(buffer[:tag_end], start_pos + tag_end)`; `(buffer[:tag_end2 + 1], start_pos + tag_end2 + 1)`; `(buffer, start_pos + len(buffer))`; `(text_content, start_pos + next_tag_pos)`; `(remaining, start_pos + len(remaining))`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._find_next_complete_element` calls `buffer.startswith`, `buffer.find`, `self._looks_like_partial_tool_open`, `len`; has 6 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L503-L569](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L503-L569).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._merge_new_deltas_to_single_response" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._merge_new_deltas_to_single_response</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._merge_new_deltas_to_single_response(initial_count: int) -> DeltaMessage
```

Merge newly generated deltas from this processing into a single DeltaMessage Args: initial_count: Delta count before processing Returns: Merged DeltaMessage containing all newly generated delta information

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `initial_count` | `int` | `yes` | `none` | Delta count before processing |

**Returns**

- Type: `DeltaMessage`
- Direct return expressions: `DeltaMessage(content=None)`; `new_deltas[0]`; `DeltaMessage(content=merged_content if merged_content else None, tool_calls=merged_tool_calls)`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._merge_new_deltas_to_single_response` calls `len`, `DeltaMessage`, `merged_tool_calls.append`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L571-L633](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L571-L633).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._preprocess_xml_chunk" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._preprocess_xml_chunk</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._preprocess_xml_chunk(chunk: str) -> str
```

Preprocess XML chunk, handle non-standard formats, and escape special characters Args: chunk: Original XML chunk Returns: Processed XML chunk

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `chunk` | `str` | `yes` | `none` | Original XML chunk |

**Returns**

- Type: `str`
- Direct return expressions: `f'{safe_text}</parameter>'`; `self._escape_xml_special_chars(original_chunk)`; `''`; `processed`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._preprocess_xml_chunk` updates `self.defer_current_parameter`, `self.deferred_param_raw_value`, `self._pre_inside_parameter`, `self._pre_param_buffer`; calls `chunk.startswith`, `re.sub`, `processed.startswith`, `self._escape_xml_special_chars`; has 4 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L635-L748](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L635-L748).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._emit_delta" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._emit_delta</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._emit_delta(delta: DeltaMessage) -> not annotated
```

Emit Delta response (streaming output)

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `delta` | `DeltaMessage` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._emit_delta` calls `self.deltas.append`.
No direct `raise` statement appears in this definition.

[View source #L750-L752](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L750-L752).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._auto_close_open_parameter_if_needed" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._auto_close_open_parameter_if_needed</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._auto_close_open_parameter_if_needed(incoming_tag: Optional[str] = None) -> not annotated
```

Before starting to process new elements, if there are unclosed tags from before, automatically complete their endings to the parser.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `incoming_tag` | `Optional[str]` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._auto_close_open_parameter_if_needed` calls `self._end_element`.
No direct `raise` statement appears in this definition.

[View source #L754-L777](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L754-L777).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._start_element" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._start_element</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._start_element(name: str, attrs: dict[str, str]) -> not annotated
```

Handle XML start element events

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `str` | `yes` | `none` | Required positional or keyword input. |
| `attrs` | `dict[str, str]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`
- Direct return expressions: `None`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._start_element` updates `self.parameters`, `self.current_call_id`, `self.current_param_is_first`, `self.tool_call_index`; calls `self._auto_close_open_parameter_if_needed`, `self._get_next_call_id`, `name.startswith`, `self._start_element`; returns `None`.
No direct `raise` statement appears in this definition.

[View source #L779-L888](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L779-L888).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._flush_pending_implicit_delta" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._flush_pending_implicit_delta</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._flush_pending_implicit_delta() -> None
```

Emit a deferred bare-<function=> delta now that the call is confirmed.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `None`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._flush_pending_implicit_delta` updates `self._pending_implicit_delta`, `self._pending_implicit_raw_text`, `self._pending_implicit_text_buffer`; calls `self._emit_delta`.
No direct `raise` statement appears in this definition.

[View source #L890-L900](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L890-L900).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._abandon_pending_implicit_tool_call" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._abandon_pending_implicit_tool_call</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._abandon_pending_implicit_tool_call() -> tuple[str, str]
```

Roll back a deferred bare-<function=> auto-open: prose followed.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `tuple[str, str]`
- Direct return expressions: `(raw_text, buffered_text)`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._abandon_pending_implicit_tool_call` updates `self._pending_implicit_delta`, `self._pending_implicit_raw_text`, `self._pending_implicit_text_buffer`, `self.implicit_tool_call_wrapper`; calls `self._reset_xml_parser_after_tool_call`; returns `(raw_text, buffered_text)`.
No direct `raise` statement appears in this definition.

[View source #L902-L928](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L902-L928).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._char_data" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._char_data</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._char_data(data: str) -> not annotated
```

Handle XML character data events

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `data` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`
- Direct return expressions: `None`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._char_data` updates `self._pending_implicit_text_buffer`, `self.should_emit_end_newline`, `self.current_param_value`, `self.start_quote_emitted`; calls `data.strip`, `self._abandon_pending_implicit_tool_call`, `self._emit_delta`, `DeltaMessage`; returns `None`.
No direct `raise` statement appears in this definition.

[View source #L930-L1025](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L930-L1025).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._end_element" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._end_element</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._end_element(name: str) -> not annotated
```

Handle XML end element events

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`
- Direct return expressions: `None`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._end_element` updates `self.should_emit_end_newline`, `self.current_param_name`, `self.current_param_value`, `self.current_param_value_converted`; calls `name.startswith`, `self._auto_close_open_parameter_if_needed`, `ast.literal_eval`, `json.dumps`; returns `None`.
No direct `raise` statement appears in this definition.

[View source #L1027-L1206](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1027-L1206).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.setup_parser" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.setup_parser</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.setup_parser() -> not annotated
```

Set up XML parser event handlers

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser.setup_parser` updates `self.parser.buffer_text`, `self.parser.StartElementHandler`, `self.parser.EndElementHandler`, `self.parser.CharacterDataHandler`.
No direct `raise` statement appears in this definition.

[View source #L1208-L1213](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1208-L1213).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.set_tools" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.set_tools</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.set_tools(tools: Union[list[ChatCompletionToolsParam], None]) -> not annotated
```

Set tool configuration information

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tools` | `Union[list[ChatCompletionToolsParam], None]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser.set_tools` updates `self.tools`.
No direct `raise` statement appears in this definition.

[View source #L1215-L1217](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1215-L1217).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._get_next_call_id" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._get_next_call_id</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._get_next_call_id() -> not annotated
```

Generate unique call ID

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`
- Direct return expressions: `f'call_{uuid.uuid4().hex[:24]}'`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._get_next_call_id` calls `uuid.uuid4`; returns `f'call_{uuid.uuid4().hex[:24]}'`.
No direct `raise` statement appears in this definition.

[View source #L1219-L1221](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1219-L1221).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._extract_function_name" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._extract_function_name</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._extract_function_name(name: str, attrs: dict[str, str]) -> Optional[str]
```

Extract function name from various formats

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `str` | `yes` | `none` | Required positional or keyword input. |
| `attrs` | `dict[str, str]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `Optional[str]`
- Direct return expressions: `attrs['name']`; `parts[1]`; `None`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._extract_function_name` calls `name.split`, `len`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L1223-L1233](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1223-L1233).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._extract_parameter_name" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._extract_parameter_name</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._extract_parameter_name(name: str, attrs: dict[str, str]) -> Optional[str]
```

Extract parameter name from various formats

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `str` | `yes` | `none` | Required positional or keyword input. |
| `attrs` | `dict[str, str]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `Optional[str]`
- Direct return expressions: `attrs['name']`; `parts[1]`; `None`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._extract_parameter_name` calls `name.split`, `len`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L1235-L1247](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1235-L1247).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._get_param_type" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._get_param_type</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._get_param_type(param_name: str) -> str
```

Get parameter type based on tool configuration, defaults to string Args: param_name: Parameter name Returns: Parameter type

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `param_name` | `str` | `yes` | `none` | Parameter name |

**Returns**

- Type: `str`
- Direct return expressions: `'string'`; `self.repair_param_type(str(properties[param_name].get('type', 'string')))`; `self.repair_param_type(str(param_config.get('type', 'string')))`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._get_param_type` calls `hasattr`, `isinstance`, `self.repair_param_type`, `str`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L1249-L1287](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1249-L1287).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.repair_param_type" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.repair_param_type</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.repair_param_type(param_type: str) -> str
```

Repair unknown parameter types by treating them as string Args: param_type: Parameter type Returns: Repaired parameter type

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `param_type` | `str` | `yes` | `none` | Parameter type |

**Returns**

- Type: `str`
- Direct return expressions: `param_type`; `'string'`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser.repair_param_type` calls `param_type.startswith`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L1289-L1315](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1289-L1315).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._convert_param_value" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._convert_param_value</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._convert_param_value(param_value: str, param_type: str) -> Any
```

Convert value based on parameter type Args: param_value: Parameter value param_type: Parameter type Returns: Converted value

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `param_value` | `str` | `yes` | `none` | Parameter value |
| `param_type` | `str` | `yes` | `none` | Parameter type |

**Returns**

- Type: `Any`
- Direct return expressions: `None`; `param_value`; `int(param_value)`; `float_param_value if float_param_value - int(float_param_value) != 0 else int(float_param_value)`; `param_value == 'true'`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._convert_param_value` calls `param_value.lower`, `param_type.strip().lower`, `param_type.strip`, `param_type.startswith`; has 5 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L1317-L1371](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1317-L1371).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._convert_for_json_streaming" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._convert_for_json_streaming</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._convert_for_json_streaming(converted_value: Any, param_type: str) -> str
```

Convert converted_value based on whether it's empty and if type is string Args: converted_value: Converted value param_type: Parameter type Returns: Converted string for streaming output

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `converted_value` | `Any` | `yes` | `none` | Converted value |
| `param_type` | `str` | `yes` | `none` | Parameter type |

**Returns**

- Type: `str`
- Direct return expressions: `''`; `json.dumps(converted_value, ensure_ascii=False)[1:-1]`; `json.dumps(converted_value, ensure_ascii=False)`; `converted_value`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._convert_for_json_streaming` calls `json.dumps`, `isinstance`; has 4 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L1373-L1395](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1373-L1395).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._reset_xml_parser_after_tool_call" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._reset_xml_parser_after_tool_call</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._reset_xml_parser_after_tool_call() -> not annotated
```

Each tool_call is treated as a separate XML document, so we need to reset the parser after each tool_call.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `StreamingXMLToolCallParser._reset_xml_parser_after_tool_call` updates `self.parser`, `self.last_completed_call_id`, `self.current_call_id`, `self.current_function_name`; calls `ParserCreate`, `self.setup_parser`.
No direct `raise` statement appears in this definition.

[View source #L1397-L1427](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1397-L1427).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser</code> · class</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser(tokenizer = None)
```

XML tool call parser for Qwen 3.5 models, adapted for vllm-mlx.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tokenizer` | `not annotated` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Constructs: `vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser`

**Exceptions and behavior**

Class `Qwen3XMLToolParser` derives from `ToolParser` and declares 4 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L1442-L1559](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1442-L1559).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.__init__" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.__init__</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.__init__(tokenizer = None) -> not annotated
```

Method `Qwen3XMLToolParser.__init__` updates `self._xml_parser`; calls `super().__init__`, `super`, `StreamingXMLToolCallParser`, `logger.info`.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tokenizer` | `not annotated` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `Qwen3XMLToolParser.__init__` updates `self._xml_parser`; calls `super().__init__`, `super`, `StreamingXMLToolCallParser`, `logger.info`.
No direct `raise` statement appears in this definition.

[View source #L1454-L1460](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1454-L1460).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser._wrap_tools" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser._wrap_tools</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser._wrap_tools(request: dict[str, Any] | None) -> list[_ToolDef] | None
```

Convert tool definition dicts to _ToolDef wrappers for attribute access.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `request` | `dict[str, Any] \| None` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `list[_ToolDef] | None`
- Direct return expressions: `[_ToolDef(t) for t in request['tools']]`; `None`

**Exceptions and behavior**

Method `Qwen3XMLToolParser._wrap_tools` calls `request.get`, `_ToolDef`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L1463-L1467](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1463-L1467).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.extract_tool_calls" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.extract_tool_calls</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.extract_tool_calls(model_output: str, request: dict[str, Any] | None = None) -> ExtractedToolCallInformation
```

Extract tool calls from complete Qwen 3.5 output.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `model_output` | `str` | `yes` | `none` | Required positional or keyword input. |
| `request` | `dict[str, Any] \| None` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Type: `ExtractedToolCallInformation`
- Direct return expressions: `ExtractedToolCallInformation(tools_called=False, tool_calls=[], content=result.content if result.content else model_out…`; `ExtractedToolCallInformation(tools_called=len(tool_calls) > 0, tool_calls=tool_calls, content=result.content)`

**Exceptions and behavior**

Method `Qwen3XMLToolParser.extract_tool_calls` calls `self.strip_think_tags`, `self._xml_parser.reset_streaming_state`, `self._wrap_tools`, `self._xml_parser.set_tools`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L1469-L1507](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1469-L1507).

</details>

<details class="api-contract" id="contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.extract_tool_calls_streaming" markdown="1">
<summary><code>vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.extract_tool_calls_streaming</code> · method</summary>

```python
vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.extract_tool_calls_streaming(previous_text: str, current_text: str, delta_text: str, previous_token_ids: Sequence[int] | None = None, current_token_ids: Sequence[int] | None = None, delta_token_ids: Sequence[int] | None = None, request: dict[str, Any] | None = None) -> dict[str, Any] | None
```

Extract tool calls from streaming Qwen 3.5 output.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `previous_text` | `str` | `yes` | `none` | Required positional or keyword input. |
| `current_text` | `str` | `yes` | `none` | Required positional or keyword input. |
| `delta_text` | `str` | `yes` | `none` | Required positional or keyword input. |
| `previous_token_ids` | `Sequence[int] \| None` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |
| `current_token_ids` | `Sequence[int] \| None` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |
| `delta_token_ids` | `Sequence[int] \| None` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |
| `request` | `dict[str, Any] \| None` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Type: `dict[str, Any] | None`
- Direct return expressions: `None`; `{'tool_calls': tool_calls}`; `{'content': result.content}`

**Exceptions and behavior**

Method `Qwen3XMLToolParser.extract_tool_calls_streaming` calls `self._xml_parser.reset_streaming_state`, `self._wrap_tools`, `self._xml_parser.set_tools`, `self._xml_parser.parse_single_streaming_chunks`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L1509-L1559](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1509-L1559).

</details>

## Complete symbol map

This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.

| Symbol | Kind | Signature and inputs | What it does | Source |
| --- | --- | --- | --- | --- |
| [`DeltaFunctionCall`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaFunctionCall) | class | `DeltaFunctionCall(name: Optional[str] = None, arguments: str = '')` | Incremental function name and argument payload used by the XML parser. | [#L54-L58](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L54-L58) |
| [`DeltaToolCall`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaToolCall) | class | `DeltaToolCall(index: int = 0, id: Optional[str] = None, type: str = 'function', function: Optional[DeltaFunctionCall] = None)` | Incremental indexed tool call produced by the XML parser shim. | [#L62-L68](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L62-L68) |
| [`DeltaMessage`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.DeltaMessage) | class | `DeltaMessage(content: Optional[str] = None, tool_calls: Optional[list[DeltaToolCall]] = None, role: Optional[str] = None, reasoning_content: Optional[str] = None)` | Incremental content, reasoning, and tool calls from the parser shim. | [#L72-L78](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L72-L78) |
| [`_FunctionDef`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef) | class | `_FunctionDef(d: dict)` | Wrap a function definition dict for attribute access. | [#L85-L99](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L85-L99) |
| [`_FunctionDef.__init__`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.__init__) | method | `_FunctionDef.__init__(d: dict) -> not annotated` | Method `_FunctionDef.__init__` updates `self._d`. | [#L90-L91](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L90-L91) |
| [`_FunctionDef.name`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.name) | method | `_FunctionDef.name() -> str` | Method `_FunctionDef.name` calls `self._d.get`; returns `self._d.get('name', '')`. | [#L94-L95](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L94-L95) |
| [`_FunctionDef.parameters`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._FunctionDef.parameters) | method | `_FunctionDef.parameters() -> dict` | Method `_FunctionDef.parameters` calls `self._d.get`; returns `self._d.get('parameters', {})`. | [#L98-L99](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L98-L99) |
| [`_ToolDef`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef) | class | `_ToolDef(d: dict)` | Wrap a tool definition dict for attribute access. | [#L102-L117](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L102-L117) |
| [`_ToolDef.__init__`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.__init__) | method | `_ToolDef.__init__(d: dict) -> not annotated` | Method `_ToolDef.__init__` updates `self._d`, `self._func`; calls `_FunctionDef`, `d.get`. | [#L107-L109](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L107-L109) |
| [`_ToolDef.type`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.type) | method | `_ToolDef.type() -> str` | Method `_ToolDef.type` calls `self._d.get`; returns `self._d.get('type', 'function')`. | [#L112-L113](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L112-L113) |
| [`_ToolDef.function`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser._ToolDef.function) | method | `_ToolDef.function() -> _FunctionDef` | Method `_ToolDef.function` returns `self._func`. | [#L116-L117](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L116-L117) |
| [`StreamingXMLToolCallParser`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser) | class | `StreamingXMLToolCallParser()` | Streaming XML parser for Qwen 3.5 ``<tool_call>`` format. | [#L126-L1427](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L126-L1427) |
| [`StreamingXMLToolCallParser.__init__`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.__init__) | method | `StreamingXMLToolCallParser.__init__() -> not annotated` | Method `StreamingXMLToolCallParser.__init__` updates `self.tools`, `self.tool_call_start_token`, `self.tool_call_end_token`, `self.function_start_token`; calls `self.reset_streaming_state`. | [#L146-L156](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L146-L156) |
| [`StreamingXMLToolCallParser.reset_streaming_state`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.reset_streaming_state) | method | `StreamingXMLToolCallParser.reset_streaming_state() -> not annotated` | Reset streaming parsing state | [#L158-L208](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L158-L208) |
| [`StreamingXMLToolCallParser.parse_single_streaming_chunks`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.parse_single_streaming_chunks) | method | `StreamingXMLToolCallParser.parse_single_streaming_chunks(xml_chunk: str) -> DeltaMessage` | Parse single streaming XML chunk and return Delta response This is the actual streaming interface that receives chunks one by one and maintains internal state Args: xml_chunk: Single XML chunk string Returns: DeltaMessage: Contains delta information generated by this chunk, returns empty response if no complete elements | [#L210-L330](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L210-L330) |
| [`StreamingXMLToolCallParser._escape_xml_special_chars`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._escape_xml_special_chars) | method | `StreamingXMLToolCallParser._escape_xml_special_chars(text: str) -> str` | Escape XML special characters Args: text: Original text Returns: Escaped text | [#L332-L351](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L332-L351) |
| [`StreamingXMLToolCallParser._process_complete_xml_elements`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._process_complete_xml_elements) | method | `StreamingXMLToolCallParser._process_complete_xml_elements() -> bool` | Process complete XML elements in buffer Returns: bool: Whether complete elements were found and processed | [#L353-L438](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L353-L438) |
| [`StreamingXMLToolCallParser._should_skip_element`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._should_skip_element) | method | `StreamingXMLToolCallParser._should_skip_element(element: str) -> bool` | Determine whether an element should be skipped Args: element: Element to evaluate Returns: bool: True means should skip, False means should process | [#L440-L474](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L440-L474) |
| [`StreamingXMLToolCallParser._looks_like_partial_tool_open`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._looks_like_partial_tool_open) | method | `StreamingXMLToolCallParser._looks_like_partial_tool_open(fragment: str) -> bool` | True if `fragment` could complete into a tool-related XML tag. | [#L488-L501](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L488-L501) |
| [`StreamingXMLToolCallParser._find_next_complete_element`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._find_next_complete_element) | method | `StreamingXMLToolCallParser._find_next_complete_element(start_pos: int) -> tuple[Optional[str], int]` | Find next complete XML element from specified position Args: start_pos: Position to start searching Returns: (Complete element string, element end position), returns (None, start_pos) if no complete element found | [#L503-L569](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L503-L569) |
| [`StreamingXMLToolCallParser._merge_new_deltas_to_single_response`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._merge_new_deltas_to_single_response) | method | `StreamingXMLToolCallParser._merge_new_deltas_to_single_response(initial_count: int) -> DeltaMessage` | Merge newly generated deltas from this processing into a single DeltaMessage Args: initial_count: Delta count before processing Returns: Merged DeltaMessage containing all newly generated delta information | [#L571-L633](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L571-L633) |
| [`StreamingXMLToolCallParser._preprocess_xml_chunk`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._preprocess_xml_chunk) | method | `StreamingXMLToolCallParser._preprocess_xml_chunk(chunk: str) -> str` | Preprocess XML chunk, handle non-standard formats, and escape special characters Args: chunk: Original XML chunk Returns: Processed XML chunk | [#L635-L748](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L635-L748) |
| [`StreamingXMLToolCallParser._emit_delta`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._emit_delta) | method | `StreamingXMLToolCallParser._emit_delta(delta: DeltaMessage) -> not annotated` | Emit Delta response (streaming output) | [#L750-L752](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L750-L752) |
| [`StreamingXMLToolCallParser._auto_close_open_parameter_if_needed`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._auto_close_open_parameter_if_needed) | method | `StreamingXMLToolCallParser._auto_close_open_parameter_if_needed(incoming_tag: Optional[str] = None) -> not annotated` | Before starting to process new elements, if there are unclosed tags from before, automatically complete their endings to the parser. | [#L754-L777](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L754-L777) |
| [`StreamingXMLToolCallParser._start_element`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._start_element) | method | `StreamingXMLToolCallParser._start_element(name: str, attrs: dict[str, str]) -> not annotated` | Handle XML start element events | [#L779-L888](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L779-L888) |
| [`StreamingXMLToolCallParser._flush_pending_implicit_delta`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._flush_pending_implicit_delta) | method | `StreamingXMLToolCallParser._flush_pending_implicit_delta() -> None` | Emit a deferred bare-<function=> delta now that the call is confirmed. | [#L890-L900](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L890-L900) |
| [`StreamingXMLToolCallParser._abandon_pending_implicit_tool_call`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._abandon_pending_implicit_tool_call) | method | `StreamingXMLToolCallParser._abandon_pending_implicit_tool_call() -> tuple[str, str]` | Roll back a deferred bare-<function=> auto-open: prose followed. | [#L902-L928](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L902-L928) |
| [`StreamingXMLToolCallParser._char_data`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._char_data) | method | `StreamingXMLToolCallParser._char_data(data: str) -> not annotated` | Handle XML character data events | [#L930-L1025](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L930-L1025) |
| [`StreamingXMLToolCallParser._end_element`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._end_element) | method | `StreamingXMLToolCallParser._end_element(name: str) -> not annotated` | Handle XML end element events | [#L1027-L1206](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1027-L1206) |
| [`StreamingXMLToolCallParser.setup_parser`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.setup_parser) | method | `StreamingXMLToolCallParser.setup_parser() -> not annotated` | Set up XML parser event handlers | [#L1208-L1213](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1208-L1213) |
| [`StreamingXMLToolCallParser.set_tools`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.set_tools) | method | `StreamingXMLToolCallParser.set_tools(tools: Union[list[ChatCompletionToolsParam], None]) -> not annotated` | Set tool configuration information | [#L1215-L1217](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1215-L1217) |
| [`StreamingXMLToolCallParser._get_next_call_id`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._get_next_call_id) | method | `StreamingXMLToolCallParser._get_next_call_id() -> not annotated` | Generate unique call ID | [#L1219-L1221](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1219-L1221) |
| [`StreamingXMLToolCallParser._extract_function_name`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._extract_function_name) | method | `StreamingXMLToolCallParser._extract_function_name(name: str, attrs: dict[str, str]) -> Optional[str]` | Extract function name from various formats | [#L1223-L1233](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1223-L1233) |
| [`StreamingXMLToolCallParser._extract_parameter_name`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._extract_parameter_name) | method | `StreamingXMLToolCallParser._extract_parameter_name(name: str, attrs: dict[str, str]) -> Optional[str]` | Extract parameter name from various formats | [#L1235-L1247](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1235-L1247) |
| [`StreamingXMLToolCallParser._get_param_type`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._get_param_type) | method | `StreamingXMLToolCallParser._get_param_type(param_name: str) -> str` | Get parameter type based on tool configuration, defaults to string Args: param_name: Parameter name Returns: Parameter type | [#L1249-L1287](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1249-L1287) |
| [`StreamingXMLToolCallParser.repair_param_type`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser.repair_param_type) | method | `StreamingXMLToolCallParser.repair_param_type(param_type: str) -> str` | Repair unknown parameter types by treating them as string Args: param_type: Parameter type Returns: Repaired parameter type | [#L1289-L1315](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1289-L1315) |
| [`StreamingXMLToolCallParser._convert_param_value`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._convert_param_value) | method | `StreamingXMLToolCallParser._convert_param_value(param_value: str, param_type: str) -> Any` | Convert value based on parameter type Args: param_value: Parameter value param_type: Parameter type Returns: Converted value | [#L1317-L1371](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1317-L1371) |
| [`StreamingXMLToolCallParser._convert_for_json_streaming`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._convert_for_json_streaming) | method | `StreamingXMLToolCallParser._convert_for_json_streaming(converted_value: Any, param_type: str) -> str` | Convert converted_value based on whether it's empty and if type is string Args: converted_value: Converted value param_type: Parameter type Returns: Converted string for streaming output | [#L1373-L1395](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1373-L1395) |
| [`StreamingXMLToolCallParser._reset_xml_parser_after_tool_call`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.StreamingXMLToolCallParser._reset_xml_parser_after_tool_call) | method | `StreamingXMLToolCallParser._reset_xml_parser_after_tool_call() -> not annotated` | Each tool_call is treated as a separate XML document, so we need to reset the parser after each tool_call. | [#L1397-L1427](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1397-L1427) |
| [`Qwen3XMLToolParser`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser) | class | `Qwen3XMLToolParser(tokenizer = None)` | XML tool call parser for Qwen 3.5 models, adapted for vllm-mlx. | [#L1442-L1559](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1442-L1559) |
| [`Qwen3XMLToolParser.__init__`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.__init__) | method | `Qwen3XMLToolParser.__init__(tokenizer = None) -> not annotated` | Method `Qwen3XMLToolParser.__init__` updates `self._xml_parser`; calls `super().__init__`, `super`, `StreamingXMLToolCallParser`, `logger.info`. | [#L1454-L1460](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1454-L1460) |
| [`Qwen3XMLToolParser._wrap_tools`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser._wrap_tools) | method | `Qwen3XMLToolParser._wrap_tools(request: dict[str, Any] \| None) -> list[_ToolDef] \| None` | Convert tool definition dicts to _ToolDef wrappers for attribute access. | [#L1463-L1467](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1463-L1467) |
| [`Qwen3XMLToolParser.extract_tool_calls`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.extract_tool_calls) | method | `Qwen3XMLToolParser.extract_tool_calls(model_output: str, request: dict[str, Any] \| None = None) -> ExtractedToolCallInformation` | Extract tool calls from complete Qwen 3.5 output. | [#L1469-L1507](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1469-L1507) |
| [`Qwen3XMLToolParser.extract_tool_calls_streaming`](#contract-vllm_mlx.tool_parsers.qwen3_xml_tool_parser.Qwen3XMLToolParser.extract_tool_calls_streaming) | method | `Qwen3XMLToolParser.extract_tool_calls_streaming(previous_text: str, current_text: str, delta_text: str, previous_token_ids: Sequence[int] \| None = None, current_token_ids: Sequence[int] \| None = None, delta_token_ids: Sequence[int] \| None = None, request: dict[str, Any] \| None = None) -> dict[str, Any] \| None` | Extract tool calls from streaming Qwen 3.5 output. | [#L1509-L1559](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/tool_parsers/qwen3_xml_tool_parser.py#L1509-L1559) |
