mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-17 22:24:21 +01:00
feat: add tool annotations for build-in tools (#1939)
This commit is contained in:
@@ -2,6 +2,7 @@ use anyhow::Result;
|
||||
use mcp_core::content::Content;
|
||||
use mcp_core::handler::{PromptError, ResourceError};
|
||||
use mcp_core::prompt::{Prompt, PromptArgument};
|
||||
use mcp_core::tool::ToolAnnotations;
|
||||
use mcp_core::{handler::ToolError, protocol::ServerCapabilities, resource::Resource, tool::Tool};
|
||||
use mcp_server::router::{CapabilitiesBuilder, RouterService};
|
||||
use mcp_server::{ByteTransport, Router, Server};
|
||||
@@ -76,6 +77,13 @@ impl Router for CounterRouter {
|
||||
"properties": {},
|
||||
"required": []
|
||||
}),
|
||||
Some(ToolAnnotations {
|
||||
title: Some("Increment Tool".to_string()),
|
||||
read_only_hint: false,
|
||||
destructive_hint: false,
|
||||
idempotent_hint: false,
|
||||
open_world_hint: false,
|
||||
}),
|
||||
),
|
||||
Tool::new(
|
||||
"decrement".to_string(),
|
||||
@@ -85,6 +93,13 @@ impl Router for CounterRouter {
|
||||
"properties": {},
|
||||
"required": []
|
||||
}),
|
||||
Some(ToolAnnotations {
|
||||
title: Some("Decrement Tool".to_string()),
|
||||
read_only_hint: false,
|
||||
destructive_hint: false,
|
||||
idempotent_hint: false,
|
||||
open_world_hint: false,
|
||||
}),
|
||||
),
|
||||
Tool::new(
|
||||
"get_value".to_string(),
|
||||
@@ -94,6 +109,13 @@ impl Router for CounterRouter {
|
||||
"properties": {},
|
||||
"required": []
|
||||
}),
|
||||
Some(ToolAnnotations {
|
||||
title: Some("Get Value Tool".to_string()),
|
||||
read_only_hint: true,
|
||||
destructive_hint: false,
|
||||
idempotent_hint: false,
|
||||
open_world_hint: false,
|
||||
}),
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ pub trait Router: Send + Sync + 'static {
|
||||
) -> impl Future<Output = Result<JsonRpcResponse, RouterError>> + Send {
|
||||
async move {
|
||||
let result = InitializeResult {
|
||||
protocol_version: "2024-11-05".to_string(),
|
||||
protocol_version: "2025-03-26".to_string(),
|
||||
capabilities: self.capabilities().clone(),
|
||||
server_info: Implementation {
|
||||
name: self.name(),
|
||||
|
||||
Reference in New Issue
Block a user