1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Tool wrapper for executing multiple tool calls in parallel.
//!
//! NOTE: this meta-tool is intentionally no longer registered with the
//! agent (see `ToolRegistryBuilder::with_parallel_tool`). DeepSeek-V4
//! supports native parallel `tool_calls` in a single assistant turn, and
//! advertising the OpenAI-internal name `multi_tool_use.parallel` made
//! the model hallucinate ChatGPT-style XML wrappers. The struct stays
//! around so the engine compatibility dispatcher and historical sessions
//! still resolve it cleanly.
use super::spec::{
ApprovalRequirement, ToolCapability, ToolContext, ToolError, ToolResult, ToolSpec,
};
use async_trait::async_trait;
use serde_json::{Value, json};
#[allow(dead_code)]
pub struct MultiToolUseParallelTool;
#[async_trait]
impl ToolSpec for MultiToolUseParallelTool {
fn name(&self) -> &'static str {
"multi_tool_use.parallel"
}
fn description(&self) -> &'static str {
"Execute multiple tool calls in parallel and return their results."
}
fn input_schema(&self) -> Value {
json!({
"type": "object",
"properties": {
"tool_uses": {
"type": "array",
"items": {
"type": "object",
"properties": {
"recipient_name": { "type": "string" },
"parameters": { "type": "object" }
},
"required": ["recipient_name", "parameters"]
}
}
},
"required": ["tool_uses"]
})
}
fn capabilities(&self) -> Vec<ToolCapability> {
vec![ToolCapability::ReadOnly]
}
fn approval_requirement(&self) -> ApprovalRequirement {
ApprovalRequirement::Auto
}
async fn execute(
&self,
_input: Value,
_context: &ToolContext,
) -> Result<ToolResult, ToolError> {
Err(ToolError::execution_failed(
"multi_tool_use.parallel must be handled by the engine",
))
}
}