inst/example-ellmer-tools.R

if (is_new_ellmer()) {
  res <-
    list(
      tool_rnorm = ellmer::tool(
        fun = rnorm,
        description = "Draw numbers from a random normal distribution",
        arguments = list(
          n = ellmer::type_integer(
            "The number of observations. Must be a positive integer."
          ),
          mean = ellmer::type_number("The mean value of the distribution."),
          sd = ellmer::type_number(
            "The standard deviation of the distribution. Must be a non-negative number."
          )
        )
      )
    )
} else {
  res <-
    list(
      tool_rnorm = ellmer::tool(
        rnorm,
        "Draw numbers from a random normal distribution",
        n = ellmer::type_integer(
          "The number of observations. Must be a positive integer."
        ),
        mean = ellmer::type_number("The mean value of the distribution."),
        sd = ellmer::type_number(
          "The standard deviation of the distribution. Must be a non-negative number."
        ),
      )
    )
}


res

Try the mcptools package in your browser

Any scripts or data that you put into this service are public.

mcptools documentation built on Sept. 9, 2025, 5:45 p.m.