Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
fix(mcp): log refused tool calls and keep the error's own text (#9681)
Akarshan Biswas6d96e88a89fd
diff --git a/src-tauri/src/core/mcp/commands.rs b/src-tauri/src/core/mcp/commands.rsindex 507798a7a..1fd73806d 100644--- a/src-tauri/src/core/mcp/commands.rs+++ b/src-tauri/src/core/mcp/commands.rs@@ -459,10 +459,15 @@ pub async fn call_tool(let (srv_name, service) = match target {Ok(target) => target,Err(CallTargetError::Refused(e)) => {+ log::warn!("MCP call to tool {tool_name} refused: {e}");cleanup_cancellation_token(&state, &cancellation_token).await;return Err(e);}Err(CallTargetError::Disconnected(names)) => {+ log::warn!(+ "MCP call to tool {tool_name} not run: server(s) [{}] disconnected",+ names.join(", ")+ );state.mcp_reconnect_notify.notify_waiters();cleanup_cancellation_token(&state, &cancellation_token).await;return Err(format!(@@ -482,6 +487,7 @@ pub async fn call_tool(Some(srv_name),tauri_plugin_agent_tools::consent::ToolOrigin::Mcp,) {+ log::warn!("MCP call to tool {tool_name} on {srv_name} not approved: {e}");cleanup_cancellation_token(&state, &cancellation_token).await;return Err(e);}diff --git a/web-app/src/routes/threads/$threadId.tsx b/web-app/src/routes/threads/$threadId.tsxindex d975229e1..5bd61b296 100644--- a/web-app/src/routes/threads/$threadId.tsx+++ b/web-app/src/routes/threads/$threadId.tsx@@ -143,6 +143,7 @@ import {getLocalPropsExtension,readCtxLen,} from '@/lib/llamacppRouterProps'+import { normalizeAppError } from '@/utils/appError'const CHAT_STATUS = {STREAMING: 'streaming',@@ -1230,7 +1231,7 @@ function ThreadDetail() {state: 'output-error',tool: toolCall.toolName,toolCallId: toolCall.toolCallId,- errorText: `Error: ${JSON.stringify(error)}`,+ errorText: `Error: ${normalizeAppError(error)}`,})}} finally {