snow-flow 8.3.0 → 8.3.2

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/.env.example CHANGED
@@ -2,9 +2,18 @@
2
2
  # ServiceNow Configuration
3
3
  # ============================================
4
4
  SNOW_INSTANCE=your-instance.service-now.com
5
+
6
+ # Authentication Method 1: OAuth (recommended for production)
5
7
  SNOW_CLIENT_ID=your-client-id
6
8
  SNOW_CLIENT_SECRET=your-client-secret
7
9
 
10
+ # Authentication Method 2: Username/Password (simpler, for development)
11
+ # Use this if OAuth gives "No refresh token" errors
12
+ SNOW_USERNAME=your-username
13
+ SNOW_PASSWORD=your-password
14
+
15
+ # Note: MCP server will try OAuth first, then fall back to username/password
16
+
8
17
  # ============================================
9
18
  # LLM Provider Configuration (75+ Providers!)
10
19
  # ============================================
package/README.md CHANGED
@@ -95,6 +95,18 @@ snow-flow auth login
95
95
  3. **ServiceNow**: Browser opens for OAuth authentication
96
96
  4. **Done**: You're ready to develop!
97
97
 
98
+ ### OpenCode Setup
99
+
100
+ For detailed OpenCode configuration (MCP servers, environment variables, troubleshooting), see:
101
+
102
+ 📖 **[OPENCODE-SETUP.md](OPENCODE-SETUP.md)** - Complete OpenCode configuration guide
103
+
104
+ **Quick checklist:**
105
+ - ✅ Use `"environment"` (not `"env"`) in `opencode-config.json`
106
+ - ✅ Run `npm run build` to create `dist/` directory
107
+ - ✅ Verify MCP servers load when OpenCode starts
108
+ - ✅ Test tools actually execute (not just show code snippets)
109
+
98
110
  ### Start Developing
99
111
 
