Tool Object Members Reference for SuiteScript 2.1
Tool Object Members in SuiteScript 2.1 provide essential properties including description, name, and parameters for server scripts.
The Tool Object in SuiteScript 2.1 allows developers to define tools with specific properties that enhance their scripting capabilities. Understanding its members is crucial for constructing robust server scripts.
What Are Tool Object Members?
Tool Object Members are properties that describe various aspects of a tool in SuiteScript 2.1. The key members include:
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
Tool.description | string | Server scripts | Provides a description of the tool. |
Tool.name | string | Server scripts | Represents the name of the tool. |
Tool.parameters | Array<llm.ToolParameter> | Server scripts | Contains the parameters of the tool. |
Property Descriptions
Tool.description: This property returns the description of the tool in string format, useful for documentation and clarity within your scripts.Tool.name: The name of the tool, also returned as a string, which serves to identify the tool when referenced in code.Tool.parameters: Returns an array ofllm.ToolParameterobjects, each representing a parameter that the tool accepts, allowing for customizable functionality.
Error Handling
When using Tool properties, developers should be aware of error codes such as READ_ONLY, which indicates that an attempt to set a property has been made, which is not permitted.
Example Syntax
Here's a brief example that illustrates the creation of a tool in SuiteScript 2.1:
1const findUserIdTool = llm.createTool({2 name: "findUserId",3 description: "Looks up user ID based on user name",4 parameters: [5 llm.createToolParameter({6 name: "userName",7 description: "Name of the user",8 type: llm.ToolParameterType.STRING9 })10 ]11});12 13const toolDescription = findUserIdTool.description;In this code, a tool named findUserId is defined with a specific description and parameters, demonstrating how flexible and powerful the Tool Object can be in your server-side scripts.
Who This Affects
- Developers: Those working with SuiteScript 2.1 and needing to create or manipulate tools.
- Administrators: Individuals responsible for managing scripts and tools within NetSuite.
Key Takeaways
- Tool Object Members are key properties for server scripts in SuiteScript 2.1.
- Understanding each member facilitates effective tool creation.
- Error codes like
READ_ONLYhighlight important considerations during property assignments.
Frequently Asked Questions (4)
Are Tool Object Members in SuiteScript 2.1 applicable to client scripts?
What happens if I try to set a value on a read-only Tool property?
Is it possible to define custom parameters for a tool using SuiteScript 2.1?
How can developers use the 'Tool.description' property effectively?
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.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- 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.
