pub struct ProgressReporter { /* private fields */ }Expand description
Progress reporter that wraps a notification sender with a progress token.
This is the concrete type stored in McpContext that handles sending progress notifications with the correct token.
Implementations§
Source§impl ProgressReporter
impl ProgressReporter
Sourcepub fn new(sender: Arc<dyn NotificationSender>) -> Self
pub fn new(sender: Arc<dyn NotificationSender>) -> Self
Creates a new progress reporter with the given sender.
Sourcepub fn with_marker(marker: Value, sender: Arc<dyn NotificationSender>) -> Self
pub fn with_marker(marker: Value, sender: Arc<dyn NotificationSender>) -> Self
Creates a reporter which retains the request marker it will emit.
Proxy routes use this marker to correlate an upstream progress frame before relaying it through this request’s downstream reporter.
Sourcepub fn marker(&self) -> Option<&Value>
pub fn marker(&self) -> Option<&Value>
Returns the request marker owned by this reporter, when it has one.
Sourcepub fn report(&self, progress: f64, message: Option<&str>)
pub fn report(&self, progress: f64, message: Option<&str>)
Reports progress to the client.
§Arguments
progress- Current progress value (0.0 to 1.0 for fractional, or absolute)message- Optional message describing current status
Sourcepub fn report_with_total(
&self,
progress: f64,
total: f64,
message: Option<&str>,
)
pub fn report_with_total( &self, progress: f64, total: f64, message: Option<&str>, )
Reports progress with a total for determinate progress bars.
§Arguments
progress- Current progress valuetotal- Total expected valuemessage- Optional message describing current status
Sourcepub fn report_exact(
&self,
progress: Number,
total: Option<Number>,
message: Option<&str>,
)
pub fn report_exact( &self, progress: Number, total: Option<Number>, message: Option<&str>, )
Reports final progress without converting JSON-number lexemes through
f64.
The supplied numbers may exceed IEEE-754 range when the installed sender supports the final protocol. A legacy sender receives the trait default, which emits nothing.
Trait Implementations§
Source§impl Clone for ProgressReporter
impl Clone for ProgressReporter
Source§fn clone(&self) -> ProgressReporter
fn clone(&self) -> ProgressReporter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more