feat: add tool annotations for build-in tools (#1939)

This commit is contained in:
Yingjie He
2025-03-31 16:46:55 -07:00
committed by GitHub
parent f184449f81
commit 680523297b
23 changed files with 369 additions and 9 deletions

View File

@@ -17,13 +17,16 @@ use tokio::process::Command;
use url::Url;
use include_dir::{include_dir, Dir};
use mcp_core::prompt::{Prompt, PromptArgument, PromptTemplate};
use mcp_core::{
handler::{PromptError, ResourceError, ToolError},
protocol::ServerCapabilities,
resource::Resource,
tool::Tool,
};
use mcp_core::{
prompt::{Prompt, PromptArgument, PromptTemplate},
tool::ToolAnnotations,
};
use mcp_server::router::CapabilitiesBuilder;
use mcp_server::Router;
@@ -161,6 +164,7 @@ impl DeveloperRouter {
"command": {"type": "string"}
}
}),
None,
);
let text_editor_tool = Tool::new(
@@ -199,6 +203,7 @@ impl DeveloperRouter {
"file_text": {"type": "string"}
}
}),
None,
);
let list_windows_tool = Tool::new(
@@ -213,6 +218,13 @@ impl DeveloperRouter {
"required": [],
"properties": {}
}),
Some(ToolAnnotations {
title: Some("List available windows".to_string()),
read_only_hint: true,
destructive_hint: false,
idempotent_hint: false,
open_world_hint: false,
}),
);
let screen_capture_tool = Tool::new(
@@ -241,6 +253,13 @@ impl DeveloperRouter {
}
}
}),
Some(ToolAnnotations {
title: Some("Capture a full screen".to_string()),
read_only_hint: true,
destructive_hint: false,
idempotent_hint: false,
open_world_hint: false,
}),
);
let image_processor_tool = Tool::new(
@@ -263,6 +282,13 @@ impl DeveloperRouter {
}
}
}),
Some(ToolAnnotations {
title: Some("Process Image".to_string()),
read_only_hint: true,
destructive_hint: false,
idempotent_hint: true,
open_world_hint: false,
}),
);
// Get base instructions and working directory