% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tools-def.R
\name{ToolDef}
\alias{ToolDef}
\title{A tool definition}
\usage{
ToolDef(
  .data = function() NULL,
  name = stop("Required"),
  description = stop("Required"),
  arguments = TypeObject(),
  convert = TRUE,
  annotations = list()
)
}
\arguments{
\item{.data}{The underlying function.}

\item{name}{The name of the tool.}

\item{description}{A description of what the tool does.}

\item{arguments}{A \link{TypeObject} describing the tool's arguments.}

\item{convert}{Whether to automatically convert JSON inputs to R
equivalents.}

\item{annotations}{A list of additional tool annotations.}
}
\description{
An S7 class representing a tool that can be called by a chat model.
You should generally not create this object yourself, but instead
call \code{\link[=tool]{tool()}} instead.
}
\examples{
my_tool <- ToolDef(
  function(x) x * 2,
  name = "double",
  description = "Doubles a number",
  arguments = type_object(x = type_number("The number to double"))
)
}
