Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ use serde_json::Value;
#[async_trait]
pub trait ToolProvider: Send + Sync {
// Return tool definition
async fn get_tool(&self) -> Tool;
fn get_tool(&self) -> Tool;

// Execute tool with given arguments
async fn execute(&self, arguments: Value) -> Result<ToolResult, McpError>;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/calculator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl CalculatorTool {

#[async_trait]
impl ToolProvider for CalculatorTool {
async fn get_tool(&self) -> Tool {
fn get_tool(&self) -> Tool {
let mut schema_properties = HashMap::new();
schema_properties.insert(
"operation".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/tools/file_system/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl DirectoryTool {

#[async_trait]
impl ToolProvider for DirectoryTool {
async fn get_tool(&self) -> Tool {
fn get_tool(&self) -> Tool {
let mut schema_properties = HashMap::new();
schema_properties.insert(
"operation".to_string(),
Expand Down
10 changes: 5 additions & 5 deletions src/tools/file_system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ impl FileSystemTools {

#[async_trait]
impl ToolProvider for FileSystemTools {
async fn get_tool(&self) -> Tool {
fn get_tool(&self) -> Tool {
// Return composite tool definition containing all file system operations
let mut tools = vec![
self.read_tool.get_tool().await,
self.write_tool.get_tool().await,
self.directory_tool.get_tool().await,
self.search_tool.get_tool().await,
self.read_tool.get_tool(),
self.write_tool.get_tool(),
self.directory_tool.get_tool(),
self.search_tool.get_tool(),
];

// Return the first tool as the main tool definition
Expand Down
2 changes: 1 addition & 1 deletion src/tools/file_system/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl ReadFileTool {

#[async_trait]
impl ToolProvider for ReadFileTool {
async fn get_tool(&self) -> Tool {
fn get_tool(&self) -> Tool {
let mut schema_properties = HashMap::new();
schema_properties.insert(
"operation".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/tools/file_system/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl SearchTool {

#[async_trait]
impl ToolProvider for SearchTool {
async fn get_tool(&self) -> Tool {
fn get_tool(&self) -> Tool {
let mut schema_properties = HashMap::new();
schema_properties.insert(
"operation".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/tools/file_system/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl WriteFileTool {

#[async_trait]
impl ToolProvider for WriteFileTool {
async fn get_tool(&self) -> Tool {
fn get_tool(&self) -> Tool {
let mut schema_properties = HashMap::new();
schema_properties.insert(
"operation".to_string(),
Expand Down
8 changes: 4 additions & 4 deletions src/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub struct CallToolArgs {
#[async_trait]
pub trait ToolProvider: Send + Sync {
/// Get tool definition
async fn get_tool(&self) -> Tool;
fn get_tool(&self) -> Tool;

/// Execute tool
async fn execute(
Expand Down Expand Up @@ -183,7 +183,7 @@ impl ToolManager {
}

pub async fn register_tool(&self, provider: Arc<dyn ToolProvider>) {
let tool = provider.get_tool().await;
let tool = provider.get_tool();
let mut tools = self.tools.write().await;
tools.insert(tool.name.clone(), provider);

Expand Down Expand Up @@ -220,7 +220,7 @@ impl ToolManager {
}

pub async fn update_tool(&self, provider: Arc<dyn ToolProvider>) -> Result<(), McpError> {
let tool = provider.get_tool().await;
let tool = provider.get_tool();
let mut tools = self.tools.write().await;

if tools.contains_key(&tool.name) {
Expand Down Expand Up @@ -274,7 +274,7 @@ impl ToolManager {
let mut tool_list = Vec::new();

for provider in tools.values() {
tool_list.push(provider.get_tool().await);
tool_list.push(provider.get_tool());
}

Ok(ListToolsResponse {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/test_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl TestTool {

#[async_trait]
impl ToolProvider for TestTool {
async fn get_tool(&self) -> Tool {
fn get_tool(&self) -> Tool {
Tool {
name: "test_tool".to_string(),
description: "Test Tool".to_string(),
Expand Down Expand Up @@ -70,7 +70,7 @@ impl PingTool {

#[async_trait]
impl ToolProvider for PingTool {
async fn get_tool(&self) -> Tool {
fn get_tool(&self) -> Tool {
Tool {
name: "ping_tool".to_string(),
description: "Ping Tool".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion tests/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct MockCalculatorTool;

#[async_trait]
impl ToolProvider for MockCalculatorTool {
async fn get_tool(&self) -> Tool {
fn get_tool(&self) -> Tool {
let mut properties = HashMap::new();
properties.insert(
"operation".to_string(),
Expand Down
Loading