Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions crates/goose-cli/src/scenario_tests/mock_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
//! add a tool you want to have around and then add the client to the extension router

use mcp_client::client::{Error, McpClientTrait};
use mcp_core::ToolError;
use rmcp::{
model::{
CallToolResult, Content, GetPromptResult, ListPromptsResult, ListResourcesResult,
ListToolsResult, ReadResourceResult, ServerNotification, Tool,
CallToolResult, Content, ErrorData, GetPromptResult, ListPromptsResult,
ListResourcesResult, ListToolsResult, ReadResourceResult, ServerNotification, Tool,
},
object,
};
Expand All @@ -17,7 +16,7 @@ use tokio_util::sync::CancellationToken;

pub struct MockClient {
tools: HashMap<String, Tool>,
handlers: HashMap<String, Box<dyn Fn(&Value) -> Result<Vec<Content>, ToolError> + Send + Sync>>,
handlers: HashMap<String, Box<dyn Fn(&Value) -> Result<Vec<Content>, ErrorData> + Send + Sync>>,
}

impl MockClient {
Expand All @@ -30,7 +29,7 @@ impl MockClient {

pub(crate) fn add_tool<F>(mut self, tool: Tool, handler: F) -> Self
where
F: Fn(&Value) -> Result<Vec<Content>, ToolError> + Send + Sync + 'static,
F: Fn(&Value) -> Result<Vec<Content>, ErrorData> + Send + Sync + 'static,
{
let tool_name = tool.name.to_string();
self.tools.insert(tool_name.clone(), tool);
Expand Down
10 changes: 7 additions & 3 deletions crates/goose-cli/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ use goose::config::Config;
use goose::providers::pricing::initialize_pricing_cache;
use goose::session;
use input::InputResult;
use mcp_core::handler::ToolError;
use rmcp::model::PromptMessage;
use rmcp::model::ServerNotification;
use rmcp::model::{ErrorCode, ErrorData};

use goose::conversation::message::{Message, MessageContent};
use rand::{distributions::Alphanumeric, Rng};
Expand Down Expand Up @@ -927,7 +927,7 @@ impl Session {
let mut response_message = Message::user();
response_message.content.push(MessageContent::tool_response(
confirmation.id.clone(),
Err(ToolError::ExecutionError("Tool call cancelled by user".to_string()))
Err(ErrorData { code: ErrorCode::INVALID_REQUEST, message: std::borrow::Cow::from("Tool call cancelled by user".to_string()), data: None })
));
self.messages.push(response_message);
if let Some(session_file) = &self.session_file {
Expand Down Expand Up @@ -1294,7 +1294,11 @@ impl Session {
for (req_id, _) in &tool_requests {
response_message.content.push(MessageContent::tool_response(
req_id.clone(),
Err(ToolError::ExecutionError(notification.clone())),
Err(ErrorData {
code: ErrorCode::INTERNAL_ERROR,
message: std::borrow::Cow::from(notification.clone()),
data: None,
}),
));
}
self.push_message(response_message);
Expand Down
206 changes: 129 additions & 77 deletions crates/goose-mcp/src/computercontroller/docx_tool.rs

Large diffs are not rendered by default.

Loading
Loading