Revert "Internal MCP Crate Cleanup (#4800)" (#4883)

This commit is contained in:
Alex Hancock
2025-09-29 14:21:30 -04:00
committed by GitHub
parent 2cfef016e2
commit b9ba8dca29
78 changed files with 1090 additions and 844 deletions
+13 -14
View File
@@ -1,7 +1,8 @@
use crate::agents::tool_execution::ToolCallResult;
use crate::recipe::Response;
use indoc::formatdoc;
use rmcp::model::{CallToolRequestParam, Content, ErrorCode, ErrorData, Tool, ToolAnnotations};
use mcp_core::ToolCall;
use rmcp::model::{Content, ErrorCode, ErrorData, Tool, ToolAnnotations};
use serde_json::Value;
use std::borrow::Cow;
@@ -116,10 +117,10 @@ impl FinalOutputTool {
}
}
pub async fn execute_tool_call(&mut self, tool_call: CallToolRequestParam) -> ToolCallResult {
match tool_call.name.to_string().as_str() {
pub async fn execute_tool_call(&mut self, tool_call: ToolCall) -> ToolCallResult {
match tool_call.name.as_str() {
FINAL_OUTPUT_TOOL_NAME => {
let result = self.validate_json_output(&tool_call.arguments.into()).await;
let result = self.validate_json_output(&tool_call.arguments).await;
match result {
Ok(parsed_value) => {
self.final_output = Some(Self::parsed_final_output_string(parsed_value));
@@ -152,8 +153,6 @@ impl FinalOutputTool {
mod tests {
use super::*;
use crate::recipe::Response;
use rmcp::model::CallToolRequestParam;
use rmcp::object;
use serde_json::json;
fn create_complex_test_schema() -> Value {
@@ -227,11 +226,11 @@ mod tests {
};
let mut tool = FinalOutputTool::new(response);
let tool_call = CallToolRequestParam {
name: FINAL_OUTPUT_TOOL_NAME.into(),
arguments: Some(object!({
let tool_call = ToolCall {
name: FINAL_OUTPUT_TOOL_NAME.to_string(),
arguments: json!({
"message": "Hello" // Missing required "count" field
})),
}),
};
let result = tool.execute_tool_call(tool_call).await;
@@ -249,15 +248,15 @@ mod tests {
};
let mut tool = FinalOutputTool::new(response);
let tool_call = CallToolRequestParam {
name: FINAL_OUTPUT_TOOL_NAME.into(),
arguments: Some(object!({
let tool_call = ToolCall {
name: FINAL_OUTPUT_TOOL_NAME.to_string(),
arguments: json!({
"user": {
"name": "John",
"age": 30
},
"tags": ["developer", "rust"]
})),
}),
};
let result = tool.execute_tool_call(tool_call).await;