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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*#![allow(dead_code)]
use rmcp::{handler::server::{
wrapper::Parameters,
}, schemars, tool, tool_router, ErrorData};
use rmcp::model::CallToolResult;
use rmcp::schemars::JsonSchema;
use serde::Deserialize;
use crate::controller::StoreType;
use crate::service::scratchpad_service::Scratchpad;
use crate::tool::McpTool;
#[derive(Debug, Deserialize, JsonSchema)]
struct CreatePrivateScratchpadRequest {
#[schemars(description = "Name of the private scratchpad")]
name: String,
#[schemars(description = "Base64 encoded content of the scratchpad")]
content: String,
#[schemars(description = "Store scratchpad on memory, disk or network")]
store_type: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
struct UpdatePrivateScratchpadRequest {
#[schemars(description = "Address of the private scratchpad")]
address: String,
#[schemars(description = "Name of the private scratchpad")]
name: String,
#[schemars(description = "Base64 encoded content of the scratchpad")]
content: String,
#[schemars(description = "Store scratchpad on memory, disk or network")]
store_type: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
struct GetPrivateScratchpadRequest {
#[schemars(description = "Address of the private scratchpad")]
address: String,
#[schemars(description = "Name of the private scratchpad")]
name: String,
}
#[tool_router(router = private_scratchpad_tool_router, vis = "pub")]
impl McpTool {
#[tool(description = "Create a new private scratchpad")]
async fn create_private_scratchpad(
&self,
Parameters(CreatePrivateScratchpadRequest { name, content, store_type }): Parameters<CreatePrivateScratchpadRequest>,
) -> Result<CallToolResult, ErrorData> {
let scratchpad = Scratchpad::new(Some(name), None, None, None, Some(content), None);
Ok(self.scratchpad_service.create_scratchpad(
scratchpad,
self.evm_wallet.get_ref().clone(),
true,
StoreType::from(store_type)
).await?.into())
}
#[tool(description = "Update an existing private scratchpad")]
async fn update_private_scratchpad(
&self,
Parameters(UpdatePrivateScratchpadRequest { address, name, content, store_type }): Parameters<UpdatePrivateScratchpadRequest>,
) -> Result<CallToolResult, ErrorData> {
let scratchpad = Scratchpad::new(None, None, None, None, Some(content), None);
Ok(self.scratchpad_service.update_scratchpad(
address,
name,
scratchpad,
self.evm_wallet.get_ref().clone(),
true,
StoreType::from(store_type)
).await?.into())
}
#[tool(description = "Get a private scratchpad by its address and name")]
async fn get_private_scratchpad(
&self,
Parameters(GetPrivateScratchpadRequest { address, name }): Parameters<GetPrivateScratchpadRequest>,
) -> Result<CallToolResult, ErrorData> {
Ok(self.scratchpad_service.get_scratchpad(address, Some(name), true).await?.into())
}
}
*/