ToolCall Object Members in SuiteScript 2.1 Reference
The ToolCall object in SuiteScript 2.1 manages tool requests, including parameters and error handling for server scripts.
TL;DR
The ToolCall object in SuiteScript 2.1 enables server scripts to manage tool requests, including specifying tools and their parameters. Understanding its members is crucial for developers implementing tool functionality.
What Is the ToolCall Object?
The ToolCall object relates to the handling of tool requests within SuiteScript 2.1, specifically designed for server scripts. It includes essential properties that identify the tool being requested and the parameters required for its execution.
ToolCall Object Members Overview
Below are the key members of the ToolCall object that developers should be aware of:
| Member Name | Type | Return Type / Value Type | Supported Script Types |
|---|---|---|---|
| ToolCall.name | Property | string | Server scripts |
| ToolCall.parameters | Property | llm.ToolParameter[] | Server scripts |
Property Details
ToolCall.name
- Type:
string - Description: This property holds the name of the requested tool in the LLM tool call.
- Supported Script Types: This property is relevant in server scripts.
ToolCall.parameters
- Type:
llm.ToolParameter[] - Description: It contains the required parameters for the tool in the LLM tool call.
- Supported Script Types: It is utilized in server scripts.
Error Handling
Developers may encounter the following error when working with the ToolCall object:
- Error Code:
READ_ONLY- Thrown If: There is an attempt to set a property on this object.
Example Syntax
Here is a syntax example that illustrates the use of the ToolCall object's properties, though it's not a fully functional script. For a more complete script, refer to the N/llm Module Script Samples.
1// Example of generating text with tool calls2const result = llm.generateText({3 prompt: "Write a 200 word pitch for a TV show about bears.",4 modelFamily: llm.ModelFamily.COHERE_COMMAND,5 tools: myTools6});7 8const firstToolCallName = result.toolCalls[0].name;9const firstToolCallParameters = result.toolCalls[0].parameters;Who This Affects
- Developers: Those creating server scripts that utilize the ToolCall object for tool management.
- Administrators: Individuals responsible for maintaining and configuring SuiteScript environments.
Key Takeaways
- The ToolCall object is essential for managing tool requests in SuiteScript 2.1.
- It includes properties for tool names and parameters relevant to server scripts.
- Error handling is simplified with a clear understanding of the read-only nature of certain properties.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
What script types support the use of the ToolCall object in SuiteScript 2.1?
Is it possible to modify properties of the ToolCall object in SuiteScript 2.1?
What is the purpose of the ToolCall.name property in the ToolCall object?
How are tool parameters specified in the ToolCall object?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Custom Tool Script Enhancements in NetSuite
Custom tool scripts in NetSuite gain execution log support and a new management page in February 16, 2026.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
