pub struct WidgetResponseMeta {
pub close_widget: Option<bool>,
pub widget_session_id: Option<String>,
}Available on crate feature
mcp-apps only.Expand description
Metadata for tool responses in ChatGPT Apps.
These fields control widget behavior after a tool response is received.
They are included in the _meta field of CallToolResult.
§Example
use pmcp::types::mcp_apps::WidgetResponseMeta;
// Close the widget after this response
let meta = WidgetResponseMeta::new()
.close_widget(true)
.widget_session_id("session-abc123");Fields§
§close_widget: Option<bool>Close the widget when this response arrives.
When set to true, ChatGPT will hide the widget after processing
this tool response. Useful for “done” or “cancel” actions.
widget_session_id: Option<String>Widget session ID for correlating tool calls.
This ID is unique per widget instance and can be used to correlate multiple tool calls from the same widget session for logging or analytics.
Implementations§
Source§impl WidgetResponseMeta
impl WidgetResponseMeta
Sourcepub fn close_widget(self, close: bool) -> Self
pub fn close_widget(self, close: bool) -> Self
Set whether to close the widget.
Sourcepub fn widget_session_id(self, id: impl Into<String>) -> Self
pub fn widget_session_id(self, id: impl Into<String>) -> Self
Set the widget session ID.
Sourcepub fn to_meta_map(&self) -> Map<String, Value>
pub fn to_meta_map(&self) -> Map<String, Value>
Convert to a serde_json::Map for merging into tool result _meta.
Trait Implementations§
Source§impl Clone for WidgetResponseMeta
impl Clone for WidgetResponseMeta
Source§impl Debug for WidgetResponseMeta
impl Debug for WidgetResponseMeta
Source§impl Default for WidgetResponseMeta
impl Default for WidgetResponseMeta
Source§impl<'de> Deserialize<'de> for WidgetResponseMeta
impl<'de> Deserialize<'de> for WidgetResponseMeta
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for WidgetResponseMeta
Available on crate feature schema-generation only.
impl JsonSchema for WidgetResponseMeta
Available on crate feature
schema-generation only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for WidgetResponseMeta
impl PartialEq for WidgetResponseMeta
Source§impl Serialize for WidgetResponseMeta
impl Serialize for WidgetResponseMeta
impl StructuralPartialEq for WidgetResponseMeta
Auto Trait Implementations§
impl Freeze for WidgetResponseMeta
impl RefUnwindSafe for WidgetResponseMeta
impl Send for WidgetResponseMeta
impl Sync for WidgetResponseMeta
impl Unpin for WidgetResponseMeta
impl UnsafeUnpin for WidgetResponseMeta
impl UnwindSafe for WidgetResponseMeta
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