Skip to main content
Glama

execute_script

Destructive

Execute server-side scripts on ServiceNow to perform complex queries and operations not supported by REST, returning script output.

Instructions

Execute a server-side script on the ServiceNow instance (Background Script). Supports GlideRecord, GlideQuery, GlideAggregate, and all server-side APIs. Returns the script output. Use for complex queries that cannot be expressed via REST. REQUIRES WRITE_ENABLED=true.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scopeNoApplication scope to run in (default: global)
scriptYesServer-side JavaScript to execute. Use gs.print() or gs.info() for output.
Behavior4/5

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

Annotations already indicate destructiveHint=true and readOnlyHint=false. The description adds value by specifying supported APIs (GlideRecord, GlideQuery, etc.), that it returns script output, and the write requirement. No contradictions with annotations.

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 three sentences with no wasted words. It front-loads the purpose, then lists capabilities, and ends with usage guidance. Each sentence serves a distinct purpose.

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

Completeness5/5

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

Given the tool's complexity, the description covers all critical aspects: what it does, what APIs it supports, when to use it, that it returns output, and a prerequisite. No output schema exists, so the explanation of return value is adequate.

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

Parameters4/5

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

The input schema has 100% coverage with descriptions for both parameters (scope and script). The description adds the hint 'Use gs.print() or gs.info() for output' and states 'Returns the script output', which is not explicitly in the schema. This helps the agent understand how to get results.

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 the tool executes server-side scripts on ServiceNow, listing supported APIs and distinguishing it from REST-based tools. It explicitly says 'Use for complex queries that cannot be expressed via REST', which differentiates it from sibling tools like query_records or nlq_query.

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 a clear when-to-use scenario ('complex queries that cannot be expressed via REST') and a prerequisite ('REQUIRES WRITE_ENABLED=true'). However, it does not explicitly list when not to use it or name alternatives, but the context from sibling tools implies many specific tools exist for simpler operations.

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/aartiq/nowaikit'

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