feat: ToolError migration to ErrorData (#4051)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::agents::subagent::SubAgent;
|
||||
use crate::agents::subagent_task_config::TaskConfig;
|
||||
use anyhow::Result;
|
||||
use mcp_core::ToolError;
|
||||
use rmcp::model::{ErrorCode, ErrorData};
|
||||
|
||||
/// Standalone function to run a complete subagent task
|
||||
pub async fn run_complete_subagent_task(
|
||||
@@ -9,9 +9,13 @@ pub async fn run_complete_subagent_task(
|
||||
task_config: TaskConfig,
|
||||
) -> Result<String, anyhow::Error> {
|
||||
// Create the subagent with the parent agent's provider
|
||||
let subagent = SubAgent::new(task_config.clone())
|
||||
.await
|
||||
.map_err(|e| ToolError::ExecutionError(format!("Failed to create subagent: {}", e)))?;
|
||||
let subagent = SubAgent::new(task_config.clone()).await.map_err(|e| {
|
||||
ErrorData::new(
|
||||
ErrorCode::INTERNAL_ERROR,
|
||||
format!("Failed to create subagent: {}", e),
|
||||
None,
|
||||
)
|
||||
})?;
|
||||
|
||||
// Execute the subagent task
|
||||
let messages = subagent
|
||||
|
||||
Reference in New Issue
Block a user