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.
Source: This article is based on Oracle's official NetSuite documentation.
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 Integration
- Natural Language Queries in NetSuite AI
MCP Standard Tools SuiteApp enables AI-driven data tasks in NetSuite, aligned with role permissions.
- Square Connector Integration in NetSuite 2026.1
Discover the Square Connector for seamless integration with NetSuite 2026.1, synchronizing transactions, orders, and inventory effortlessly.
- SuiteTalk Web Services Updates for NetSuite Integrations
SuiteTalk Web Services adds new Item Supply Plan support, enhancing integrations for efficient data management.
- SuiteTalk Web Services Enhancements in NetSuite
Explore the latest enhancements to SuiteTalk Web Services, improving integration and API functionalities in NetSuite.
Advertising
Reach Integration Professionals
Put your product in front of NetSuite experts who work with Integration every day.
Sponsor This Category