refactor: drop Manage prefix from consolidated smart MCP tools
This commit is contained in:
1 parent
e45db33297
commit
961abb01e7
8 files changed
+914
-100
No files matched your search
@@ -218,6 +218,48 @@ impl McpTool for ToggleClipboardWatchModeHandler {
|
||||
}
|
||||
}
|
||||
|
||||
use crate::tools::{ClipboardAction, ClipboardTool};
|
||||
|
||||
pub struct ClipboardHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl McpTool for ClipboardHandler {
|
||||
fn name(&self) -> &'static str {
|
||||
"clipboard"
|
||||
}
|
||||
|
||||
fn schema(&self) -> Value {
|
||||
crate::mcp::tool_def::<ClipboardTool>(
|
||||
"clipboard",
|
||||
"Consolidated OS clipboard management (read, write, toggle_watch)",
|
||||
)
|
||||
}
|
||||
|
||||
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> crate::error::Result<String> {
|
||||
let req: ClipboardTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||
match req.action {
|
||||
ClipboardAction::Read => {
|
||||
ReadClipboardHandler.execute(serde_json::json!({}), state).await
|
||||
}
|
||||
ClipboardAction::Write => {
|
||||
WriteClipboardHandler.execute(
|
||||
serde_json::json!({
|
||||
"text": req.text,
|
||||
"html": req.html,
|
||||
"files": req.files,
|
||||
"image_path": req.image_path
|
||||
}),
|
||||
state,
|
||||
).await
|
||||
}
|
||||
ClipboardAction::ToggleWatch => {
|
||||
let enable = req.enabled.unwrap_or(true);
|
||||
ToggleClipboardWatchModeHandler.execute(serde_json::json!({"enable": enable}), state).await
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in new issue
Block a user