llm.Tool

Note:

The content in this help topic pertains to SuiteScript 2.1.

Object Description

A tool returned from llm.createTool(options).

This object represents a callable operation that the large language model (LLM) can request to augment its responses. Tools are custom utilities that you define, and they let the LLM retrieve external data (such as data from NetSuite using SuiteQL), perform calculations, or trigger business logic as part of an LLM interaction. This object is used to inform the LLM about which operations are available to invoke as it generates its response.

You create this object using the llm.createTool(options) method. This object includes properties for the tool name (Tool.name), tool description (Tool.description), and a set of input parameters (Tool.parameters). When you call llm.generateText(options) or llm.generateTextStreamed(options), you can use the options.tools parameter to provide a set of tools that the LLM can request. When the LLM determines that a tool may help answer a prompt, it requests a tool call, which you handle in your SuiteScript code. After running the tool's logic and obtaining a result, you can send the result (as a llm.ToolResult object) back to the LLM, which can enable richer and more dynamic responses.

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/llm Module

Methods and Properties

Tool Object Members

Since

2025.2

Syntax

Important:

The following code sample shows the syntax for this member. It isn't a functional example. For a complete script example, see N/llm Module Script Samples.

            // Add additional code
...

const findUserIdTool = llm.createTool({
    name: "findUserId",
    description: "Looks up user ID based on user name",
    parameters: [
        llm.createToolParameter({
            name: "userName",
            description: "Name of the user",
            type: llm.ToolParameterType.STRING
        })
    ]
});

...
// Add additional code 

          

Related Topics

General Notices