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
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use contextforge_data_plane_apis::user_store::{BackendMCPGateway, NameAlias, VirtualHost};
use rmcp::{ErrorData, model::ErrorCode, service::ServiceError};
use tracing::warn;
use tracing::{debug, warn};

fn resolve_route<'a, N: AsRef<str>>(
fn resolve_route<'a, N: AsRef<str> + std::fmt::Debug>(
virtual_host: &'a VirtualHost,
name: &'a str,
backend_names: &'a [N],
name_extractor: impl Fn(&'a str, &'a BackendMCPGateway) -> Option<&'a str>,
) -> Result<Option<(&'a str, &'a str)>, Box<dyn std::error::Error + Send + Sync>> {
debug!("resolve_route: vh {virtual_host:#?}, name {name}, backend_names {backend_names:?}");
let mut aliases = backend_names.iter().filter_map(|backend_name| {
let backend_name = backend_name.as_ref();
let backend = virtual_host.backends.get(backend_name)?;
Expand All @@ -23,7 +24,7 @@ fn resolve_route<'a, N: AsRef<str>>(

/// Resolves an exact control-plane alias to its backend and upstream name. Without an alias,
/// single-backend hosts preserve the upstream name and multi-backend hosts use the legacy prefix.
pub(crate) fn resolve_tool_route<'a, N: AsRef<str>>(
pub(crate) fn resolve_tool_route<'a, N: AsRef<str> + std::fmt::Debug>(
virtual_host: &'a VirtualHost,
name: &'a str,
backend_names: &'a [N],
Expand All @@ -36,7 +37,7 @@ pub(crate) fn resolve_tool_route<'a, N: AsRef<str>>(
})
}

pub(super) fn resolve_resources_route<'a, N: AsRef<str>>(
pub(super) fn resolve_resources_route<'a, N: AsRef<str> + std::fmt::Debug>(
virtual_host: &'a VirtualHost,
name: &'a str,
backend_names: &'a [N],
Expand All @@ -49,7 +50,7 @@ pub(super) fn resolve_resources_route<'a, N: AsRef<str>>(
})
}

pub(super) fn resolve_prompt_route<'a, N: AsRef<str>>(
pub(super) fn resolve_prompt_route<'a, N: AsRef<str> + std::fmt::Debug>(
virtual_host: &'a VirtualHost,
name: &'a str,
backend_names: &'a [N],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ mod initialization;
mod prompts;
mod resources;
mod tools;

use contextforge_data_plane_cpex::GatewayPluginRuntimeHandle;
use rmcp::{
ErrorData, RoleServer, ServerHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub(super) async fn get_prompt(
else {
return Err(ErrorData {
code: ErrorCode::INVALID_PARAMS,
message: "Routing problem... promtp not found".into(),
message: "Routing problem... prompt not found".into(),
data: None,
});
};
Expand Down
Loading