Expect a tool to return structured content that matches its output schema
Source:R/expect_structured_output.R
expect_structured_output.RdCalls the tool with call_tool() and checks its structuredContent
against the output schema that @mcpOutput declares, as the MCP
specification asks clients to do.
Usage
expect_structured_output(
tool,
args = list(),
package = testthat::testing_package(),
...
)Arguments
- tool
Name of the tool.
- args
Named list of arguments.
- package
Package that serves the tool, by default the one being tested.
- ...
Passed to
call_tool().
Examples
if (FALSE) { # \dontrun{
# In the tests of a package made by create_mordew():
expect_structured_output(
"year_totals",
list(
year = 2025
)
)
} # }