snow-flow 10.0.186-dev.683 → 10.0.186-dev.694

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "10.0.186-dev.683",
3
+ "version": "10.0.186-dev.694",
4
4
  "name": "snow-flow",
5
5
  "description": "Snow-Flow - ServiceNow Multi-Agent Development Framework powered by AI",
6
6
  "license": "Elastic-2.0",
@@ -590,23 +590,23 @@ You have **direct access** to MCP tools in your environment. They are **already
590
590
  - Call the MCP tool directly once discovered
591
591
  - Tools work like built-in functions - just call them
592
592
 
593
- ### Anti-Pattern 2: Using Scheduled Scripts / Background Scripts
593
+ ### Anti-Pattern 2: Using Script Execution for CRUD Operations
594
594
 
595
- **🚨 CRITICAL: `snow_schedule_script_job` and `snow_trigger_scheduled_job` are UNRELIABLE!**
595
+ **`snow_execute_script` executes scripts reliably (~1-3s via sync REST API), but prefer dedicated tools for CRUD operations.**
596
596
 
597
- These tools **CANNOT execute scripts directly**. They create scheduled jobs that depend on the ServiceNow scheduler — which frequently times out, returns `executed=false`, or simply never runs the script. **Do NOT use these tools to verify, test, or validate anything.**
597
+ `snow_execute_script` now uses synchronous REST API execution (with scheduler fallback), so it IS reliable for script execution. However, you should still prefer dedicated tools over raw GlideRecord scripts.
598
598
 
599
- **NEVER use `snow_schedule_script_job` or `snow_trigger_scheduled_job` for:**
600
- - Verifying if something was created correctly (use `snow_query_table` instead)
601
- - Testing GlideRecord queries (use `snow_query_table` instead)
602
- - Checking table/field existence (use `snow_query_table` with limit=1 instead)
603
- - Creating/updating artifacts (use dedicated tools!)
604
- - ❌ Any operation where you need reliable results
599
+ **Prefer dedicated tools over `snow_execute_script` for:**
600
+ - Querying records use `snow_query_table`
601
+ - Creating/updating artifacts use dedicated tools (snow_deploy, snow_update, etc.)
602
+ - Flow operations use `snow_manage_flow`
603
+ - Checking table/field existence use `snow_query_table` with limit=1
605
604
 
606
- **What to use instead:**
607
- - `snow_query_table` for querying records, checking existence, verifying data
608
- - `snow_manage_flow` for flow operations
609
- - Dedicated tools always prefer a specific tool over a generic script execution
605
+ **`snow_execute_script` IS appropriate for:**
606
+ - Custom verification scripts that need server-side logic
607
+ - Complex operations not covered by dedicated tools
608
+ - Debugging and testing with gs.info output
609
+ - ✅ One-off data operations
610
610
 
611
611
  ### Anti-Pattern 3: No Mock Data, No Placeholders
612
612
 
