Skip to main content
Glama

generate_script

Generate production-ready ServiceNow scripts with industry best practices for business rules, client scripts, scripted REST APIs, and more. Returns ready-to-deploy code with a best-practice checklist.

Instructions

Generate a complete, production-ready ServiceNow script with industry best practices baked in.

Supported types: business_rule — Server-side BR with guard, try/catch, async option script_include — Prototype-class SI with JSDoc and error envelope client_script — onChange/onLoad/onSubmit/onCellEdit with safe patterns ui_action — Server or client UI Action with redirect/confirm flow scripted_rest — Full Scripted REST API with auth, logging, error envelope scheduled_job — Scheduled job with timing, batch counting, error logging fix_script — One-time data fix with dry-run support and audit log widget — Service Portal widget stub (template + server + client)

Returns ready-to-deploy script code plus best-practice checklist and deploy field values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYes
nameYesScript name
tableNoTarget table (required for BR, CS, UI Action, Fix Script)
descriptionNoWhat this script does
logicNoCore logic to embed (pseudo-code or partial code is fine)
whenNoafter
eventsNo
conditionNoEncoded query condition
asyncNo
methodsNo
client_callableNo
script_typeNo
fieldNoField name for onChange scripts
clientNo
hintNo
api_pathNo
verbNoGET
requires_authNo
request_paramsNo
scheduleNodaily
queryNoEncoded query to select records to fix
dry_runNo
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the output includes 'ready-to-deploy script code plus best-practice checklist and deploy field values,' which is transparent about what the tool returns. It does not mention any side effects, which are minimal for a generation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, starting with the overall purpose and then listing supported types in a clear, bullet-like format. Every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (22 parameters) and the absence of an output schema, the description covers the main aspects: what the tool does, what it returns, and the different script types. However, it omits details on many parameters, which lessens completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is low (32%), and the description does not detail individual parameters beyond listing the 'type' examples. It adds meaning to the 'type' parameter but does not compensate for the many other parameters (e.g., table, logic, condition). The description adds some context but not enough given the parameter count.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it generates production-ready ServiceNow scripts with best practices, and lists eight distinct script types. This is specific and distinguishes it from sibling tools like 'review_script' or 'run_background_script'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides context for when to use each script type via the list and brief descriptions. However, it does not explicitly state when not to use this tool or mention alternatives, so some guidance is missing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pinnintisagarSB/ServiceNow-Dev-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server