Skip to contents

Creates ToolDef object with name, description, and argument specifications for MCP protocol integration. Simplified version for initial integration.

Usage

tool(
  fun,
  description,
  arguments = list(),
  name = NULL,
  convert = TRUE,
  annotations = list()
)

Arguments

fun

The function to be invoked when the tool is called

description

A detailed description of what the function does

arguments

A named list that defines the arguments accepted by the function

name

The name of the function. This can be omitted if fun is an existing function

convert

Should JSON inputs be automatically convert to their R data type equivalents (default: TRUE)

annotations

Additional properties that describe the tool and its behavior

Value

An R6 ToolDef object

Details

Define Tool for MCP Framework

Examples

# Define a simple tool
my_tool <- tool(
  function(x) x + 1,
  description = "Add 1 to a number",
  arguments = list(x = "number")
)