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 Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Search Filter Object Usage in SuiteScript
The Search Filter object enables refined query capabilities in SuiteScript, encapsulating search criteria.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category