Download crates/forge_services/src/mcp/tool.rs from SaylorTwift/forgecode: direct link, hf CLI and curl.
- Browser
- Download file 520 Bytes
-
https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_services/src/mcp/tool.rs
- Command line
-
hf download hf://SaylorTwift/forgecode/crates/forge_services/src/mcp/tool.rs
-
curl -L -o tool.rs https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_services/src/mcp/tool.rs
520 Bytes
| use std::sync::Arc; | |
| use forge_app::McpClientInfra; | |
| use forge_app::domain::{ToolName, ToolOutput}; | |
| pub struct McpExecutor<T> { | |
| pub client: Arc<T>, | |
| pub tool_name: ToolName, | |
| } | |
| impl<T: McpClientInfra> McpExecutor<T> { | |
| pub fn new(tool_name: ToolName, client: Arc<T>) -> anyhow::Result<Self> { | |
| Ok(Self { client, tool_name }) | |
| } | |
| pub async fn call_tool(&self, input: serde_json::Value) -> anyhow::Result<ToolOutput> { | |
| self.client.call(&self.tool_name, input).await | |
| } | |
| } | |