Central routing function for displaying R plot objects.
Validates the plot object class, then routes to the appropriate
rendering path based on target audience and MCP App support.
Usage
channel_plot(plot_obj, mcp_apps_supported = FALSE, target = c("user", "agent"))
Arguments
- plot_obj
A plot object (ggplot, plotly, htmlwidget, recordedplot,
grob, gtable, trellis, or captured_plot)
- mcp_apps_supported
Logical; whether the client supports MCP App structuredContent
- target
Character; who sees the plot: "user" (display) or "agent" (base64 for analysis)
Value
Varies by path: text confirmation, structuredContent list, or image response
Examples
if (FALSE) { # \dontrun{
captured <- capture_plot(plot(cars))
channel_plot(captured)
} # }