SuiteScript 2.1 Custom Tool Script Type
Custom tool scripts are SuiteScripts that let you build NetSuite tools which external AI clients can invoke through the NetSuite AI Connector Service. With these scripts, you can retrieve data, trigger actions, or perform most SuiteScript-supported operations—all from natural language prompts in your AI client.
By using custom tools, your AI client can provide more accurate responses to prompts and perform specific actions for you in NetSuite. You can deploy custom tools to your NetSuite account only through the SuiteCloud Development Framework (SDF), either as a SuiteApp or an ACP. Each tool must be defined in a JSON Schema.
The N/http, N/https, and N/search modules are not supported in custom tool scripts.
To learn more about custom tool scripts, see:
Custom Tool Script Best Practices
Following a few best practices can help you write custom tool scripts that are reliable and simple to maintain. The following table highlights key recommendations to keep in mind as you develop your custom tools:
Best Practices |
Description |
---|---|
Use unique method names |
Give each method a unique name to avoid conflicts and ensure clear mapping between your tool schema and script. This helps AI clients and developers find the right functionality. |
Ensure tool descriptions are accurate |
Write clear, precise descriptions for each tool. Accurate descriptions help AI clients and developers understand, maintain, and extend your tools. |
Stringify objects before returning |
Convert objects to JSON strings before returning them. This ensures compatibility with AI clients and avoids serialization issues. This also gives you a predictable data format for downstream processing. |
Avoid semantic collision between tools |
Make sure no two tools perform similar or confusing actions. Overlap can cause unpredictable AI behavior and make maintenance harder. |
Plan each operation for the AI-as-customer-agent model |
The tool user is an AI acting for a customer. Make operations safe, auditable, and suitable for automation—not requiring human judgment. |
Exclude data from untrusted sources in output |
Only include information from trusted or verified sources in your tool’s output. This keeps your data reliable, protects against security risks, and makes sure AI-driven actions are based on trusted information. |
NetSuite provides basic tools to help you get started with the NetSuite AI Connector Service and the custom tool script type. These examples show the kinds of AI-powered solutions you can build and deploy in your own account. For more information, see MCP Sample Tools SuiteApp.