Encapsulates tool metadata and execution logic for MCP protocol integration. Provides comprehensive validation through active bindings, automatic type conversion, and structured tool calling interface. Maintains tool properties with validation and enables direct tool execution with JSON input handling.
Details
Tool Definition
Manages tool lifecycle through validated properties:
Function Storage: Maintains executable function with validation
Metadata Management: Stores name, description, and annotations
Argument Validation: Ensures proper type definitions for parameters
Type Conversion: Handles JSON-to-R type conversion automatically
Active bindings
nameTool name with MCP protocol compliance validation
descriptionTool description ensuring non-empty string format
argumentsArgument definitions ensuring proper list structure
convertJSON conversion flag ensuring logical type
annotationsTool annotations ensuring basic R type compliance
funExecutable function ensuring callable object
Methods
Method new()
Initialize ToolDef with validation
Method call()
Execute tool with arguments and optional type conversion
Method print()
Print formatted tool definition with metadata
