pub struct ParsedBody {
pub messages: Vec<JsonRpcMessage>,
pub is_batch: bool,
}Expand description
Result of parsing a POST body as JSON-RPC 2.0.
Fields§
§messages: Vec<JsonRpcMessage>§is_batch: boolImplementations§
Source§impl ParsedBody
impl ParsedBody
Sourcepub fn method_str(&self) -> &str
pub fn method_str(&self) -> &str
Get the method string from the first request or notification. Falls back to “unknown” if the batch contains only responses.
Sourcepub fn mcp_method(&self) -> McpMethod
pub fn mcp_method(&self) -> McpMethod
Get the MCP method classification from the first request/notification.
Sourcepub fn first_request_id(&self) -> Option<&JsonRpcId>
pub fn first_request_id(&self) -> Option<&JsonRpcId>
Get the id of the first request (if any).
Sourcepub fn is_notification_only(&self) -> bool
pub fn is_notification_only(&self) -> bool
True if every message is a notification (no id, no response expected).
Sourcepub fn detail(&self) -> Option<String>
pub fn detail(&self) -> Option<String>
Extract a short detail string for logging:
- tools/call → tool name (params.name)
- resources/read → resource URI (params.uri)
- prompts/get → prompt name (params.name)
Sourcepub fn first_params(&self) -> Option<&Value>
pub fn first_params(&self) -> Option<&Value>
Get the raw params from the first request/notification.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParsedBody
impl RefUnwindSafe for ParsedBody
impl Send for ParsedBody
impl Sync for ParsedBody
impl Unpin for ParsedBody
impl UnsafeUnpin for ParsedBody
impl UnwindSafe for ParsedBody
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