Skip to contents

Calls the tool through its MCP server with args, then replacing one argument at a time by each extreme value its schema accepts: an empty or a huge string, the bounds or the largest numbers. A boolean, an enumeration, an array or an object has no extreme value yet: a tool that takes only those is called once, with args. Expects an answer, success or isError, to every call: not a server that hangs, nor a tool that stops the worker running it. A success can still leak data, which this does not check.

Usage

expect_hostile_safe(
  tool,
  args = list(),
  package = testthat::testing_package(),
  timeout = 90
)

Arguments

tool

Name of the tool.

args

Named list of valid arguments, the base of every call. Invalid ones fail the expectation: the server would reject every call before the tool runs.

package

Package that serves the tool, by default the one being tested.

timeout

Seconds to wait for each answer of the server.

Value

The expectation, invisibly.

Examples

if (FALSE) { # \dontrun{
# In the tests of a package made by create_mordew():
expect_hostile_safe(
  "longest_runs",
  list(
    n = 3
  )
)
} # }