ToolResult Object in SuiteScript 2.1 for LLM Integration
The ToolResult object in SuiteScript 2.1 allows integration with LLM tools, enabling real-time data retrieval and execution of business logic.
The ToolResult object is a fundamental component in SuiteScript 2.1, facilitating interactions with large language models (LLM). This object encapsulates the results of tool calls, enhancing the integration between LLMs and SuiteScript, which is critical for dynamic business processes.
What is the ToolResult Object?
The ToolResult object serves to hold the output from executing a tool specified in an LLM interaction. It comprises key properties that can be accessed within server scripts to manage data flows between LLM requests and SuiteScript logic.
Key Properties of ToolResult
A ToolResult object includes the following properties:
| Property Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
| ToolResult.call | llm.ToolCall | Server scripts | Contains the originating tool call request from the LLM. |
| ToolResult.outputs | Object[] | Server scripts | Represents the outputs derived from the related tool call. |
Detailed Description of Properties
- ToolResult.call: This property holds the original request sent from the LLM, enabling context-aware interactions. The
llm.ToolCallobject provides the specifics needed for executing the defined tool. - ToolResult.outputs: This property is an array of objects that includes results obtained from executing the tool defined in the LLM call, thus providing the necessary outputs for further processing or response generation.
How to Use ToolResult in Scripts
To effectively use the ToolResult property in server scripts, it is important to follow specific syntax. The following example illustrates how a ToolResult object is created and its properties accessed:
1// Example of creating a ToolResult object2const toolResult = llm.createToolResult({3 // Originating tool call request4 call: toolCall,5 // Outputs from running the specified tool6 outputs: [{ result: handlerResult }]7});8 9const toolResultCall = toolResult.call;This syntax is not functional in isolation but serves to demonstrate how the ToolResult object can be utilized in real-world scenarios, such as LLM interactions that require defined tools to produce meaningful outputs.
Error Handling
When working with ToolResult, it is essential to note the error code READ_ONLY, which is thrown if an attempt is made to set the property after its creation. Proper handling of such errors can ensure robust script behavior.
Conclusion
In summary, the ToolResult object is a pivotal element for developers looking to implement sophisticated integrations with LLMs in SuiteScript 2.1. It provides critical encapsulation of tool calls and outputs, allowing for efficient data-driven interactions within the NetSuite platform.
Frequently Asked Questions (4)
What role does the ToolResult object play in SuiteScript 2.1?
Can the properties of a ToolResult object be modified after its creation?
What are the key properties of the ToolResult object?
How are error codes handled when working with the ToolResult object?
Was this article helpful?
More in AI
- Prompt Studio: Generative AI Management in NetSuite 2026.1
Prompt Studio in NetSuite 2026.1 enhances generative AI management, enabling customization of prompts and Text Enhance actions.
- SuiteCloud Agent Skills for AI Development in NetSuite 2026.1
SuiteCloud Agent Skills enhance development workflows with AI-driven guidance in NetSuite 2026.1, improving automation and process standardization.
- N/llm Module: Usage Limits and Additional Requests in NetSuite
In NetSuite 2026.1, the N/llm module sets usage limits and options for additional requests via Oracle Cloud.
- Required Features and Permissions for NetSuite AI Connector
Ensure Server SuiteScript and OAuth 2.0 are enabled for secure usage of the NetSuite AI Connector Service.
Advertising
Reach AI Professionals
Put your product in front of NetSuite experts who work with AI every day.
Sponsor This Category