From 33fccff0e3367acd5677aae0a533f3864ad67eef Mon Sep 17 00:00:00 2001 From: cafalchio Date: Thu, 23 Jul 2026 10:44:52 +0100 Subject: [PATCH 1/3] Fixed tool codes Signed-off-by: cafalchio --- .../src/gateway/identifier_routing.rs | 21 +++++++++++-------- .../src/gateway/mcp_service/tools.rs | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/crates/contextforge-gateway-rs-lib/src/gateway/identifier_routing.rs b/crates/contextforge-gateway-rs-lib/src/gateway/identifier_routing.rs index ff36274..647e079 100644 --- a/crates/contextforge-gateway-rs-lib/src/gateway/identifier_routing.rs +++ b/crates/contextforge-gateway-rs-lib/src/gateway/identifier_routing.rs @@ -1,5 +1,5 @@ use contextforge_gateway_rs_apis::user_store::VirtualHost; -use rmcp::{ErrorData, model::ErrorCode}; +use rmcp::{ErrorData, model::ErrorCode, service::ServiceError}; use tracing::{debug, warn}; use super::{ @@ -65,13 +65,16 @@ pub(super) fn exposed_tool_name(virtual_host: &VirtualHost, backend_name: &str, }) } -/// Logs a backend forwarding failure and maps it to the routing error every handler returns. -pub(super) fn backend_forward_error(op: &str, backend_name: &str, error: &impl std::fmt::Debug) -> ErrorData { - warn!("{op}: backend {backend_name} {error:?}"); - ErrorData { - code: ErrorCode::INTERNAL_ERROR, - message: "Routing problem... got no responses from backends".into(), - data: None, +pub(super) fn backend_forward_error(op: &str, backend_name: &str, error: &ServiceError) -> ErrorData { + warn!("{op}: backend {backend_name} error = {error:?}"); + + match error { + ServiceError::McpError(mcp_error) => mcp_error.to_owned(), + _ => ErrorData { + code: ErrorCode::INTERNAL_ERROR, + message: "Routing problem... got no responses from backends".into(), + data: None, + }, } } @@ -85,7 +88,7 @@ pub(super) async fn route_identifier_to_backend( ) -> Result<(String, McpClientService, String), ErrorData> { let backend_names = session_manager.get_backend_names(); let Some((backend_name, routed_identifier)) = route_identifier(identifier, &backend_names) else { - return Err(ErrorData { code: ErrorCode::INTERNAL_ERROR, message: no_route_message.into(), data: None }); + return Err(ErrorData { code: ErrorCode::INVALID_PARAMS, message: no_route_message.into(), data: None }); }; let routed_identifier = routed_identifier.to_owned(); let (backend_name, service) = resolve_backend(session_manager, op, backend_name).await?; diff --git a/crates/contextforge-gateway-rs-lib/src/gateway/mcp_service/tools.rs b/crates/contextforge-gateway-rs-lib/src/gateway/mcp_service/tools.rs index 05b2e38..50715b0 100644 --- a/crates/contextforge-gateway-rs-lib/src/gateway/mcp_service/tools.rs +++ b/crates/contextforge-gateway-rs-lib/src/gateway/mcp_service/tools.rs @@ -59,8 +59,8 @@ where let Some((backend_name, tool_name)) = resolve_tool_route(virtual_host, &request.name, &backend_names) else { return Err(ErrorData { - code: ErrorCode::INTERNAL_ERROR, - message: "Routing problem... wrong tool name".into(), + code: ErrorCode::INVALID_PARAMS, + message: "Routing problem... tool not found".into(), data: None, }); }; From 21dad44141dfe9239c101d961e86ae22bf927055 Mon Sep 17 00:00:00 2001 From: cafalchio Date: Thu, 23 Jul 2026 10:45:05 +0100 Subject: [PATCH 2/3] Fixed prompt codes Signed-off-by: cafalchio --- .../src/gateway/mcp_service/prompts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/contextforge-gateway-rs-lib/src/gateway/mcp_service/prompts.rs b/crates/contextforge-gateway-rs-lib/src/gateway/mcp_service/prompts.rs index 2e620d9..3139d11 100644 --- a/crates/contextforge-gateway-rs-lib/src/gateway/mcp_service/prompts.rs +++ b/crates/contextforge-gateway-rs-lib/src/gateway/mcp_service/prompts.rs @@ -59,7 +59,7 @@ where &session_manager, "get_prompt", &request.name, - "Routing problem... wrong prompt name", + "Routing problem... invalid prompt name", ) .await?; From 1bd59f8aafa96a73221ee0cf3418758d717c8b09 Mon Sep 17 00:00:00 2001 From: cafalchio Date: Thu, 23 Jul 2026 11:20:45 +0100 Subject: [PATCH 3/3] Added exception for deny Signed-off-by: cafalchio --- deny.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deny.toml b/deny.toml index 893d9a0..5fb0f97 100644 --- a/deny.toml +++ b/deny.toml @@ -1,6 +1,7 @@ [advisories] ignore = [ - {id="RUSTSEC-2023-0071" , reason = "1. For time being not in production. 2. Workaround would be to force customers to use EC keys instead of RSA" } + {id="RUSTSEC-2023-0071" , reason = "1. For time being not in production. 2. Workaround would be to force customers to use EC keys instead of RSA" }, + {id="RUSTSEC-2026-0214" , reason = "1. gumdrop is used by goose which is a dev tool only" } ] [[licenses.exceptions]]