100
112
  ```bash
@@ -43,9 +43,13 @@ export declare class ServiceNowAuthManager {
43
43
  */
44
44
  getAccessToken(context: ServiceNowContext): Promise<string>;
45
45
  /**
46
- * Refresh access token using refresh token
46
+ * Refresh access token using refresh token OR username/password
47
47
  */
48
48
  private refreshAccessToken;
49
+ /**
50
+ * Authenticate using username and password (fallback method)
51
+ */
52
+ private authenticateWithPassword;
49
53
  /**
50
54
  * Check if cached token is still valid
51
55
  */
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/mcp/servicenow-mcp-unified/shared/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,EAAE,iBAAiB,EAAyC,MAAM,SAAS,CAAC;AAGnF,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACvD,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACjD,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACtE;AAYD;;GAEG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,OAAO,CAAyC;IACxD,OAAO,CAAC,oBAAoB,CAA2C;;IAYvE;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAkC7B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;OAEG;IACG,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA0ExF;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IA0BjE;;OAEG;YACW,kBAAkB;IA+DhC;;OAEG;IACH,OAAO,CAAC,YAAY;IAUpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAQnB;;OAEG;YACW,cAAc;IAuB5B;;OAEG;YACW,cAAc;IAqB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB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AC,mBAAmB;IAQ3B;;OAEG;IACG,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA0ExF;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IA0BjE;;OAEG;YACW,kBAAkB;IAyDhC;;OAEG;YACW,wBAAwB;IAkDtC;;OAEG;IACH,OAAO,CAAC,YAAY;IAUpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAQnB;;OAEG;YACW,cAAc;IAuB5B;;OAEG;YACW,cAAc;IAqB5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;OAEG;IACH,UAAU,IAAI,IAAI;IAMlB;;OAEG;IACH,aAAa;;;gBAIK,KAAK,CAAC;YAClB,WAAW,EAAE,MAAM,CAAC;YACpB,SAAS,EAAE,MAAM,CAAC;YAClB,KAAK,EAAE,OAAO,CAAC;SAChB,CAAC;;CAcP;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,uBAA8B,CAAC;AAEvD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,qBAAqB,CAAC,CAEhC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAEhF"}
@@ -200,55 +200,96 @@ class ServiceNowAuthManager {
200
200
  }
201
201
  }
202
202
  /**
203
- * Refresh access token using refresh token
203
+ * Refresh access token using refresh token OR username/password
204
204
  */
205
205
  async refreshAccessToken(context) {
206
206
  const cacheKey = this.getCacheKey(context.instanceUrl);
207
207
  console.log('[Auth] Refreshing access token for:', context.instanceUrl);
208
- try {
209
- // Get refresh token (from cache or context)
210
- let refreshToken = context.refreshToken;
211
- const cached = this.tokenCache.get(cacheKey);
212
- if (!refreshToken && cached) {
213
- refreshToken = cached.refreshToken;
208
+ // Try OAuth first if refresh token available
209
+ let refreshToken = context.refreshToken;
210
+ const cached = this.tokenCache.get(cacheKey);
211
+ if (!refreshToken && cached) {
212
+ refreshToken = cached.refreshToken;
213
+ }
214
+ if (refreshToken) {
215
+ try {
216
+ // OAuth token refresh request
217
+ const tokenUrl = `${context.instanceUrl}/oauth_token.do`;
218
+ const response = await axios_1.default.post(tokenUrl, new URLSearchParams({
219
+ grant_type: 'refresh_token',
220
+ client_id: context.clientId,
221
+ client_secret: context.clientSecret,
222
+ refresh_token: refreshToken
223
+ }), {
224
+ headers: {
225
+ 'Content-Type': 'application/x-www-form-urlencoded'
226
+ },
227
+ timeout: 10000
228
+ });
229
+ const tokenData = response.data;
230
+ // Cache tokens
231
+ const expiresAt = Date.now() + (tokenData.expires_in * 1000) - 60000; // 1 min buffer
232
+ this.tokenCache.set(cacheKey, {
233
+ accessToken: tokenData.access_token,
234
+ refreshToken: tokenData.refresh_token,
235
+ expiresAt,
236
+ instanceUrl: context.instanceUrl
237
+ });
238
+ // Persist to disk
239
+ await this.saveTokenCache();
240
+ console.log('[Auth] Access token refreshed successfully (OAuth)');
241
+ return tokenData.access_token;
214
242
  }
215
- if (!refreshToken) {
216
- throw new Error('No refresh token available');
243
+ catch (error) {
244
+ console.warn('[Auth] OAuth refresh failed, trying username/password...', error.message);
217
245
  }
218
- // OAuth token refresh request
219
- const tokenUrl = `${context.instanceUrl}/oauth_token.do`;
220
- const response = await axios_1.default.post(tokenUrl, new URLSearchParams({
221
- grant_type: 'refresh_token',
222
- client_id: context.clientId,
223
- client_secret: context.clientSecret,
224
- refresh_token: refreshToken
225
- }), {
226
- headers: {
227
- 'Content-Type': 'application/x-www-form-urlencoded'
228
- },
229
- timeout: 10000
230
- });
231
- const tokenData = response.data;
232
- // Cache tokens
233
- const expiresAt = Date.now() + (tokenData.expires_in * 1000) - 60000; // 1 min buffer
246
+ }
247
+ // Fallback to username/password authentication
248
+ return await this.authenticateWithPassword(context);
249
+ }
250
+ /**
251
+ * Authenticate using username and password (fallback method)
252
+ */
253
+ async authenticateWithPassword(context) {
254
+ const cacheKey = this.getCacheKey(context.instanceUrl);
255
+ try {
256
+ // Check if username/password available from environment
257
+ const username = process.env.SERVICENOW_USERNAME;
258
+ const password = process.env.SERVICENOW_PASSWORD;
259
+ if (!username || !password) {
260
+ throw new Error('No username/password available for basic authentication');
261
+ }
262
+ console.log('[Auth] Using username/password authentication');
263
+ // Create Basic Auth token
264
+ const basicAuth = Buffer.from(`${username}:${password}`).toString('base64');
265
+ const accessToken = `Basic ${basicAuth}`;
266
+ // Cache with long expiry (basic auth doesn't expire)
267
+ const expiresAt = Date.now() + (24 * 60 * 60 * 1000); // 24 hours
234
268
  this.tokenCache.set(cacheKey, {
235
- accessToken: tokenData.access_token,
236
- refreshToken: tokenData.refresh_token,
269
+ accessToken,
270
+ refreshToken: '', // No refresh token for basic auth
237
271
  expiresAt,
238
272
  instanceUrl: context.instanceUrl
239
273
  });
240
- // Persist to disk
241
- await this.saveTokenCache();
242
- console.log('[Auth] Access token refreshed successfully');
243
- return tokenData.access_token;
274
+ // Test the credentials with a simple API call
275
+ try {
276
+ await axios_1.default.get(`${context.instanceUrl}/api/now/table/sys_user?sysparm_limit=1`, {
277
+ headers: {
278
+ 'Authorization': accessToken,
279
+ 'Content-Type': 'application/json'
280
+ },
281
+ timeout: 10000
282
+ });
283
+ console.log('[Auth] Username/password authentication successful');
284
+ return accessToken;
285
+ }
286
+ catch (testError) {
287
+ throw new Error(`Username/password authentication failed: Invalid credentials`);
288
+ }
244
289
  }
245
290
  catch (error) {
246
- console.error('[Auth] Token refresh failed:', error.message);
247
- if (error.response) {
248
- console.error('[Auth] Response status:', error.response.status);
249
- console.error('[Auth] Response data:', error.response.data);
250
- }
251
- throw new Error(`OAuth token refresh failed: ${error.message}`);
291
+ console.error('[Auth] Username/password authentication failed:', error.message);
292
+ throw new Error(`Authentication failed: ${error.message}`);
252
293
  }
253
294
  }
254
295
  /**
@@ -1 +1 @@
1
- {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,CAAC,OAAO,CAAC,IAAI;YAChC,MAAM,EAAE,EAIN;SACH,CAAC;QAEF,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACrC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;YAC5D,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;gBAChB,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,SAAS;gBACT,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;aAC9B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAxZD,sDAwZC;AAED;;GAEG;AACU,QAAA,WAAW,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAEvD;;GAEG;AACI,KAAK,UAAU,sBAAsB,CAC1C,OAA0B;IAE1B,OAAO,MAAM,mBAAW,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,cAAc,CAAC,OAA0B;IAC7D,OAAO,MAAM,mBAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC"}
@@ -1,3 +1,3 @@
1
- export declare const AGENTS_MD_TEMPLATE = "# Snow-Flow - ServiceNow Development AI Agent\n\n## What is Snow-Flow?\n\n**Snow-Flow** is an AI-powered ServiceNow development framework that provides **370+ MCP tools** to automate ServiceNow development, configuration, and administration. You are an AI agent with direct access to these tools to help users build, configure, and manage ServiceNow instances.\n\n## Your Purpose\n\nYou help users:\n- **Develop** ServiceNow artifacts (widgets, business rules, UI pages, flows, etc.)\n- **Configure** ServiceNow instances (properties, update sets, integrations)\n- **Automate** tasks (scripts, workflows, scheduled jobs)\n- **Analyze** data (incidents, reports, performance analytics)\n\n**Key Principle:** Always use MCP tools directly - they are JavaScript functions, NOT CLI commands!\n\n---\n\n## \uD83D\uDEA8 THE GOLDEN RULE: UPDATE SET WORKFLOW\n\n**EVERY ServiceNow development task MUST follow this workflow:**\n\n```javascript\n// 1. CREATE UPDATE SET (before ANY development!)\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: [Descriptive Name]\",\n description: \"What you're building and why\",\n application: \"global\"\n});\n\n// 2. VERIFY UPDATE SET IS ACTIVE\nconst current = await snow_update_set_query({ action: 'current' });\nconsole.log('Active Update Set:', current.name);\n\n// 3. NOW DEVELOP (all changes auto-tracked)\nawait snow_deploy({\n type: 'widget',\n config: { name: 'my_widget', ... }\n});\n\n// 4. COMPLETE UPDATE SET when done\nawait snow_update_set_manage({\n action: 'complete',\n update_set_id: updateSet.sys_id\n});\n```\n\n### Update Set Rules:\n- \u2705 **ONE feature = ONE update set** (clear scope)\n- \u2705 **Create BEFORE any development** (not after!)\n- \u2705 **Descriptive names:** \"Feature: X\" or \"Fix: Y\", NOT \"Changes\"\n- \u2705 **Verify it's active** before making changes\n- \u2705 **All changes tracked** automatically in active update set\n\n---\n\n## Core MCP Tools (v8.2.0)\n\n### Update Set Management (MANDATORY!)\n```javascript\n// Merged tools - use 'action' parameter:\nsnow_update_set_manage({ action: 'create' }) // Create new update set\nsnow_update_set_manage({ action: 'complete' }) // Mark as complete\nsnow_update_set_manage({ action: 'export' }) // Export to XML\nsnow_update_set_query({ action: 'current' }) // Get current active\nsnow_update_set_query({ action: 'list' }) // List all update sets\nsnow_ensure_active_update_set({ sys_id }) // Ensure specific set is active\n```\n\n### Record Operations\n```javascript\nsnow_record_manage({ action: 'create', table, data }) // Create record\nsnow_record_manage({ action: 'update', sys_id, data }) // Update record\nsnow_record_manage({ action: 'delete', sys_id }) // Delete record\nsnow_query_table({ table, query, fields }) // Query any table\nsnow_get_by_sysid({ table, sys_id }) // Get specific record\n```\n\n### Development & Deployment\n```javascript\nsnow_deploy({ type, config }) // Deploy widgets, pages, etc.\nsnow_create_business_rule({ name, table, script }) // Business rules\nsnow_create_script_include({ name, script }) // Script includes\nsnow_create_client_script({ name, table, script }) // Client scripts\nsnow_create_ui_policy({ name, table, conditions }) // UI policies\n```\n\n### Widget Development (CRITICAL!)\n```javascript\n// ALWAYS use local sync for widgets - NEVER snow_query_table!\nsnow_pull_artifact({ sys_id, table: 'sp_widget' }) // Pull to local files\n// ... edit locally with native tools ...\nsnow_push_artifact({ sys_id }) // Push back to ServiceNow\n```\n\n### Change Management\n```javascript\nsnow_change_manage({ action: 'create', ... }) // Create change\nsnow_change_manage({ action: 'approve', ... }) // Approve change\nsnow_change_query({ action: 'search', ... }) // Search changes\n```\n\n### Knowledge Management\n```javascript\nsnow_knowledge_article_manage({ action: 'create' }) // Create article\nsnow_knowledge_article_manage({ action: 'publish' }) // Publish article\nsnow_knowledge_article_manage({ action: 'search' }) // Search articles\n```\n\n### Performance Analytics\n```javascript\nsnow_pa_create({ action: 'indicator', ... }) // Create PA indicator\nsnow_pa_operate({ action: 'collect_data', ... }) // Collect PA data\nsnow_pa_discover({ action: 'indicators' }) // Discover indicators\n```\n\n### UI Builder\n```javascript\nsnow_create_uib_page({ name, title }) // Create UIB page\nsnow_uib_component_manage({ action: 'create' }) // Create component\nsnow_add_uib_page_element({ page_sys_id, component }) // Add element\n```\n\n### Workspace\n```javascript\nsnow_create_complete_workspace({ workspace_name, tables }) // Complete workspace\nsnow_create_workspace_tab({ workspace, tab_config }) // Add tab\n```\n\n### Automation & Scripts\n```javascript\nsnow_execute_script_with_output({ script }) // Test/verify scripts (ES5 ONLY!)\nsnow_schedule_job({ name, script, interval }) // Scheduled jobs\nsnow_get_logs({ filter }) // View system logs\n```\n\n### System Properties\n```javascript\nsnow_property_manage({ action: 'get', name }) // Get property\nsnow_property_manage({ action: 'set', name, value }) // Set property\nsnow_property_query({ action: 'list', pattern }) // List properties\n```\n\n---\n\n## Critical Rules\n\n### 1. ES5 JavaScript Only (ServiceNow Rhino Engine)\n**NEVER USE:**\n- \u274C `const` / `let` (use `var`)\n- \u274C Arrow functions `() => {}` (use `function() {}`)\n- \u274C Template literals \\`${}\\` (use string concatenation `+`)\n- \u274C Destructuring `{a, b} = obj` (use `obj.a`, `obj.b`)\n- \u274C `for...of` loops (use traditional `for` loops)\n\n**ALWAYS USE ES5:**\n```javascript\nvar data = []; // NOT const or let\nfunction process() { return 'result'; } // NOT arrow functions\nvar msg = 'Hello ' + name; // NOT template literals\nfor (var i = 0; i < items.length; i++) { } // NOT for...of\n```\n\n### 2. Widget Debugging = Local Sync\n**ALWAYS use `snow_pull_artifact` for widgets** - NEVER `snow_query_table`!\n- Widget too large? \u2192 `snow_pull_artifact`\n- Widget not working? \u2192 `snow_pull_artifact`\n- Need to edit widget? \u2192 `snow_pull_artifact`\n\n### 3. MCP Tools Are Functions\n**MCP tools are JavaScript functions** - call them directly!\n```javascript\n// \u2705 CORRECT\nawait snow_create_ui_page({ name: \"dashboard\", html: \"...\" });\n\n// \u274C WRONG - DO NOT USE BASH!\n// node dist/index.js mcp execute ... // DOES NOT EXIST!\n// npx snow-flow-mcp-client ... // DOES NOT EXIST!\n```\n\n### 4. No Mock Data\n- **FORBIDDEN:** Placeholders, TODOs, \"this would normally...\", test values\n- **REQUIRED:** Complete, production-ready, fully functional code\n\n### 5. Verify First\n- Test before claiming something is broken\n- Check if resources exist before modifying\n- Use `snow_execute_script_with_output` to verify\n\n---\n\n## The Universal Workflow\n\n**Every task follows this pattern:**\n\n1. **\uD83D\uDCE6 UPDATE SET FIRST**\n - `snow_update_set_manage({ action: 'create', ... })`\n - `snow_update_set_query({ action: 'current' })` to verify\n\n2. **\uD83D\uDD0D USE RIGHT TOOL**\n - Creating? \u2192 `snow_create_*` or `snow_deploy`\n - Updating? \u2192 `snow_record_manage({ action: 'update' })`\n - Querying? \u2192 `snow_query_table` or specific query tool\n - Widget? \u2192 `snow_pull_artifact` (local sync!)\n\n3. **\u2705 VERIFY**\n - `snow_execute_script_with_output` for testing\n - Check logs with `snow_get_logs`\n - Validate with `snow_update_set_query({ action: 'current' })`\n\n4. **\u2714\uFE0F COMPLETE**\n - `snow_update_set_manage({ action: 'complete' })`\n\n---\n\n## Quick Reference\n\n| Task | Tool | Notes |\n|------|------|-------|\n| Create update set | `snow_update_set_manage({ action: 'create' })` | **DO THIS FIRST!** |\n| Create widget | `snow_deploy({ type: 'widget' })` | After update set |\n| Fix widget | `snow_pull_artifact({ sys_id })` | Local sync |\n| Create business rule | `snow_create_business_rule()` | ES5 only! |\n| Query incidents | `snow_query_incidents()` | Specialized tool |\n| Get property | `snow_property_manage({ action: 'get' })` | System properties |\n| Test script | `snow_execute_script_with_output()` | ES5 verification |\n| Complete work | `snow_update_set_manage({ action: 'complete' })` | **DO THIS LAST!** |\n\n---\n\n**Remember:** Update Set \u2192 Tool \u2192 Verify \u2192 Complete. Every. Single. Time.\n";
1
+ export declare const AGENTS_MD_TEMPLATE = "# Snow-Flow - ServiceNow Development AI Agent\n\n## \uD83D\uDEA8 CRITICAL: YOU MUST ACTUALLY CALL THE TOOLS!\n\n**MCP tools are JavaScript functions that you MUST call directly!**\n\n```javascript\n// \u2705 CORRECT - Actually call the function:\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: Incident Dashboard\"\n});\n// This EXECUTES the tool and returns real data from ServiceNow\n\n// \u274C WRONG - Just showing code without calling it:\nconsole.log(\"I will create an update set like this:\");\nconsole.log(`await snow_update_set_manage({ action: 'create' });`);\n// This does NOTHING - it's just a string!\n```\n\n**If you show code examples without calling tools, you are FAILING your task!**\n\nThe user wants you to:\n- \u2705 **Actually execute tools** and get real results\n- \u2705 **Make real changes** in their ServiceNow instance\n- \u274C **NOT just show code examples** or explain what you \"would\" do\n\n---\n\n## What is Snow-Flow?\n\n**Snow-Flow** is an AI-powered ServiceNow development framework that provides **370+ MCP tools** to automate ServiceNow development, configuration, and administration. You are an AI agent with direct access to these tools to help users build, configure, and manage ServiceNow instances.\n\n## Your Purpose\n\nYou help users:\n- **Develop** ServiceNow artifacts (widgets, business rules, UI pages, flows, etc.)\n- **Configure** ServiceNow instances (properties, update sets, integrations)\n- **Automate** tasks (scripts, workflows, scheduled jobs)\n- **Analyze** data (incidents, reports, performance analytics)\n\n**Remember:** These tools are AVAILABLE and WORKING - just call them!\n\n---\n\n## \uD83D\uDEA8 THE GOLDEN RULE: UPDATE SET WORKFLOW\n\n**EVERY ServiceNow development task MUST follow this workflow:**\n\n```javascript\n// 1. CREATE UPDATE SET (before ANY development!)\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: [Descriptive Name]\",\n description: \"What you're building and why\",\n application: \"global\"\n});\n\n// 2. VERIFY UPDATE SET IS ACTIVE\nconst current = await snow_update_set_query({ action: 'current' });\nconsole.log('Active Update Set:', current.name);\n\n// 3. NOW DEVELOP (all changes auto-tracked)\nawait snow_deploy({\n type: 'widget',\n config: { name: 'my_widget', ... }\n});\n\n// 4. COMPLETE UPDATE SET when done\nawait snow_update_set_manage({\n action: 'complete',\n update_set_id: updateSet.sys_id\n});\n```\n\n### Update Set Rules:\n- \u2705 **ONE feature = ONE update set** (clear scope)\n- \u2705 **Create BEFORE any development** (not after!)\n- \u2705 **Descriptive names:** \"Feature: X\" or \"Fix: Y\", NOT \"Changes\"\n- \u2705 **Verify it's active** before making changes\n- \u2705 **All changes tracked** automatically in active update set\n\n---\n\n## Core MCP Tools (v8.2.0)\n\n### Update Set Management (MANDATORY!)\n```javascript\n// Merged tools - use 'action' parameter:\nsnow_update_set_manage({ action: 'create' }) // Create new update set\nsnow_update_set_manage({ action: 'complete' }) // Mark as complete\nsnow_update_set_manage({ action: 'export' }) // Export to XML\nsnow_update_set_query({ action: 'current' }) // Get current active\nsnow_update_set_query({ action: 'list' }) // List all update sets\nsnow_ensure_active_update_set({ sys_id }) // Ensure specific set is active\n```\n\n### Record Operations\n```javascript\nsnow_record_manage({ action: 'create', table, data }) // Create record\nsnow_record_manage({ action: 'update', sys_id, data }) // Update record\nsnow_record_manage({ action: 'delete', sys_id }) // Delete record\nsnow_query_table({ table, query, fields }) // Query any table\nsnow_get_by_sysid({ table, sys_id }) // Get specific record\n```\n\n### Development & Deployment\n```javascript\nsnow_deploy({ type, config }) // Deploy widgets, pages, etc.\nsnow_create_business_rule({ name, table, script }) // Business rules\nsnow_create_script_include({ name, script }) // Script includes\nsnow_create_client_script({ name, table, script }) // Client scripts\nsnow_create_ui_policy({ name, table, conditions }) // UI policies\n```\n\n### Widget Development (CRITICAL!)\n```javascript\n// ALWAYS use local sync for widgets - NEVER snow_query_table!\nsnow_pull_artifact({ sys_id, table: 'sp_widget' }) // Pull to local files\n// ... edit locally with native tools ...\nsnow_push_artifact({ sys_id }) // Push back to ServiceNow\n```\n\n### Change Management\n```javascript\nsnow_change_manage({ action: 'create', ... }) // Create change\nsnow_change_manage({ action: 'approve', ... }) // Approve change\nsnow_change_query({ action: 'search', ... }) // Search changes\n```\n\n### Knowledge Management\n```javascript\nsnow_knowledge_article_manage({ action: 'create' }) // Create article\nsnow_knowledge_article_manage({ action: 'publish' }) // Publish article\nsnow_knowledge_article_manage({ action: 'search' }) // Search articles\n```\n\n### Performance Analytics\n```javascript\nsnow_pa_create({ action: 'indicator', ... }) // Create PA indicator\nsnow_pa_operate({ action: 'collect_data', ... }) // Collect PA data\nsnow_pa_discover({ action: 'indicators' }) // Discover indicators\n```\n\n### UI Builder\n```javascript\nsnow_create_uib_page({ name, title }) // Create UIB page\nsnow_uib_component_manage({ action: 'create' }) // Create component\nsnow_add_uib_page_element({ page_sys_id, component }) // Add element\n```\n\n### Workspace\n```javascript\nsnow_create_complete_workspace({ workspace_name, tables }) // Complete workspace\nsnow_create_workspace_tab({ workspace, tab_config }) // Add tab\n```\n\n### Automation & Scripts\n```javascript\nsnow_execute_script_with_output({ script }) // Test/verify scripts (ES5 ONLY!)\nsnow_schedule_job({ name, script, interval }) // Scheduled jobs\nsnow_get_logs({ filter }) // View system logs\n```\n\n### System Properties\n```javascript\nsnow_property_manage({ action: 'get', name }) // Get property\nsnow_property_manage({ action: 'set', name, value }) // Set property\nsnow_property_query({ action: 'list', pattern }) // List properties\n```\n\n---\n\n## Critical Rules\n\n### 1. ES5 JavaScript Only (ServiceNow Rhino Engine)\n**NEVER USE:**\n- \u274C `const` / `let` (use `var`)\n- \u274C Arrow functions `() => {}` (use `function() {}`)\n- \u274C Template literals \\`${}\\` (use string concatenation `+`)\n- \u274C Destructuring `{a, b} = obj` (use `obj.a`, `obj.b`)\n- \u274C `for...of` loops (use traditional `for` loops)\n\n**ALWAYS USE ES5:**\n```javascript\nvar data = []; // NOT const or let\nfunction process() { return 'result'; } // NOT arrow functions\nvar msg = 'Hello ' + name; // NOT template literals\nfor (var i = 0; i < items.length; i++) { } // NOT for...of\n```\n\n### 2. Widget Debugging = Local Sync\n**ALWAYS use `snow_pull_artifact` for widgets** - NEVER `snow_query_table`!\n- Widget too large? \u2192 `snow_pull_artifact`\n- Widget not working? \u2192 `snow_pull_artifact`\n- Need to edit widget? \u2192 `snow_pull_artifact`\n\n### 3. MCP Tools Are Functions\n**MCP tools are JavaScript functions** - call them directly!\n```javascript\n// \u2705 CORRECT\nawait snow_create_ui_page({ name: \"dashboard\", html: \"...\" });\n\n// \u274C WRONG - DO NOT USE BASH!\n// node dist/index.js mcp execute ... // DOES NOT EXIST!\n// npx snow-flow-mcp-client ... // DOES NOT EXIST!\n```\n\n### 4. No Mock Data\n- **FORBIDDEN:** Placeholders, TODOs, \"this would normally...\", test values\n- **REQUIRED:** Complete, production-ready, fully functional code\n\n### 5. Verify First\n- Test before claiming something is broken\n- Check if resources exist before modifying\n- Use `snow_execute_script_with_output` to verify\n\n---\n\n## The Universal Workflow\n\n**Every task follows this pattern:**\n\n1. **\uD83D\uDCE6 UPDATE SET FIRST**\n - `snow_update_set_manage({ action: 'create', ... })`\n - `snow_update_set_query({ action: 'current' })` to verify\n\n2. **\uD83D\uDD0D USE RIGHT TOOL**\n - Creating? \u2192 `snow_create_*` or `snow_deploy`\n - Updating? \u2192 `snow_record_manage({ action: 'update' })`\n - Querying? \u2192 `snow_query_table` or specific query tool\n - Widget? \u2192 `snow_pull_artifact` (local sync!)\n\n3. **\u2705 VERIFY**\n - `snow_execute_script_with_output` for testing\n - Check logs with `snow_get_logs`\n - Validate with `snow_update_set_query({ action: 'current' })`\n\n4. **\u2714\uFE0F COMPLETE**\n - `snow_update_set_manage({ action: 'complete' })`\n\n---\n\n## Quick Reference\n\n| Task | Tool | Notes |\n|------|------|-------|\n| Create update set | `snow_update_set_manage({ action: 'create' })` | **DO THIS FIRST!** |\n| Create widget | `snow_deploy({ type: 'widget' })` | After update set |\n| Fix widget | `snow_pull_artifact({ sys_id })` | Local sync |\n| Create business rule | `snow_create_business_rule()` | ES5 only! |\n| Query incidents | `snow_query_incidents()` | Specialized tool |\n| Get property | `snow_property_manage({ action: 'get' })` | System properties |\n| Test script | `snow_execute_script_with_output()` | ES5 verification |\n| Complete work | `snow_update_set_manage({ action: 'complete' })` | **DO THIS LAST!** |\n\n---\n\n**Remember:** Update Set \u2192 Tool \u2192 Verify \u2192 Complete. Every. Single. Time.\n";
2
2
  export declare const AGENTS_MD_TEMPLATE_VERSION = "8.3.0-ENTERPRISE-THEMES";
