pub struct SkillCtx<'a, S> {
pub server: &'a S,
pub args: JsonObject,
pub peer: Option<Peer<RoleServer>>,
pub meta: Option<Meta>,
}Expand description
What a Skill::call receives: a borrow of the shared server state plus
the raw, already-extracted argument object (parse it with
SkillCtx::parse).
peer + meta mirror the rmcp request context for the underlying tool
call. Skills that emit progress notifications read the caller’s
progressToken out of meta and use peer to send them; plain
synchronous tools ignore both. They are owned rather than borrowed
because Peer is cheap to clone (transport-channel handles only) and a
skill routinely needs to hand it into a spawned task that outlives the
call.
Fields§
§server: &'a SBorrow of the shared server state.
args: JsonObjectThe raw argument object (already extracted from the request).
peer: Option<Peer<RoleServer>>rmcp peer handle. None only in hand-constructed test contexts.
meta: Option<Meta>rmcp request _meta (the dictionary carrying progressToken, etc.).
Implementations§
Source§impl<'a, S> SkillCtx<'a, S>
impl<'a, S> SkillCtx<'a, S>
Sourcepub fn parse<T: DeserializeOwned>(self) -> Result<(&'a S, T), McpError>
pub fn parse<T: DeserializeOwned>(self) -> Result<(&'a S, T), McpError>
Parse the arguments into a typed struct, returning the server handle too.
Sourcepub fn progress_token(&self) -> Option<ProgressToken>
pub fn progress_token(&self) -> Option<ProgressToken>
Convenience: pull the MCP progressToken the caller put in
_meta.progressToken, if any.