ToolBuilder

Overview

ToolBuilder is a builder class for constructing AI tool specifications with parameter definitions.

This class allows dynamic creation of tool specifications for AI agents, supporting string, number, and boolean parameters. It is designed to be used in scripting environments and integrates with Servoy's documentation system.

Usage example:

ToolBuilder builder = new ToolBuilder(chatBuilder, toolFunction, "toolName", "Tool description");
builder.addStringParameter("param1", "Description", true)
       .addNumberParameter("param2", "Description", false)
       .build();

Methods Summarized

Type
Name
Summary

Adds a boolean parameter to the tool specification.

Adds a number parameter to the tool specification.

Adds a string parameter to the tool specification.

void

Finalizes the tool specification and returns the chat builder.

Methods Detailed

addBooleanParameter(name, description, required)

Adds a boolean parameter to the tool specification.

Parameters

  • String name the parameter name

  • String description the parameter description

  • Boolean required whether the parameter is required

Returns: ToolBuilder this ToolBuilder instance for chaining

addNumberParameter(name, description, required)

Adds a number parameter to the tool specification.

Parameters

  • String name the parameter name

  • String description the parameter description

  • Boolean required whether the parameter is required

Returns: ToolBuilder this ToolBuilder instance for chaining

addStringParameter(name, description, required)

Adds a string parameter to the tool specification.

Parameters

  • String name the parameter name

  • String description the parameter description

  • Boolean required whether the parameter is required

Returns: ToolBuilder this ToolBuilder instance for chaining

build()

Finalizes the tool specification and returns the chat builder.

Returns: voidthe chat builder instance


Last updated

Was this helpful?