llm.ToolResult

Note:

The content in this help topic pertains to SuiteScript 2.1.

Object Description

A tool result returned from llm.createToolResult(options).

This object represents the output of running a tool in response to a tool call request from the large language model (LLM). Tool results let you communicate the outcome of the tool handler logic (such as the result of a SuiteQL query or a business operation) back to the LLM. The LLM uses these results to generate a more complete and informed response.

You create this object using the llm.createToolResult(options) method. This object includes properties for the originating tool call request that this result corresponds to (ToolResult.call) and the output values produced by running the tool (ToolResult.outputs). After you create this object, you can provide it to subsequent llm.generateText(options) or llm.generateTextStreamed(options) calls, which lets the LLM incorporate the results of the tool call and return a more accurate and relevant response.

Supported Script Types

Server scripts

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

Module

N/llm Module

Methods and Properties

ToolResult 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 toolResult = llm.createToolResult({
    // toolCall is the originating tool call request from the LLM    
    call: toolCall,
    // handlerResult is the result of running the tool specified by the
    // tool call request
    outputs: [{ result: handlerResult }]
});

...
// Add additional code 

          

Related Topics

General Notices