alexhancock/rmcp-tools-annotations (#3617)

This commit is contained in:
Alex Hancock
2025-07-24 14:58:14 -04:00
committed by GitHub
parent 7b2ca43c77
commit b4fc6f7cc8
65 changed files with 770 additions and 731 deletions
@@ -1,5 +1,5 @@
use mcp_core::{tool::ToolAnnotations, Tool, ToolError};
use rmcp::model::Content;
use mcp_core::ToolError;
use rmcp::model::{Content, Tool, ToolAnnotations};
use serde_json::Value;
use crate::agents::subagent_task_config::TaskConfig;
@@ -9,6 +9,7 @@ use crate::agents::{
subagent_execution_tool::tasks_manager::TasksManager, tool_execution::ToolCallResult,
};
use rmcp::model::JsonRpcMessage;
use rmcp::object;
use tokio::sync::mpsc;
use tokio_stream;
use tokio_util::sync::CancellationToken;
@@ -18,21 +19,21 @@ pub fn create_subagent_execute_task_tool() -> Tool {
Tool::new(
SUBAGENT_EXECUTE_TASK_TOOL_NAME,
"Only use the subagent__execute_task tool when you execute sub recipe task or dynamic task.
EXECUTION STRATEGY DECISION:
1. If the tasks are created with execution_mode, use the execution_mode.
2. Execute tasks sequentially unless user explicitly requests parallel execution. PARALLEL: User uses keywords like 'parallel', 'simultaneously', 'at the same time', 'concurrently'
EXECUTION STRATEGY DECISION:
1. If the tasks are created with execution_mode, use the execution_mode.
2. Execute tasks sequentially unless user explicitly requests parallel execution. PARALLEL: User uses keywords like 'parallel', 'simultaneously', 'at the same time', 'concurrently'
IMPLEMENTATION:
- Sequential execution: Call this tool multiple times, passing exactly ONE task per call
- Parallel execution: Call this tool once, passing an ARRAY of all tasks
IMPLEMENTATION:
- Sequential execution: Call this tool multiple times, passing exactly ONE task per call
- Parallel execution: Call this tool once, passing an ARRAY of all tasks
EXAMPLES:
User Intent Based:
- User: 'get weather and tell me a joke' → Sequential (2 separate tool calls, 1 task each)
- User: 'get weather and joke in parallel' → Parallel (1 tool call with array of 2 tasks)
- User: 'run these simultaneously' → Parallel (1 tool call with task array)
- User: 'do task A then task B' → Sequential (2 separate tool calls)",
serde_json::json!({
EXAMPLES:
User Intent Based:
- User: 'get weather and tell me a joke' → Sequential (2 separate tool calls, 1 task each)
- User: 'get weather and joke in parallel' → Parallel (1 tool call with array of 2 tasks)
- User: 'run these simultaneously' → Parallel (1 tool call with task array)
- User: 'do task A then task B' → Sequential (2 separate tool calls)",
object!({
"type": "object",
"properties": {
"execution_mode": {
@@ -50,15 +51,14 @@ User Intent Based:
}
},
"required": ["task_ids"]
}),
Some(ToolAnnotations {
title: Some("Run tasks in parallel".to_string()),
read_only_hint: false,
destructive_hint: true,
idempotent_hint: false,
open_world_hint: true,
}),
)
})
).annotate(ToolAnnotations {
title: Some("Run tasks in parallel".to_string()),
read_only_hint: Some(false),
destructive_hint: Some(true),
idempotent_hint: Some(false),
open_world_hint: Some(true),
})
}
pub async fn run_tasks(