Create a tool definition for foundry_response() or foundry_agent(). The
request sent to Azure uses the Responses API function-tool contract, while
the returned object also keeps the R function needed for local dispatch.
Arguments
- fun
Function. The R function to run when the model calls the tool.
- name
Character. Tool name exposed to the model. If omitted and
funis a named function object, the object name is used.- description
Character. Short description of what the tool does.
- parameters
List. JSON Schema object describing function arguments.
Value
A foundry_tool object. It is a list containing the JSON tool schema
and the R function used by foundry_agent().