pub struct McpArguments { /* private fields */ }Expand description
Owning decoder for MCP tool argument objects.
Generated form and table integrations consume arguments through this type
instead of open-coding JSON map removal. Manual tool integrations can use
the same helpers and call McpArguments::finish when every expected
argument has been consumed.
Implementations§
Source§impl McpArguments
impl McpArguments
Sourcepub fn new(arguments: McpToolArguments) -> Self
pub fn new(arguments: McpToolArguments) -> Self
Creates an owning decoder from normalized MCP arguments.
Sourcepub fn as_inner(&self) -> &McpToolArguments
pub fn as_inner(&self) -> &McpToolArguments
Returns the remaining raw argument object.
Sourcepub fn into_inner(self) -> McpToolArguments
pub fn into_inner(self) -> McpToolArguments
Returns the remaining raw argument object.
Sourcepub fn take_raw(&mut self, field: &str) -> Option<Value>
pub fn take_raw(&mut self, field: &str) -> Option<Value>
Removes and returns one raw argument by wire field name.
Sourcepub fn take_raw_one_of(
&mut self,
field: &str,
aliases: &[&str],
) -> Result<Option<Value>, McpToolError>
pub fn take_raw_one_of( &mut self, field: &str, aliases: &[&str], ) -> Result<Option<Value>, McpToolError>
Removes and returns one raw argument by canonical field name or alias.
§Errors
Returns McpToolError::DuplicateField when both the canonical field
name and an alias are present, or multiple aliases are present.
Sourcepub fn take_required_tool_value<T>(
&mut self,
field: impl Into<String>,
) -> Result<T, McpToolError>where
T: McpToolValue,
pub fn take_required_tool_value<T>(
&mut self,
field: impl Into<String>,
) -> Result<T, McpToolError>where
T: McpToolValue,
Removes, requires, and decodes one typed argument by field name.
§Errors
Returns McpToolError when the field is missing or when T rejects the
raw JSON value.
Sourcepub fn take_required_tool_value_from<T>(
&mut self,
field: &'static str,
aliases: &'static [&'static str],
) -> Result<T, McpToolError>where
T: McpToolValue,
pub fn take_required_tool_value_from<T>(
&mut self,
field: &'static str,
aliases: &'static [&'static str],
) -> Result<T, McpToolError>where
T: McpToolValue,
Removes, requires, and decodes one typed argument by field name or alias.
§Errors
Returns McpToolError when no accepted field name is present, duplicate
field spellings are present, or T rejects the raw JSON value.
Sourcepub fn take_present_tool_value<T>(
&mut self,
field: impl Into<String>,
) -> Result<Option<T>, McpToolError>where
T: McpToolValue,
pub fn take_present_tool_value<T>(
&mut self,
field: impl Into<String>,
) -> Result<Option<T>, McpToolError>where
T: McpToolValue,
Removes and decodes an optional typed argument by field name.
§Errors
Returns McpToolError when T rejects the raw JSON value.
Sourcepub fn take_present_tool_value_from<T>(
&mut self,
field: &'static str,
aliases: &'static [&'static str],
) -> Result<Option<T>, McpToolError>where
T: McpToolValue,
pub fn take_present_tool_value_from<T>(
&mut self,
field: &'static str,
aliases: &'static [&'static str],
) -> Result<Option<T>, McpToolError>where
T: McpToolValue,
Removes and decodes an optional typed argument by field name or alias.
§Errors
Returns McpToolError when duplicate field spellings are present or
T rejects the raw JSON value.
Sourcepub fn finish(self) -> Result<(), McpToolError>
pub fn finish(self) -> Result<(), McpToolError>
Verifies that no unrecognized arguments remain.
§Errors
Returns McpToolError::UnknownField when any raw arguments remain.
Trait Implementations§
Source§impl Clone for McpArguments
impl Clone for McpArguments
Source§fn clone(&self) -> McpArguments
fn clone(&self) -> McpArguments
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 McpArguments
impl Debug for McpArguments
Source§impl Default for McpArguments
impl Default for McpArguments
Source§fn default() -> McpArguments
fn default() -> McpArguments
impl Eq for McpArguments
Source§impl From<Map<String, Value>> for McpArguments
impl From<Map<String, Value>> for McpArguments
Source§fn from(arguments: McpToolArguments) -> Self
fn from(arguments: McpToolArguments) -> Self
Source§impl From<McpToolCall> for McpArguments
impl From<McpToolCall> for McpArguments
Source§fn from(call: McpToolCall) -> Self
fn from(call: McpToolCall) -> Self
Source§impl PartialEq for McpArguments
impl PartialEq for McpArguments
impl StructuralPartialEq for McpArguments
Auto Trait Implementations§
impl Freeze for McpArguments
impl RefUnwindSafe for McpArguments
impl Send for McpArguments
impl Sync for McpArguments
impl Unpin for McpArguments
impl UnsafeUnpin for McpArguments
impl UnwindSafe for McpArguments
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.