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.

·2 min read·1 views·View Oracle Docs

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 NameTypeReturn Type / Value TypeSupported Script Types
ToolCall.namePropertystringServer scripts
ToolCall.parametersPropertyllm.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.

suitescript
1// Example of generating text with tool calls
2const result = llm.generateText({
3 prompt: "Write a 200 word pitch for a TV show about bears.",
4 modelFamily: llm.ModelFamily.COHERE_COMMAND,
5 tools: myTools
6});
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?
The ToolCall object is supported in server scripts within SuiteScript 2.1.
Is it possible to modify properties of the ToolCall object in SuiteScript 2.1?
No, properties of the ToolCall object are read-only. Attempting to set a property will result in a 'READ_ONLY' error.
What is the purpose of the ToolCall.name property in the ToolCall object?
The ToolCall.name property holds the name of the tool being requested in a tool call managed through SuiteScript 2.1 server scripts.
How are tool parameters specified in the ToolCall object?
Tool parameters are specified using the ToolCall.parameters property, which is an array of type 'llm.ToolParameter[]', relevant for server scripts in SuiteScript 2.1.
Source: ToolCall Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in SuiteScript

View all SuiteScript articles →