| register_io | R Documentation |
MCP AccessRegister shiny inputs and outputs for MCP (Model Context
Protocol) agent access.
register_input() wraps a shiny input constructor to
register metadata. It evaluates expr and returns the UI element.
register_output() is a server-side function that registers a
render function call (e.g. renderPlot({...})), assigns it to
session$output, registers the MCP output spec, and sets
up download-widget handlers. The UI overlay icons are injected
entirely by JS.
register_input(
expr,
inputId,
update,
description = "",
writable = TRUE,
quoted = FALSE,
env = parent.frame()
)
register_output(
expr,
outputId,
description = "",
quoted = FALSE,
env = parent.frame(),
...,
output_opts = list(),
download_function = NULL,
download_type = c("image", "htmlwidget", "threeBrain", "no-download", "data",
"stream_viz"),
extension = NULL,
session = shiny::getDefaultReactiveDomain()
)
expr |
For |
inputId |
character string. The |
update |
character string. The fully qualified update function,
e.g. |
description |
character string. A human-readable description of
the input or output purpose, exposed to |
writable |
logical (default |
quoted |
logical (default |
env |
the environment in which to evaluate |
outputId |
character string. The |
... |
reserved for future use. |
output_opts |
a named list of extra options for the output (e.g. width, height defaults). |
download_function |
a custom download handler function. When
|
download_type |
character string. One of |
extension |
character vector of allowed file extension for
download, or |
session |
the |
register_input returns the evaluated UI element.
register_output is called for its side effects (assigning
the render function and registering widgets) and returns NULL
invisibly.
init_app, mcp_wrapper
## Not run:
# inside a shidashi module UI function:
ns <- shiny::NS("demo")
register_input(
expr = shiny::sliderInput(
inputId = ns("threshold"),
label = "Threshold",
min = 0, max = 1, value = 0.5
),
inputId = "threshold",
update = "shiny::updateSliderInput",
description = "Filter threshold for the plot"
)
# inside a shidashi module server function:
register_output(
expr = renderPlot({ plot(iris) }),
outputId = "my_plot",
description = "Scatter plot of iris data",
download_type = "image"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.