#[non_exhaustive]pub struct ToolCallContext<'s, S> {
pub request_context: RequestContext<RoleServer>,
pub service: &'s S,
pub name: Cow<'static, str>,
pub arguments: Option<JsonObject>,
pub input_responses: Option<InputResponses>,
pub request_state: Option<String>,
}Available on crate feature
server only.Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.request_context: RequestContext<RoleServer>The request-specific context for this tool call.
service: &'s SThe server handling this tool call.
name: Cow<'static, str>The name of the tool being called.
arguments: Option<JsonObject>The arguments supplied for the tool call.
input_responses: Option<InputResponses>Client responses to input requests from the previous MRTR round.
request_state: Option<String>Opaque state returned by the server during the previous MRTR round.
Implementations§
Source§impl<'s, S> ToolCallContext<'s, S>
impl<'s, S> ToolCallContext<'s, S>
pub fn new( service: &'s S, _: CallToolRequestParams, request_context: RequestContext<RoleServer>, ) -> Self
pub fn name(&self) -> &str
pub fn request_context(&self) -> &RequestContext<RoleServer>
Source§impl<'s, S> ToolCallContext<'s, S>
impl<'s, S> ToolCallContext<'s, S>
pub fn invoke<H, A>(
self,
h: H,
) -> BoxFuture<'s, Result<CallToolResponse, ErrorData>>where
H: CallToolHandler<S, A>,
Trait Implementations§
Source§impl<S> AsRequestContext for ToolCallContext<'_, S>
impl<S> AsRequestContext for ToolCallContext<'_, S>
fn as_request_context(&self) -> &RequestContext<RoleServer>
fn as_request_context_mut(&mut self) -> &mut RequestContext<RoleServer>
Source§impl<S> FromContextPart<ToolCallContext<'_, S>> for ToolName
impl<S> FromContextPart<ToolCallContext<'_, S>> for ToolName
fn from_context_part( context: &mut ToolCallContext<'_, S>, ) -> Result<Self, ErrorData>
Source§impl<S> FromContextPart<ToolCallContext<'_, S>> for RequestState
impl<S> FromContextPart<ToolCallContext<'_, S>> for RequestState
fn from_context_part( context: &mut ToolCallContext<'_, S>, ) -> Result<Self, ErrorData>
Source§impl<S> FromContextPart<ToolCallContext<'_, S>> for InputResponses
impl<S> FromContextPart<ToolCallContext<'_, S>> for InputResponses
fn from_context_part( context: &mut ToolCallContext<'_, S>, ) -> Result<Self, ErrorData>
Source§impl<S, P> FromContextPart<ToolCallContext<'_, S>> for Parameters<P>where
P: DeserializeOwned,
impl<S, P> FromContextPart<ToolCallContext<'_, S>> for Parameters<P>where
P: DeserializeOwned,
fn from_context_part( context: &mut ToolCallContext<'_, S>, ) -> Result<Self, ErrorData>
Source§impl<S> FromContextPart<ToolCallContext<'_, S>> for JsonObject
impl<S> FromContextPart<ToolCallContext<'_, S>> for JsonObject
fn from_context_part( context: &mut ToolCallContext<'_, S>, ) -> Result<Self, ErrorData>
Auto Trait Implementations§
impl<'s, S> !RefUnwindSafe for ToolCallContext<'s, S>
impl<'s, S> !UnwindSafe for ToolCallContext<'s, S>
impl<'s, S> Freeze for ToolCallContext<'s, S>
impl<'s, S> Send for ToolCallContext<'s, S>
impl<'s, S> Sync for ToolCallContext<'s, S>
impl<'s, S> Unpin for ToolCallContext<'s, S>
impl<'s, S> UnsafeUnpin for ToolCallContext<'s, S>where
&'s S: UnsafeUnpin,
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
Mutably borrows from an owned value. Read more