pub struct ClientFilters { /* private fields */ }Expand description
Per-client filter combining tool-visibility (name-level) and tool-callability (argument-level) rules. Driven by request headers (HTTP/WS) or environment variables (stdio).
Implementations§
Source§impl ClientFilters
impl ClientFilters
Sourcepub fn from_strings(
visibility_allow: Option<&str>,
visibility_deny: Option<&str>,
callable_allow_json: Option<&str>,
callable_deny_json: Option<&str>,
) -> Self
pub fn from_strings( visibility_allow: Option<&str>, visibility_deny: Option<&str>, callable_allow_json: Option<&str>, callable_deny_json: Option<&str>, ) -> Self
Build from raw strings. Callability inputs are JSON; malformed JSON is treated as no constraints (logged at WARN) — bricking a request on bad filter config would be a footgun for ops.
Sourcepub fn tool_visible(&self, name: &str) -> bool
pub fn tool_visible(&self, name: &str) -> bool
true if the tool name is visible to this client.
A false return means a tools/call against this name produces an
MCP Protocol Error (-32602, “Unknown tool: …”) and the tool is
omitted from tools/list / resources/list. Deny wins; an empty
allow list means “visible unless explicitly denied”.
Sourcepub fn tool_callable(
&self,
tool_name: &str,
arguments: &Value,
) -> Result<(), String>
pub fn tool_callable( &self, tool_name: &str, arguments: &Value, ) -> Result<(), String>
Check whether a tools/call is callable for this client given its
JSON arguments.
Ok(()) if no callability constraints apply or every constraint
passes. Err(message) surfaces as an MCP Tool Execution Error
(isError: true content with the message), the spec’s
“Invalid input data” category.
Visibility is not re-checked here; callers run
tool_visible first.
Trait Implementations§
Source§impl Clone for ClientFilters
impl Clone for ClientFilters
Source§fn clone(&self) -> ClientFilters
fn clone(&self) -> ClientFilters
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientFilters
impl Debug for ClientFilters
Source§impl Default for ClientFilters
impl Default for ClientFilters
Source§fn default() -> ClientFilters
fn default() -> ClientFilters
Auto Trait Implementations§
impl Freeze for ClientFilters
impl RefUnwindSafe for ClientFilters
impl Send for ClientFilters
impl Sync for ClientFilters
impl Unpin for ClientFilters
impl UnsafeUnpin for ClientFilters
impl UnwindSafe for ClientFilters
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more