@@ -371,7 +371,7 @@ class ServiceNowAutomationMCP {
371
371
  {
372
372
  name: "snow_schedule_script_with_output",
373
373
  description:
374
- "⚠️ DEPRECATED - Use snow_schedule_script_job instead. SCHEDULES (not executes directly) a script via scheduled job. May return executed=false. ES5 only!",
374
+ "⚠️ DEPRECATED - Use snow_execute_script instead. SCHEDULES (not executes directly) a script via scheduled job. May return executed=false. ES5 only!",
375
375
  inputSchema: {
376
376
  type: "object",
377
377
  properties: {
@@ -400,7 +400,7 @@ class ServiceNowAutomationMCP {
400
400
  {
401
401
  name: "snow_schedule_script_sync",
402
402
  description:
403
- '⚠️ DEPRECATED - Use snow_schedule_script_job instead. SCHEDULES (not sync executes) a script via scheduled job. The "sync" name is misleading - this still uses async scheduling. ES5 only!',
403
+ '⚠️ DEPRECATED - Use snow_execute_script instead. SCHEDULES (not sync executes) a script via scheduled job. The "sync" name is misleading - this still uses async scheduling. ES5 only!',
404
404
  inputSchema: {
405
405
  type: "object",
406
406
  properties: {
@@ -220,9 +220,9 @@ class ServiceNowMCPServer {
220
220
  },
221
221
  },
222
222
  {
223
- name: "snow_schedule_script_job",
223
+ name: "snow_execute_script",
224
224
  description:
225
- "⚠️ SCHEDULES (not executes directly) server-side JavaScript via Scheduled Script Job. Creates sysauto_script + sys_trigger. May return executed=false if scheduler doesn't pick it up - check System Scheduler > Scheduled Jobs.",
225
+ "Execute server-side JavaScript on ServiceNow. Primary: synchronous execution via Scripted REST API (~1-3s). Fallback: scheduled job if endpoint unavailable. ES5 only (Rhino engine)!",
226
226
  inputSchema: {
227
227
  type: "object",
228
228
  properties: {
@@ -287,7 +287,7 @@ class ServiceNowMCPServer {
287
287
  case "snow_create_workflow":
288
288
  return await this.handleCreateWorkflow(args)
289
289
 
290
- case "snow_schedule_script_job":
290
+ case "snow_execute_script":
291
291
  return await this.handleExecuteScript(args)
292
292
 
293
293
  case "snow_test_connection":
@@ -51,7 +51,7 @@ servicenow-mcp-unified/
51
51
  │ │ ├── snow_add_uib_page_element.ts
52
52
  │ │ └── index.ts
53
53
  │ ├── automation/ # Script execution, jobs
54
- │ │ ├── snow_schedule_script_job.ts # Schedule script jobs (NOT direct execution!)
54
+ │ │ ├── snow_execute_script.ts # Execute scripts (sync REST API + scheduler fallback)
55
55
  │ │ ├── snow_schedule_job.ts
56
56
  │ │ └── index.ts
57
57
  │ ├── advanced/ # Analytics
@@ -110,10 +110,10 @@ Tools are organized by **domain** (functional area), not by original server:
110
110
 
111
111
  ### 4. Automation Tools (automation/)
112
112
 
113
- **Purpose:** Script scheduling and job management
113
+ **Purpose:** Script execution and job management
114
114
 
115
- - `snow_schedule_script_job` - ⚠️ SCHEDULES scripts (NOT direct execution!) via sysauto_script + sys_trigger
116
- - `snow_confirm_script_execution` - Confirm scripts requiring approval (also uses scheduling)
115
+ - `snow_execute_script` - Execute scripts via synchronous REST API (~1-3s), with scheduler fallback
116
+ - `snow_confirm_script_execution` - Confirm scripts requiring approval
117
117
  - `snow_schedule_job` - Create scheduled jobs
118
118
  - `snow_get_logs` - Access system logs
119
119
  - `snow_trace_execution` - Set up execution tracing configuration
@@ -34,11 +34,11 @@ export {
34
34
  toolDefinition as snow_discover_schedules_def,
35
35
  execute as snow_discover_schedules_exec,
36
36
  } from "./snow_discover_schedules.js"
37
- // Scheduled script job tool - schedules scripts via sysauto_script + sys_trigger (does NOT execute directly!)
37
+ // Script execution tool - synchronous REST API execution with scheduler fallback
38
38
  export {
39
- toolDefinition as snow_schedule_script_job_def,
40
- execute as snow_schedule_script_job_exec,
41
- } from "./snow_schedule_script_job.js"
39
+ toolDefinition as snow_execute_script_def,
40
+ execute as snow_execute_script_exec,
41
+ } from "./snow_execute_script.js"
42
42
  export { toolDefinition as snow_get_logs_def, execute as snow_get_logs_exec } from "./snow_get_logs.js"
43
43
  export {
44
44
  toolDefinition as snow_get_email_logs_def,
@@ -2,7 +2,7 @@
2
2
  * snow_confirm_script_execution - Confirm and execute approved script
3
3
  *
4
4
  * Executes a script after user approval. Only call this after user
5
- * explicitly approves script execution from snow_schedule_script_job with requireConfirmation=true.
5
+ * explicitly approves script execution from snow_execute_script with requireConfirmation=true.
6
6
  *
7
7
  * Uses sysauto_script + sys_trigger approach for reliable execution.
8
8
  *
@@ -16,7 +16,7 @@ import { createSuccessResult, createErrorResult, SnowFlowError, ErrorType } from
16
16
  export const toolDefinition: MCPToolDefinition = {
17
17
  name: "snow_confirm_script_execution",
18
18
  description:
19
- "⚡ Confirms and schedules script after user approval (use after snow_schedule_script_job with requireConfirmation=true). Note: Uses same scheduled job approach.",
19
+ "⚡ Confirms and schedules script after user approval (use after snow_execute_script with requireConfirmation=true). Note: Uses same scheduled job approach.",
20
20
  // Metadata for tool discovery (not sent to LLM)
21
21
  category: "automation",
22
22
  subcategory: "script-execution",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * snow_schedule_script_job - Execute server-side JavaScript on ServiceNow
2
+ * snow_execute_script - Execute server-side JavaScript on ServiceNow
3
3
  *
4
4
  * Primary: synchronous execution via Scripted REST API (~1-3s)
5
5
  * Fallback: scheduled job if endpoint unavailable
@@ -87,11 +87,11 @@ const OPERATION_SCRIPT = `(function process(request, response) {
87
87
  })(request, response);`
88
88
 
89
89
  export const toolDefinition: MCPToolDefinition = {
90
- name: "snow_schedule_script_job",
90
+ name: "snow_execute_script",
91
91
  description:
92
92
  "Execute server-side JavaScript on ServiceNow. Primary: synchronous execution via Scripted REST API (~1-3s). Fallback: scheduled job if endpoint unavailable. Auto-deploys the executor endpoint on first use. ES5 only (Rhino engine)!",
93
93
  category: "automation",
94
- subcategory: "scheduled-jobs",
94
+ subcategory: "script-execution",
95
95
  use_cases: ["automation", "scripts", "scheduled-jobs", "debugging", "verification"],
96
96
  complexity: "advanced",
97
97
  frequency: "high",
@@ -150,7 +150,7 @@ export const toolDefinition: MCPToolDefinition = {
150
150
 
151
151
  export async function execute(args: Record<string, unknown>, context: ServiceNowContext): Promise<ToolResult> {
152
152
  const script = args.script as string
153
- const description = (args.description as string) || "Script scheduled via snow_schedule_script_job"
153
+ const description = (args.description as string) || "Script executed via snow_execute_script"
154
154
  const timeout = (args.timeout as number) || 30000
155
155
  const validate = args.validate_es5 !== false
156
156
  const confirmation = args.requireConfirmation === true
@@ -46,7 +46,7 @@ export async function execute(args: any, context: ServiceNowContext): Promise<To
46
46
  const client = await getAuthenticatedClient(context)
47
47
 
48
48
  // Try to find the output in sys_properties
49
- // snow_schedule_script_job stores output as: SNOW_FLOW_EXEC_${executionId}
49
+ // snow_execute_script stores output as: SNOW_FLOW_EXEC_${executionId}
50
50
  const outputMarker = `SNOW_FLOW_EXEC_${execution_id}`
51
51
 
52
52
  const outputResponse = await client.get(
@@ -62,7 +62,7 @@ export async function execute(args: any, context: ServiceNowContext): Promise<To
62
62
  await client.delete(`/api/now/table/sys_properties/${property.sys_id}`)
63
63
  }
64
64
 
65
- // Organize output by level (matches snow_schedule_script_job format)
65
+ // Organize output by level (matches snow_execute_script format)
66
66
  const organizedOutput = {
67
67
  print: (scriptOutput.output || []).filter((o: any) => o.level === "print").map((o: any) => o.message),
68
68
  info: (scriptOutput.output || []).filter((o: any) => o.level === "info").map((o: any) => o.message),
@@ -27,7 +27,7 @@ export const toolDefinition: MCPToolDefinition = {
27
27
  • Message-level Headers - apply to ALL methods (list_message_headers, create_message_header, delete_message_header)
28
28
  • Method-level Headers - apply to specific method (list_method_headers, create_method_header, delete_method_header)
29
29
  • Query Parameters (list_parameters, create_parameter, delete_parameter)
30
- • Testing (test) - generates ES5-compatible test script for snow_schedule_script_job`,
30
+ • Testing (test) - generates ES5-compatible test script for snow_execute_script`,
31
31
  // Metadata for tool discovery (not sent to LLM)
32
32
  category: "integration",
33
33
  subcategory: "rest",
@@ -1448,11 +1448,11 @@ ${paramLines.length > 0 ? " " + paramLines.join("\n ") : " // No parame
1448
1448
  test_params_provided: test_params,
1449
1449
  test_script: testScript,
1450
1450
  usage: {
1451
- description: "Use snow_schedule_script_job to execute this test script",
1452
- example: `snow_schedule_script_job({ script: <test_script>, description: 'Test REST: ${restMessageName}' })`,
1451
+ description: "Use snow_execute_script to execute this test script",
1452
+ example: `snow_execute_script({ script: <test_script>, description: 'Test REST: ${restMessageName}' })`,
1453
1453
  manual_test: `In ServiceNow: System Web Services > Outbound > REST Message > ${restMessageName} > ${method.name} > Test`,
1454
1454
  },
1455
- note: "Direct REST message testing requires ServiceNow script execution. Copy the test_script and run it via snow_schedule_script_job.",
1455
+ note: "Direct REST message testing requires ServiceNow script execution. Copy the test_script and run it via snow_execute_script.",
1456
1456
  },
1457
1457
  { operation: "test_rest_message" },
1458
1458
  )