Skip to content

Commit 5272bc6

Browse files
Drop redundant with_tools(declaration-only) calls in multi_client tests
The with_tool_handlers/with_tools merge means a single call now both declares the tool and attaches the handler. The leftover second with_tools([tool_definition]) call was overwriting the handler-bearing tools list with declaration-only stubs, causing tool dispatch to break and tests to time out. Also conditionally import Tool in tool.rs (only used with derive/test features) to silence unused-import lint under --features test-support. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 75f0738 commit 5272bc6

2 files changed

Lines changed: 1 addition & 6 deletions

File tree

rust/src/tool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ use async_trait::async_trait;
2121
pub use schemars::JsonSchema;
2222

2323
use crate::Error;
24-
use crate::types::{ToolBinaryResult, ToolInvocation, ToolResult, ToolResultExpanded};
2524
#[cfg(any(feature = "derive", test))]
2625
use crate::types::Tool;
26+
use crate::types::{ToolBinaryResult, ToolInvocation, ToolResult, ToolResultExpanded};
2727

2828
/// Generate a JSON Schema [`Value`](serde_json::Value) from a Rust type.
2929
///

rust/tests/e2e/multi_client.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ async fn both_clients_see_tool_request_and_completion_events() {
4141
"MAGIC_",
4242
"_42",
4343
)]))
44-
.with_tools([EchoTool::tool_definition("magic_number", "seed")])
4544
.with_available_tools(["magic_number"]),
4645
)
4746
.await
@@ -293,7 +292,6 @@ async fn two_clients_register_different_tools_and_agent_uses_both() {
293292
"CITY_FOR_",
294293
"",
295294
)]))
296-
.with_tools([EchoTool::tool_definition("city_lookup", "countryCode")])
297295
.with_available_tools(["city_lookup", "currency_lookup"]),
298296
)
299297
.await
@@ -308,7 +306,6 @@ async fn two_clients_register_different_tools_and_agent_uses_both() {
308306
"CURRENCY_FOR_",
309307
"",
310308
)]))
311-
.with_tools([EchoTool::tool_definition("currency_lookup", "countryCode")])
312309
.with_available_tools(["city_lookup", "currency_lookup"]),
313310
)
314311
.await
@@ -361,7 +358,6 @@ async fn disconnecting_client_removes_its_tools() {
361358
"STABLE_",
362359
"",
363360
)]))
364-
.with_tools([EchoTool::tool_definition("stable_tool", "input")])
365361
.with_available_tools(["stable_tool", "ephemeral_tool"]),
366362
)
367363
.await
@@ -376,7 +372,6 @@ async fn disconnecting_client_removes_its_tools() {
376372
"EPHEMERAL_",
377373
"",
378374
)]))
379-
.with_tools([EchoTool::tool_definition("ephemeral_tool", "input")])
380375
.with_available_tools(["stable_tool", "ephemeral_tool"]),
381376
)
382377
.await

0 commit comments

Comments
 (0)