rust_mcp_sdk/
utils.rs

1/// Formats an assertion error message for unsupported capabilities.
2///
3/// Constructs a string describing that a specific entity (e.g., server or client) lacks
4/// support for a required capability, needed for a particular method.
5///
6/// # Arguments
7/// - `entity`: The name of the entity (e.g., "Server" or "Client") that lacks support.
8/// - `capability`: The name of the unsupported capability or tool.
9/// - `method_name`: The name of the method requiring the capability.
10///
11/// # Returns
12/// A formatted string detailing the unsupported capability error.
13///
14/// # Examples
15/// ```ignore
16/// let msg = format_assertion_message("Server", "tools", rust_mcp_schema::ListResourcesRequest::method_name());
17/// assert_eq!(msg, "Server does not support resources (required for resources/list)");
18/// ```
19pub fn format_assertion_message(entity: &str, capability: &str, method_name: &str) -> String {
20    format!(
21        "{} does not support {} (required for {})",
22        entity, capability, method_name
23    )
24}