3
3
  //# sourceMappingURL=agents-md-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents-md-template.d.ts","sourceRoot":"","sources":["../../src/templates/agents-md-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,skRAwO9B,CAAC;AAEF,eAAO,MAAM,0BAA0B,4BAA4B,CAAC"}
1
+ {"version":3,"file":"agents-md-template.d.ts","sourceRoot":"","sources":["../../src/templates/agents-md-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,u8SAmQ9B,CAAC;AAEF,eAAO,MAAM,0BAA0B,4BAA4B,CAAC"}
@@ -3,6 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AGENTS_MD_TEMPLATE_VERSION = exports.AGENTS_MD_TEMPLATE = void 0;
4
4
  exports.AGENTS_MD_TEMPLATE = `# Snow-Flow - ServiceNow Development AI Agent
5
5
 
6
+ ## 🚨 CRITICAL: YOU MUST ACTUALLY CALL THE TOOLS!
7
+
8
+ **MCP tools are JavaScript functions that you MUST call directly!**
9
+
10
+ \`\`\`javascript
11
+ // ✅ CORRECT - Actually call the function:
12
+ const updateSet = await snow_update_set_manage({
13
+ action: 'create',
14
+ name: "Feature: Incident Dashboard"
15
+ });
16
+ // This EXECUTES the tool and returns real data from ServiceNow
17
+
18
+ // ❌ WRONG - Just showing code without calling it:
19
+ console.log("I will create an update set like this:");
20
+ console.log(\`await snow_update_set_manage({ action: 'create' });\`);
21
+ // This does NOTHING - it's just a string!
22
+ \`\`\`
23
+
24
+ **If you show code examples without calling tools, you are FAILING your task!**
25
+
26
+ The user wants you to:
27
+ - ✅ **Actually execute tools** and get real results
28
+ - ✅ **Make real changes** in their ServiceNow instance
29
+ - ❌ **NOT just show code examples** or explain what you "would" do
30
+
31
+ ---
32
+
6
33
  ## What is Snow-Flow?
7
34
 
8
35
  **Snow-Flow** is an AI-powered ServiceNow development framework that provides **370+ MCP tools** to automate ServiceNow development, configuration, and administration. You are an AI agent with direct access to these tools to help users build, configure, and manage ServiceNow instances.
@@ -15,7 +42,7 @@ You help users:
15
42
  - **Automate** tasks (scripts, workflows, scheduled jobs)
16
43
  - **Analyze** data (incidents, reports, performance analytics)
17
44
 
18
- **Key Principle:** Always use MCP tools directly - they are JavaScript functions, NOT CLI commands!
45
+ **Remember:** These tools are AVAILABLE and WORKING - just call them!
19
46
 
20
47
  ---
21
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"agents-md-template.js","sourceRoot":"","sources":["../../src/templates/agents-md-template.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwOjC,CAAC;AAEW,QAAA,0BAA0B,GAAG,yBAAyB,CAAC"}
1
+ {"version":3,"file":"agents-md-template.js","sourceRoot":"","sources":["../../src/templates/agents-md-template.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmQjC,CAAC;AAEW,QAAA,0BAA0B,GAAG,yBAAyB,CAAC"}
@@ -1,3 +1,3 @@
1
- export declare const CLAUDE_MD_TEMPLATE = "# Snow-Flow - ServiceNow Development AI Agent\n\n## What is Snow-Flow?\n\n**Snow-Flow** is an AI-powered ServiceNow development framework that provides **370+ MCP tools** to automate ServiceNow development, configuration, and administration. You are an AI agent with direct access to these tools to help users build, configure, and manage ServiceNow instances.\n\n## Your Purpose\n\nYou help users:\n- **Develop** ServiceNow artifacts (widgets, business rules, UI pages, flows, etc.)\n- **Configure** ServiceNow instances (properties, update sets, integrations)\n- **Automate** tasks (scripts, workflows, scheduled jobs)\n- **Analyze** data (incidents, reports, performance analytics)\n\n**Key Principle:** Always use MCP tools directly - they are JavaScript functions, NOT CLI commands!\n\n---\n\n## \uD83D\uDEA8 THE GOLDEN RULE: UPDATE SET WORKFLOW\n\n**EVERY ServiceNow development task MUST follow this workflow:**\n\n```javascript\n// 1. CREATE UPDATE SET (before ANY development!)\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: [Descriptive Name]\",\n description: \"What you're building and why\",\n application: \"global\"\n});\n\n// 2. VERIFY UPDATE SET IS ACTIVE\nconst current = await snow_update_set_query({ action: 'current' });\nconsole.log('Active Update Set:', current.name);\n\n// 3. NOW DEVELOP (all changes auto-tracked)\nawait snow_deploy({\n type: 'widget',\n config: { name: 'my_widget', ... }\n});\n\n// 4. COMPLETE UPDATE SET when done\nawait snow_update_set_manage({\n action: 'complete',\n update_set_id: updateSet.sys_id\n});\n```\n\n### Update Set Rules:\n- \u2705 **ONE feature = ONE update set** (clear scope)\n- \u2705 **Create BEFORE any development** (not after!)\n- \u2705 **Descriptive names:** \"Feature: X\" or \"Fix: Y\", NOT \"Changes\"\n- \u2705 **Verify it's active** before making changes\n- \u2705 **All changes tracked** automatically in active update set\n\n---\n\n## Core MCP Tools (v8.2.0)\n\n### Update Set Management (MANDATORY!)\n```javascript\n// Merged tools - use 'action' parameter:\nsnow_update_set_manage({ action: 'create' }) // Create new update set\nsnow_update_set_manage({ action: 'complete' }) // Mark as complete\nsnow_update_set_manage({ action: 'export' }) // Export to XML\nsnow_update_set_query({ action: 'current' }) // Get current active\nsnow_update_set_query({ action: 'list' }) // List all update sets\nsnow_ensure_active_update_set({ sys_id }) // Ensure specific set is active\n```\n\n### Record Operations\n```javascript\nsnow_record_manage({ action: 'create', table, data }) // Create record\nsnow_record_manage({ action: 'update', sys_id, data }) // Update record\nsnow_record_manage({ action: 'delete', sys_id }) // Delete record\nsnow_query_table({ table, query, fields }) // Query any table\nsnow_get_by_sysid({ table, sys_id }) // Get specific record\n```\n\n### Development & Deployment\n```javascript\nsnow_deploy({ type, config }) // Deploy widgets, pages, etc.\nsnow_create_business_rule({ name, table, script }) // Business rules\nsnow_create_script_include({ name, script }) // Script includes\nsnow_create_client_script({ name, table, script }) // Client scripts\nsnow_create_ui_policy({ name, table, conditions }) // UI policies\n```\n\n### Widget Development (CRITICAL!)\n```javascript\n// ALWAYS use local sync for widgets - NEVER snow_query_table!\nsnow_pull_artifact({ sys_id, table: 'sp_widget' }) // Pull to local files\n// ... edit locally with native tools ...\nsnow_push_artifact({ sys_id }) // Push back to ServiceNow\n```\n\n### Change Management\n```javascript\nsnow_change_manage({ action: 'create', ... }) // Create change\nsnow_change_manage({ action: 'approve', ... }) // Approve change\nsnow_change_query({ action: 'search', ... }) // Search changes\n```\n\n### Knowledge Management\n```javascript\nsnow_knowledge_article_manage({ action: 'create' }) // Create article\nsnow_knowledge_article_manage({ action: 'publish' }) // Publish article\nsnow_knowledge_article_manage({ action: 'search' }) // Search articles\n```\n\n### Performance Analytics\n```javascript\nsnow_pa_create({ action: 'indicator', ... }) // Create PA indicator\nsnow_pa_operate({ action: 'collect_data', ... }) // Collect PA data\nsnow_pa_discover({ action: 'indicators' }) // Discover indicators\n```\n\n### UI Builder\n```javascript\nsnow_create_uib_page({ name, title }) // Create UIB page\nsnow_uib_component_manage({ action: 'create' }) // Create component\nsnow_add_uib_page_element({ page_sys_id, component }) // Add element\n```\n\n### Workspace\n```javascript\nsnow_create_complete_workspace({ workspace_name, tables }) // Complete workspace\nsnow_create_workspace_tab({ workspace, tab_config }) // Add tab\n```\n\n### Automation & Scripts\n```javascript\nsnow_execute_script_with_output({ script }) // Test/verify scripts (ES5 ONLY!)\nsnow_schedule_job({ name, script, interval }) // Scheduled jobs\nsnow_get_logs({ filter }) // View system logs\n```\n\n### System Properties\n```javascript\nsnow_property_manage({ action: 'get', name }) // Get property\nsnow_property_manage({ action: 'set', name, value }) // Set property\nsnow_property_query({ action: 'list', pattern }) // List properties\n```\n\n---\n\n## Critical Rules\n\n### 1. ES5 JavaScript Only (ServiceNow Rhino Engine)\n**NEVER USE:**\n- \u274C `const` / `let` (use `var`)\n- \u274C Arrow functions `() => {}` (use `function() {}`)\n- \u274C Template literals \\`${}\\` (use string concatenation `+`)\n- \u274C Destructuring `{a, b} = obj` (use `obj.a`, `obj.b`)\n- \u274C `for...of` loops (use traditional `for` loops)\n\n**ALWAYS USE ES5:**\n```javascript\nvar data = []; // NOT const or let\nfunction process() { return 'result'; } // NOT arrow functions\nvar msg = 'Hello ' + name; // NOT template literals\nfor (var i = 0; i < items.length; i++) { } // NOT for...of\n```\n\n### 2. Widget Debugging = Local Sync\n**ALWAYS use `snow_pull_artifact` for widgets** - NEVER `snow_query_table`!\n- Widget too large? \u2192 `snow_pull_artifact`\n- Widget not working? \u2192 `snow_pull_artifact`\n- Need to edit widget? \u2192 `snow_pull_artifact`\n\n### 3. MCP Tools Are Functions\n**MCP tools are JavaScript functions** - call them directly!\n```javascript\n// \u2705 CORRECT\nawait snow_create_ui_page({ name: \"dashboard\", html: \"...\" });\n\n// \u274C WRONG - DO NOT USE BASH!\n// node dist/index.js mcp execute ... // DOES NOT EXIST!\n// npx snow-flow-mcp-client ... // DOES NOT EXIST!\n```\n\n### 4. No Mock Data\n- **FORBIDDEN:** Placeholders, TODOs, \"this would normally...\", test values\n- **REQUIRED:** Complete, production-ready, fully functional code\n\n### 5. Verify First\n- Test before claiming something is broken\n- Check if resources exist before modifying\n- Use `snow_execute_script_with_output` to verify\n\n---\n\n## The Universal Workflow\n\n**Every task follows this pattern:**\n\n1. **\uD83D\uDCE6 UPDATE SET FIRST**\n - `snow_update_set_manage({ action: 'create', ... })`\n - `snow_update_set_query({ action: 'current' })` to verify\n\n2. **\uD83D\uDD0D USE RIGHT TOOL**\n - Creating? \u2192 `snow_create_*` or `snow_deploy`\n - Updating? \u2192 `snow_record_manage({ action: 'update' })`\n - Querying? \u2192 `snow_query_table` or specific query tool\n - Widget? \u2192 `snow_pull_artifact` (local sync!)\n\n3. **\u2705 VERIFY**\n - `snow_execute_script_with_output` for testing\n - Check logs with `snow_get_logs`\n - Validate with `snow_update_set_query({ action: 'current' })`\n\n4. **\u2714\uFE0F COMPLETE**\n - `snow_update_set_manage({ action: 'complete' })`\n\n---\n\n## Skills & Advanced Features\n\n**Skills** are specialized capabilities you can invoke for complex tasks:\n- Use the Skill tool when available for specialized workflows\n- Skills are invoked by name only (no arguments)\n- Check available_skills in your environment\n\n---\n\n## Quick Reference\n\n| Task | Tool | Notes |\n|------|------|-------|\n| Create update set | `snow_update_set_manage({ action: 'create' })` | **DO THIS FIRST!** |\n| Create widget | `snow_deploy({ type: 'widget' })` | After update set |\n| Fix widget | `snow_pull_artifact({ sys_id })` | Local sync |\n| Create business rule | `snow_create_business_rule()` | ES5 only! |\n| Query incidents | `snow_query_incidents()` | Specialized tool |\n| Get property | `snow_property_manage({ action: 'get' })` | System properties |\n| Test script | `snow_execute_script_with_output()` | ES5 verification |\n| Complete work | `snow_update_set_manage({ action: 'complete' })` | **DO THIS LAST!** |\n\n---\n\n**Remember:** Update Set \u2192 Tool \u2192 Verify \u2192 Complete. Every. Single. Time.\n";
1
+ export declare const CLAUDE_MD_TEMPLATE = "# Snow-Flow - ServiceNow Development AI Agent\n\n## \uD83D\uDEA8 CRITICAL: YOU MUST ACTUALLY CALL THE TOOLS!\n\n**MCP tools are JavaScript functions that you MUST call directly!**\n\n```javascript\n// \u2705 CORRECT - Actually call the function:\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: Incident Dashboard\"\n});\n// This EXECUTES the tool and returns real data from ServiceNow\n\n// \u274C WRONG - Just showing code without calling it:\nconsole.log(\"I will create an update set like this:\");\nconsole.log(`await snow_update_set_manage({ action: 'create' });`);\n// This does NOTHING - it's just a string!\n```\n\n**If you show code examples without calling tools, you are FAILING your task!**\n\nThe user wants you to:\n- \u2705 **Actually execute tools** and get real results\n- \u2705 **Make real changes** in their ServiceNow instance\n- \u274C **NOT just show code examples** or explain what you \"would\" do\n\n---\n\n## What is Snow-Flow?\n\n**Snow-Flow** is an AI-powered ServiceNow development framework that provides **370+ MCP tools** to automate ServiceNow development, configuration, and administration. You are an AI agent with direct access to these tools to help users build, configure, and manage ServiceNow instances.\n\n## Your Purpose\n\nYou help users:\n- **Develop** ServiceNow artifacts (widgets, business rules, UI pages, flows, etc.)\n- **Configure** ServiceNow instances (properties, update sets, integrations)\n- **Automate** tasks (scripts, workflows, scheduled jobs)\n- **Analyze** data (incidents, reports, performance analytics)\n\n**Remember:** These tools are AVAILABLE and WORKING - just call them!\n\n---\n\n## \uD83D\uDEA8 THE GOLDEN RULE: UPDATE SET WORKFLOW\n\n**EVERY ServiceNow development task MUST follow this workflow:**\n\n```javascript\n// 1. CREATE UPDATE SET (before ANY development!)\nconst updateSet = await snow_update_set_manage({\n action: 'create',\n name: \"Feature: [Descriptive Name]\",\n description: \"What you're building and why\",\n application: \"global\"\n});\n\n// 2. VERIFY UPDATE SET IS ACTIVE\nconst current = await snow_update_set_query({ action: 'current' });\nconsole.log('Active Update Set:', current.name);\n\n// 3. NOW DEVELOP (all changes auto-tracked)\nawait snow_deploy({\n type: 'widget',\n config: { name: 'my_widget', ... }\n});\n\n// 4. COMPLETE UPDATE SET when done\nawait snow_update_set_manage({\n action: 'complete',\n update_set_id: updateSet.sys_id\n});\n```\n\n### Update Set Rules:\n- \u2705 **ONE feature = ONE update set** (clear scope)\n- \u2705 **Create BEFORE any development** (not after!)\n- \u2705 **Descriptive names:** \"Feature: X\" or \"Fix: Y\", NOT \"Changes\"\n- \u2705 **Verify it's active** before making changes\n- \u2705 **All changes tracked** automatically in active update set\n\n---\n\n## Core MCP Tools (v8.2.0)\n\n### Update Set Management (MANDATORY!)\n```javascript\n// Merged tools - use 'action' parameter:\nsnow_update_set_manage({ action: 'create' }) // Create new update set\nsnow_update_set_manage({ action: 'complete' }) // Mark as complete\nsnow_update_set_manage({ action: 'export' }) // Export to XML\nsnow_update_set_query({ action: 'current' }) // Get current active\nsnow_update_set_query({ action: 'list' }) // List all update sets\nsnow_ensure_active_update_set({ sys_id }) // Ensure specific set is active\n```\n\n### Record Operations\n```javascript\nsnow_record_manage({ action: 'create', table, data }) // Create record\nsnow_record_manage({ action: 'update', sys_id, data }) // Update record\nsnow_record_manage({ action: 'delete', sys_id }) // Delete record\nsnow_query_table({ table, query, fields }) // Query any table\nsnow_get_by_sysid({ table, sys_id }) // Get specific record\n```\n\n### Development & Deployment\n```javascript\nsnow_deploy({ type, config }) // Deploy widgets, pages, etc.\nsnow_create_business_rule({ name, table, script }) // Business rules\nsnow_create_script_include({ name, script }) // Script includes\nsnow_create_client_script({ name, table, script }) // Client scripts\nsnow_create_ui_policy({ name, table, conditions }) // UI policies\n```\n\n### Widget Development (CRITICAL!)\n```javascript\n// ALWAYS use local sync for widgets - NEVER snow_query_table!\nsnow_pull_artifact({ sys_id, table: 'sp_widget' }) // Pull to local files\n// ... edit locally with native tools ...\nsnow_push_artifact({ sys_id }) // Push back to ServiceNow\n```\n\n### Change Management\n```javascript\nsnow_change_manage({ action: 'create', ... }) // Create change\nsnow_change_manage({ action: 'approve', ... }) // Approve change\nsnow_change_query({ action: 'search', ... }) // Search changes\n```\n\n### Knowledge Management\n```javascript\nsnow_knowledge_article_manage({ action: 'create' }) // Create article\nsnow_knowledge_article_manage({ action: 'publish' }) // Publish article\nsnow_knowledge_article_manage({ action: 'search' }) // Search articles\n```\n\n### Performance Analytics\n```javascript\nsnow_pa_create({ action: 'indicator', ... }) // Create PA indicator\nsnow_pa_operate({ action: 'collect_data', ... }) // Collect PA data\nsnow_pa_discover({ action: 'indicators' }) // Discover indicators\n```\n\n### UI Builder\n```javascript\nsnow_create_uib_page({ name, title }) // Create UIB page\nsnow_uib_component_manage({ action: 'create' }) // Create component\nsnow_add_uib_page_element({ page_sys_id, component }) // Add element\n```\n\n### Workspace\n```javascript\nsnow_create_complete_workspace({ workspace_name, tables }) // Complete workspace\nsnow_create_workspace_tab({ workspace, tab_config }) // Add tab\n```\n\n### Automation & Scripts\n```javascript\nsnow_execute_script_with_output({ script }) // Test/verify scripts (ES5 ONLY!)\nsnow_schedule_job({ name, script, interval }) // Scheduled jobs\nsnow_get_logs({ filter }) // View system logs\n```\n\n### System Properties\n```javascript\nsnow_property_manage({ action: 'get', name }) // Get property\nsnow_property_manage({ action: 'set', name, value }) // Set property\nsnow_property_query({ action: 'list', pattern }) // List properties\n```\n\n---\n\n## Critical Rules\n\n### 1. ES5 JavaScript Only (ServiceNow Rhino Engine)\n**NEVER USE:**\n- \u274C `const` / `let` (use `var`)\n- \u274C Arrow functions `() => {}` (use `function() {}`)\n- \u274C Template literals \\`${}\\` (use string concatenation `+`)\n- \u274C Destructuring `{a, b} = obj` (use `obj.a`, `obj.b`)\n- \u274C `for...of` loops (use traditional `for` loops)\n\n**ALWAYS USE ES5:**\n```javascript\nvar data = []; // NOT const or let\nfunction process() { return 'result'; } // NOT arrow functions\nvar msg = 'Hello ' + name; // NOT template literals\nfor (var i = 0; i < items.length; i++) { } // NOT for...of\n```\n\n### 2. Widget Debugging = Local Sync\n**ALWAYS use `snow_pull_artifact` for widgets** - NEVER `snow_query_table`!\n- Widget too large? \u2192 `snow_pull_artifact`\n- Widget not working? \u2192 `snow_pull_artifact`\n- Need to edit widget? \u2192 `snow_pull_artifact`\n\n### 3. MCP Tools Are Functions\n**MCP tools are JavaScript functions** - call them directly!\n```javascript\n// \u2705 CORRECT\nawait snow_create_ui_page({ name: \"dashboard\", html: \"...\" });\n\n// \u274C WRONG - DO NOT USE BASH!\n// node dist/index.js mcp execute ... // DOES NOT EXIST!\n// npx snow-flow-mcp-client ... // DOES NOT EXIST!\n```\n\n### 4. No Mock Data\n- **FORBIDDEN:** Placeholders, TODOs, \"this would normally...\", test values\n- **REQUIRED:** Complete, production-ready, fully functional code\n\n### 5. Verify First\n- Test before claiming something is broken\n- Check if resources exist before modifying\n- Use `snow_execute_script_with_output` to verify\n\n---\n\n## The Universal Workflow\n\n**Every task follows this pattern:**\n\n1. **\uD83D\uDCE6 UPDATE SET FIRST**\n - `snow_update_set_manage({ action: 'create', ... })`\n - `snow_update_set_query({ action: 'current' })` to verify\n\n2. **\uD83D\uDD0D USE RIGHT TOOL**\n - Creating? \u2192 `snow_create_*` or `snow_deploy`\n - Updating? \u2192 `snow_record_manage({ action: 'update' })`\n - Querying? \u2192 `snow_query_table` or specific query tool\n - Widget? \u2192 `snow_pull_artifact` (local sync!)\n\n3. **\u2705 VERIFY**\n - `snow_execute_script_with_output` for testing\n - Check logs with `snow_get_logs`\n - Validate with `snow_update_set_query({ action: 'current' })`\n\n4. **\u2714\uFE0F COMPLETE**\n - `snow_update_set_manage({ action: 'complete' })`\n\n---\n\n## Skills & Advanced Features\n\n**Skills** are specialized capabilities you can invoke for complex tasks:\n- Use the Skill tool when available for specialized workflows\n- Skills are invoked by name only (no arguments)\n- Check available_skills in your environment\n\n---\n\n## Quick Reference\n\n| Task | Tool | Notes |\n|------|------|-------|\n| Create update set | `snow_update_set_manage({ action: 'create' })` | **DO THIS FIRST!** |\n| Create widget | `snow_deploy({ type: 'widget' })` | After update set |\n| Fix widget | `snow_pull_artifact({ sys_id })` | Local sync |\n| Create business rule | `snow_create_business_rule()` | ES5 only! |\n| Query incidents | `snow_query_incidents()` | Specialized tool |\n| Get property | `snow_property_manage({ action: 'get' })` | System properties |\n| Test script | `snow_execute_script_with_output()` | ES5 verification |\n| Complete work | `snow_update_set_manage({ action: 'complete' })` | **DO THIS LAST!** |\n\n---\n\n**Remember:** Update Set \u2192 Tool \u2192 Verify \u2192 Complete. Every. Single. Time.\n";
2
2
  export declare const CLAUDE_MD_TEMPLATE_VERSION = "8.3.0-ENTERPRISE-THEMES";
3
3
  //# sourceMappingURL=claude-md-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude-md-template.d.ts","sourceRoot":"","sources":["../../src/templates/claude-md-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,01RAiP9B,CAAC;AAEF,eAAO,MAAM,0BAA0B,4BAA4B,CAAC"}
1
+ {"version":3,"file":"claude-md-template.d.ts","sourceRoot":"","sources":["../../src/templates/claude-md-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,2tTA4Q9B,CAAC;AAEF,eAAO,MAAM,0BAA0B,4BAA4B,CAAC"}
@@ -3,6 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CLAUDE_MD_TEMPLATE_VERSION = exports.CLAUDE_MD_TEMPLATE = void 0;
4
4
  exports.CLAUDE_MD_TEMPLATE = `# Snow-Flow - ServiceNow Development AI Agent
5
5
 
6
+ ## 🚨 CRITICAL: YOU MUST ACTUALLY CALL THE TOOLS!
7
+
8
+ **MCP tools are JavaScript functions that you MUST call directly!**
9
+
10
+ \`\`\`javascript
11
+ // ✅ CORRECT - Actually call the function:
12
+ const updateSet = await snow_update_set_manage({
13
+ action: 'create',
14
+ name: "Feature: Incident Dashboard"
15
+ });
16
+ // This EXECUTES the tool and returns real data from ServiceNow
17
+
18
+ // ❌ WRONG - Just showing code without calling it:
19
+ console.log("I will create an update set like this:");
20
+ console.log(\`await snow_update_set_manage({ action: 'create' });\`);
21
+ // This does NOTHING - it's just a string!
22
+ \`\`\`
23
+
24
+ **If you show code examples without calling tools, you are FAILING your task!**
25
+
26
+ The user wants you to:
27
+ - ✅ **Actually execute tools** and get real results
28
+ - ✅ **Make real changes** in their ServiceNow instance
29
+ - ❌ **NOT just show code examples** or explain what you "would" do
30
+
31
+ ---
32
+
6
33
  ## What is Snow-Flow?
7
34
 
8
35
  **Snow-Flow** is an AI-powered ServiceNow development framework that provides **370+ MCP tools** to automate ServiceNow development, configuration, and administration. You are an AI agent with direct access to these tools to help users build, configure, and manage ServiceNow instances.
@@ -15,7 +42,7 @@ You help users:
15
42
  - **Automate** tasks (scripts, workflows, scheduled jobs)
16
43
  - **Analyze** data (incidents, reports, performance analytics)
17
44
 
18
- **Key Principle:** Always use MCP tools directly - they are JavaScript functions, NOT CLI commands!
45
+ **Remember:** These tools are AVAILABLE and WORKING - just call them!
19
46
 
20
47
  ---
21
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"claude-md-template.js","sourceRoot":"","sources":["../../src/templates/claude-md-template.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiPjC,CAAC;AAEW,QAAA,0BAA0B,GAAG,yBAAyB,CAAC"}
1
+ {"version":3,"file":"claude-md-template.js","sourceRoot":"","sources":["../../src/templates/claude-md-template.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4QjC,CAAC;AAEW,QAAA,0BAA0B,GAAG,yBAAyB,CAAC"}
@@ -11,24 +11,22 @@
11
11
  "servicenow-unified": {
12
12
  "type": "local",
13
13
  "command": ["node", "dist/mcp/servicenow-mcp-unified/index.js"],
14
- "env": {
15
- "SNOW_INSTANCE": "${SNOW_INSTANCE}",
16
- "SNOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
17
- "SNOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}",
18
- "SNOW_USERNAME": "${SNOW_USERNAME}",
19
- "SNOW_PASSWORD": "${SNOW_PASSWORD}"
14
+ "environment": {
15
+ "SERVICENOW_INSTANCE_URL": "https://${SNOW_INSTANCE}",
16
+ "SERVICENOW_CLIENT_ID": "${SNOW_CLIENT_ID}",
17
+ "SERVICENOW_CLIENT_SECRET": "${SNOW_CLIENT_SECRET}",
18
+ "SERVICENOW_USERNAME": "${SNOW_USERNAME}",
19
+ "SERVICENOW_PASSWORD": "${SNOW_PASSWORD}"
20
20
  },
21
- "enabled": true,
22
- "description": "Unified ServiceNow MCP server with 235+ tools for complete ServiceNow access including deployment, operations, UI Builder, automation, local sync, and all ServiceNow modules"
21
+ "enabled": true
23
22
  },
24
23
  "snow-flow": {
25
24
  "type": "local",
26
25
  "command": ["node", "dist/mcp/snow-flow-mcp.js"],
27
- "env": {
26
+ "environment": {
28
27
  "SNOW_FLOW_ENV": "production"
29
28
  },
30
- "enabled": true,
31
- "description": "Snow-Flow orchestration server with 176+ tools: swarm coordination (swarm_init, agent_spawn), memory management (memory_search, memory_usage), neural learning with TensorFlow.js (neural_train, neural_patterns), performance tracking, and agent discovery"
29
+ "enabled": true
32
30
  }
33
31
  },
34
32
  "tools": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "8.3.0",
3
+ "version": "8.3.2",
4
4
  "description": "ServiceNow development with OpenCode - 75+ LLM providers (Claude, GPT, Gemini, Llama, Mistral, DeepSeek, Groq, Ollama) • 410 Optimized Tools • 2 MCP Servers • Native Predictive Intelligence builder • Multi-agent orchestration • Use ANY AI coding assistant",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",