Skip to content

Commit 9b4756f

Browse files
authored
[CallToolArgs] Set agent id inside when tools need to call other agents (#22)
1 parent 511ece6 commit 9b4756f

4 files changed

Lines changed: 7 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jsonrpc-core = "18"
2121
warp = "0.3"
2222
jsonrpc-derive = "18"
2323
futures = "0.3"
24-
uuid = { version = "1", features = ["v4"] }
24+
uuid = { version = "1", features = ["v4", "v7", "serde"] }
2525
url = "2"
2626
base64 = "0.22"
2727
async-stream = "0.3"

bin/client.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use mcp_rs::{
66
transport::{sse::SseTransport, stdio::StdioTransport, ws::WebSocketTransport},
77
};
88
use serde_json::json;
9+
use uuid::Uuid;
910

1011
#[derive(Parser, Debug)]
1112
#[command(name = "mcp-client", version, about = "MCP Client CLI")]
@@ -255,6 +256,7 @@ async fn main() -> Result<(), McpError> {
255256
CallToolArgs::builder()
256257
.session_id(session_id)
257258
.tool_id(tool_id)
259+
.agent_id(Uuid::new_v4())
258260
.build(),
259261
),
260262
)

src/tools/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::{collections::HashMap, sync::Arc};
55
use test_tool::{PingTool, TestTool};
66
use tokio::sync::{mpsc, RwLock};
77
use typed_builder::TypedBuilder;
8+
use uuid::Uuid;
89

910
pub mod calculator;
1011
pub mod file_system;
@@ -117,6 +118,8 @@ pub struct CallToolArgs {
117118
#[serde(skip_serializing_if = "Option::is_none")]
118119
#[builder(default, setter(into))]
119120
pub session_id: Option<String>,
121+
122+
pub agent_id: Uuid,
120123
}
121124

122125
// Tool Provider trait

0 commit comments

Comments
 (0)