snow-flow 8.40.1 → 8.41.0
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/CLAUDE.md +62 -20
- package/dist/mcp/servicenow-mcp-unified/tools/applications/index.d.ts +2 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/index.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/applications/index.js +7 -1
- package/dist/mcp/servicenow-mcp-unified/tools/applications/index.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.d.ts +14 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.js +220 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_list_applications.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_list_applications.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_list_applications.js +236 -0
- package/dist/mcp/servicenow-mcp-unified/tools/applications/snow_list_applications.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts +1 -3
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js +5 -10
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.d.ts +7 -5
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.js +195 -34
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_confirm_script_execution.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script.d.ts +20 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script.js +474 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_create_artifact.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_create_artifact.js +104 -8
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_create_artifact.js.map +1 -1
- package/dist/templates/agents-md-template.d.ts +1 -1
- package/dist/templates/agents-md-template.d.ts.map +1 -1
- package/dist/templates/agents-md-template.js +4 -4
- package/dist/templates/claude-md-template.d.ts +1 -1
- package/dist/templates/claude-md-template.d.ts.map +1 -1
- package/dist/templates/claude-md-template.js +17 -12
- package/dist/templates/claude-md-template.js.map +1 -1
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -30,58 +30,98 @@ const activity = await activity_start({
|
|
|
30
30
|
const activityId = activity.activityId; // Store this!
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
### Step 2:
|
|
33
|
+
### Step 2: Decide Application Scope (NEW!)
|
|
34
34
|
|
|
35
35
|
```javascript
|
|
36
|
-
//
|
|
36
|
+
// ASK YOURSELF: Does this need a scoped application?
|
|
37
|
+
// ✅ Scoped App: Complete feature set, customer-specific, deployable unit
|
|
38
|
+
// 🌐 Global: Quick fix, shared utility, cross-app functionality
|
|
39
|
+
|
|
40
|
+
// Check current scope first
|
|
41
|
+
const currentScope = await snow_get_current_scope();
|
|
42
|
+
console.log(`Current scope: ${currentScope.current_scope.name}`);
|
|
43
|
+
|
|
44
|
+
// Option A: Create NEW application (for new feature sets)
|
|
45
|
+
const app = await snow_create_application({
|
|
46
|
+
name: "HR Self-Service Portal",
|
|
47
|
+
scope: "x_myco_hr_portal",
|
|
48
|
+
version: "1.0.0"
|
|
49
|
+
// auto_create_update_set: true (default)
|
|
50
|
+
// auto_switch_scope: true (default)
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Option B: Switch to EXISTING application
|
|
54
|
+
await snow_switch_application_scope({
|
|
55
|
+
scope: "x_myco_existing_app",
|
|
56
|
+
create_update_set: true
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Option C: Use GLOBAL scope (default)
|
|
60
|
+
// Just proceed to Step 3 - global is the default
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Step 3: Create Update Set (if not auto-created)
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
// If you created an application in Step 2 with auto_create_update_set=true,
|
|
67
|
+
// skip this step - Update Set was already created!
|
|
68
|
+
|
|
69
|
+
// Otherwise, create Update Set in the correct scope:
|
|
37
70
|
const updateSet = await snow_update_set_manage({
|
|
38
71
|
action: "create",
|
|
39
72
|
name: "Feature: [Descriptive Name]",
|
|
40
|
-
description: "What and why"
|
|
73
|
+
description: "What and why",
|
|
74
|
+
application_scope: "x_myco_hr_portal" // Optional: specify scope explicitly
|
|
41
75
|
});
|
|
42
76
|
```
|
|
43
77
|
|
|
44
|
-
### Step
|
|
78
|
+
### Step 4: Do Your Development Work
|
|
45
79
|
|
|
46
80
|
```javascript
|
|
47
|
-
// NOW you can create artifacts
|
|
48
|
-
const artifact = await
|
|
81
|
+
// NOW you can create artifacts (they'll go into the current scope!)
|
|
82
|
+
const artifact = await snow_create_artifact({
|
|
83
|
+
type: 'sp_widget',
|
|
84
|
+
name: 'my_widget',
|
|
85
|
+
// ... config
|
|
86
|
+
// application_scope: "x_myco_app" // Optional: override scope per-artifact
|
|
87
|
+
});
|
|
49
88
|
```
|
|
50
89
|
|
|
51
|
-
### Step
|
|
90
|
+
### Step 5: Log Each Artifact
|
|
52
91
|
|
|
53
92
|
```javascript
|
|
54
93
|
// After EACH artifact, log it!
|
|
55
94
|
await activity_add_artifact({
|
|
56
95
|
activityId: activityId,
|
|
57
|
-
artifactType: "
|
|
58
|
-
artifactName: "My
|
|
96
|
+
artifactType: "widget",
|
|
97
|
+
artifactName: "My Widget",
|
|
59
98
|
artifactSysId: artifact.sys_id
|
|
60
99
|
});
|
|
61
100
|
```
|
|
62
101
|
|
|
63
|
-
### Step
|
|
102
|
+
### Step 6: Complete Activity
|
|
64
103
|
|
|
65
104
|
```javascript
|
|
66
105
|
// When done, complete the activity
|
|
67
106
|
await activity_complete({
|
|
68
107
|
activityId: activityId,
|
|
69
|
-
summary: "Created
|
|
108
|
+
summary: "Created Widget for X. Update Set: Y. Scope: Z."
|
|
70
109
|
});
|
|
71
110
|
```
|
|
72
111
|
|
|
73
112
|
### ⚠️ THIS APPLIES TO ALL DEVELOPMENT REQUESTS!
|
|
74
113
|
|
|
75
|
-
| User Request Type
|
|
76
|
-
|
|
77
|
-
| "Create a widget"
|
|
78
|
-
| "
|
|
79
|
-
| "Add a business rule" |
|
|
80
|
-
| "Fix this script"
|
|
81
|
-
| "
|
|
82
|
-
| "
|
|
114
|
+
| User Request Type | Activity? | Update Set? | Scope Decision? |
|
|
115
|
+
|--------------------------------|:---------:|:-----------:|:---------------:|
|
|
116
|
+
| "Create a widget" | ✅ | ✅ | ✅ |
|
|
117
|
+
| "Build HR Portal" | ✅ | ✅ | ✅ Scoped App |
|
|
118
|
+
| "Add a business rule" | ✅ | ✅ | ✅ |
|
|
119
|
+
| "Fix this script" | ✅ | ✅ | 🌐 Global |
|
|
120
|
+
| "Create shared utility" | ✅ | ✅ | 🌐 Global |
|
|
121
|
+
| "Query some data" | ❌ | ❌ | ❌ |
|
|
122
|
+
| "Explain how X works" | ❌ | ❌ | ❌ |
|
|
83
123
|
|
|
84
|
-
**Rule of thumb:** If you're CREATING or MODIFYING a ServiceNow artifact → Activity + Update Set FIRST!
|
|
124
|
+
**Rule of thumb:** If you're CREATING or MODIFYING a ServiceNow artifact → Activity + Scope Decision + Update Set FIRST!
|
|
85
125
|
|
|
86
126
|
---
|
|
87
127
|
|
|
@@ -525,6 +565,8 @@ function($scope) {
|
|
|
525
565
|
| Complete Update Set | `snow_update_set_manage({ action: 'complete' })` |
|
|
526
566
|
| Create Application | `snow_create_application()` |
|
|
527
567
|
| Switch Application Scope | `snow_switch_application_scope()` |
|
|
568
|
+
| Get Current Scope | `snow_get_current_scope()` |
|
|
569
|
+
| List Applications | `snow_list_applications()` |
|
|
528
570
|
| Create Widget | `snow_create_artifact({ type: 'sp_widget' })` |
|
|
529
571
|
| Create Business Rule | `snow_create_business_rule()` |
|
|
530
572
|
| Create Script Include | `snow_create_script_include()` |
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { toolDefinition as snow_create_application_def, execute as snow_create_application_exec } from './snow_create_application.js';
|
|
2
2
|
export { toolDefinition as snow_install_application_def, execute as snow_install_application_exec } from './snow_install_application.js';
|
|
3
3
|
export { toolDefinition as snow_switch_application_scope_def, execute as snow_switch_application_scope_exec } from './snow_switch_application_scope.js';
|
|
4
|
+
export { toolDefinition as snow_get_current_scope_def, execute as snow_get_current_scope_exec } from './snow_get_current_scope.js';
|
|
5
|
+
export { toolDefinition as snow_list_applications_def, execute as snow_list_applications_exec } from './snow_list_applications.js';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/applications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,2BAA2B,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACtI,OAAO,EAAE,cAAc,IAAI,4BAA4B,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AACzI,OAAO,EAAE,cAAc,IAAI,iCAAiC,EAAE,OAAO,IAAI,kCAAkC,EAAE,MAAM,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/applications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,2BAA2B,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACtI,OAAO,EAAE,cAAc,IAAI,4BAA4B,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AACzI,OAAO,EAAE,cAAc,IAAI,iCAAiC,EAAE,OAAO,IAAI,kCAAkC,EAAE,MAAM,oCAAoC,CAAC;AACxJ,OAAO,EAAE,cAAc,IAAI,0BAA0B,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AACnI,OAAO,EAAE,cAAc,IAAI,0BAA0B,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.snow_switch_application_scope_exec = exports.snow_switch_application_scope_def = exports.snow_install_application_exec = exports.snow_install_application_def = exports.snow_create_application_exec = exports.snow_create_application_def = void 0;
|
|
3
|
+
exports.snow_list_applications_exec = exports.snow_list_applications_def = exports.snow_get_current_scope_exec = exports.snow_get_current_scope_def = exports.snow_switch_application_scope_exec = exports.snow_switch_application_scope_def = exports.snow_install_application_exec = exports.snow_install_application_def = exports.snow_create_application_exec = exports.snow_create_application_def = void 0;
|
|
4
4
|
var snow_create_application_js_1 = require("./snow_create_application.js");
|
|
5
5
|
Object.defineProperty(exports, "snow_create_application_def", { enumerable: true, get: function () { return snow_create_application_js_1.toolDefinition; } });
|
|
6
6
|
Object.defineProperty(exports, "snow_create_application_exec", { enumerable: true, get: function () { return snow_create_application_js_1.execute; } });
|
|
@@ -10,4 +10,10 @@ Object.defineProperty(exports, "snow_install_application_exec", { enumerable: tr
|
|
|
10
10
|
var snow_switch_application_scope_js_1 = require("./snow_switch_application_scope.js");
|
|
11
11
|
Object.defineProperty(exports, "snow_switch_application_scope_def", { enumerable: true, get: function () { return snow_switch_application_scope_js_1.toolDefinition; } });
|
|
12
12
|
Object.defineProperty(exports, "snow_switch_application_scope_exec", { enumerable: true, get: function () { return snow_switch_application_scope_js_1.execute; } });
|
|
13
|
+
var snow_get_current_scope_js_1 = require("./snow_get_current_scope.js");
|
|
14
|
+
Object.defineProperty(exports, "snow_get_current_scope_def", { enumerable: true, get: function () { return snow_get_current_scope_js_1.toolDefinition; } });
|
|
15
|
+
Object.defineProperty(exports, "snow_get_current_scope_exec", { enumerable: true, get: function () { return snow_get_current_scope_js_1.execute; } });
|
|
16
|
+
var snow_list_applications_js_1 = require("./snow_list_applications.js");
|
|
17
|
+
Object.defineProperty(exports, "snow_list_applications_def", { enumerable: true, get: function () { return snow_list_applications_js_1.toolDefinition; } });
|
|
18
|
+
Object.defineProperty(exports, "snow_list_applications_exec", { enumerable: true, get: function () { return snow_list_applications_js_1.execute; } });
|
|
13
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/applications/index.ts"],"names":[],"mappings":";;;AAAA,2EAAsI;AAA7H,yIAAA,cAAc,OAA+B;AAAE,0IAAA,OAAO,OAAgC;AAC/F,6EAAyI;AAAhI,2IAAA,cAAc,OAAgC;AAAE,4IAAA,OAAO,OAAiC;AACjG,uFAAwJ;AAA/I,qJAAA,cAAc,OAAqC;AAAE,sJAAA,OAAO,OAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/applications/index.ts"],"names":[],"mappings":";;;AAAA,2EAAsI;AAA7H,yIAAA,cAAc,OAA+B;AAAE,0IAAA,OAAO,OAAgC;AAC/F,6EAAyI;AAAhI,2IAAA,cAAc,OAAgC;AAAE,4IAAA,OAAO,OAAiC;AACjG,uFAAwJ;AAA/I,qJAAA,cAAc,OAAqC;AAAE,sJAAA,OAAO,OAAsC;AAC3G,yEAAmI;AAA1H,uIAAA,cAAc,OAA8B;AAAE,wIAAA,OAAO,OAA+B;AAC7F,yEAAmI;AAA1H,uIAAA,cAAc,OAA8B;AAAE,wIAAA,OAAO,OAA+B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* snow_get_current_scope - Get Current Application Scope
|
|
3
|
+
*
|
|
4
|
+
* Returns the current application scope for the OAuth service account,
|
|
5
|
+
* including details about the scope and the active Update Set.
|
|
6
|
+
*
|
|
7
|
+
* Useful for verifying which scope you're working in before creating artifacts.
|
|
8
|
+
*/
|
|
9
|
+
import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
|
|
10
|
+
export declare const toolDefinition: MCPToolDefinition;
|
|
11
|
+
export declare function execute(args: any, context: ServiceNowContext): Promise<ToolResult>;
|
|
12
|
+
export declare const version = "1.0.0";
|
|
13
|
+
export declare const author = "Snow-Flow Application Scope Enhancement";
|
|
14
|
+
//# sourceMappingURL=snow_get_current_scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_get_current_scope.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBAyC5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CA8LxF;AAED,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* snow_get_current_scope - Get Current Application Scope
|
|
4
|
+
*
|
|
5
|
+
* Returns the current application scope for the OAuth service account,
|
|
6
|
+
* including details about the scope and the active Update Set.
|
|
7
|
+
*
|
|
8
|
+
* Useful for verifying which scope you're working in before creating artifacts.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.author = exports.version = exports.toolDefinition = void 0;
|
|
12
|
+
exports.execute = execute;
|
|
13
|
+
const auth_js_1 = require("../../shared/auth.js");
|
|
14
|
+
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
15
|
+
exports.toolDefinition = {
|
|
16
|
+
name: 'snow_get_current_scope',
|
|
17
|
+
description: `Get the current application scope and active Update Set.
|
|
18
|
+
|
|
19
|
+
🔍 USE THIS TO:
|
|
20
|
+
- Verify which scope you're currently working in before creating artifacts
|
|
21
|
+
- Check if you have an active Update Set in the current scope
|
|
22
|
+
- Understand the development context before starting work
|
|
23
|
+
|
|
24
|
+
📋 RETURNS:
|
|
25
|
+
- Current application scope (name, sys_id, scope prefix)
|
|
26
|
+
- Whether it's global or a scoped application
|
|
27
|
+
- Current active Update Set (if any)
|
|
28
|
+
- Recommendations for next steps`,
|
|
29
|
+
// Metadata for tool discovery (not sent to LLM)
|
|
30
|
+
category: 'development',
|
|
31
|
+
subcategory: 'applications',
|
|
32
|
+
use_cases: ['app-development', 'scoped-apps', 'development', 'context-check'],
|
|
33
|
+
complexity: 'beginner',
|
|
34
|
+
frequency: 'high',
|
|
35
|
+
// Permission enforcement
|
|
36
|
+
// Classification: READ - Query only, no modifications
|
|
37
|
+
permission: 'read',
|
|
38
|
+
allowedRoles: ['developer', 'admin', 'stakeholder'],
|
|
39
|
+
inputSchema: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
include_update_set: {
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
description: 'Include information about the current Update Set (default: true)',
|
|
45
|
+
default: true
|
|
46
|
+
},
|
|
47
|
+
include_recent_artifacts: {
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
description: 'Include count of recent artifacts created in current scope (default: false)',
|
|
50
|
+
default: false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
required: []
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
async function execute(args, context) {
|
|
57
|
+
const { include_update_set = true, include_recent_artifacts = false } = args;
|
|
58
|
+
try {
|
|
59
|
+
const client = await (0, auth_js_1.getAuthenticatedClient)(context);
|
|
60
|
+
// Get current scope preference
|
|
61
|
+
const scopePrefResponse = await client.get('/api/now/table/sys_user_preference', {
|
|
62
|
+
params: {
|
|
63
|
+
sysparm_query: 'name=sys_scope^user=javascript:gs.getUserID()',
|
|
64
|
+
sysparm_fields: 'value',
|
|
65
|
+
sysparm_limit: 1
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
let currentScope = {
|
|
69
|
+
sys_id: 'global',
|
|
70
|
+
name: 'Global',
|
|
71
|
+
scope: 'global',
|
|
72
|
+
is_global: true
|
|
73
|
+
};
|
|
74
|
+
// If we have a scope preference, look up the application details
|
|
75
|
+
if (scopePrefResponse.data.result && scopePrefResponse.data.result.length > 0) {
|
|
76
|
+
const scopeValue = scopePrefResponse.data.result[0].value;
|
|
77
|
+
if (scopeValue && scopeValue !== 'global') {
|
|
78
|
+
// Look up the application
|
|
79
|
+
const appResponse = await client.get(`/api/now/table/sys_app/${scopeValue}`, {
|
|
80
|
+
params: {
|
|
81
|
+
sysparm_fields: 'sys_id,name,scope,version,short_description,vendor,active'
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
if (appResponse.data.result) {
|
|
85
|
+
const app = appResponse.data.result;
|
|
86
|
+
currentScope = {
|
|
87
|
+
sys_id: app.sys_id,
|
|
88
|
+
name: app.name,
|
|
89
|
+
scope: app.scope,
|
|
90
|
+
version: app.version || null,
|
|
91
|
+
short_description: app.short_description || null,
|
|
92
|
+
vendor: app.vendor || null,
|
|
93
|
+
is_global: false,
|
|
94
|
+
is_active: app.active === 'true' || app.active === true
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Build result
|
|
100
|
+
const result = {
|
|
101
|
+
current_scope: currentScope,
|
|
102
|
+
update_set: null,
|
|
103
|
+
recommendations: []
|
|
104
|
+
};
|
|
105
|
+
// Get current Update Set if requested
|
|
106
|
+
if (include_update_set) {
|
|
107
|
+
const updateSetPrefResponse = await client.get('/api/now/table/sys_user_preference', {
|
|
108
|
+
params: {
|
|
109
|
+
sysparm_query: 'name=sys_update_set^user=javascript:gs.getUserID()',
|
|
110
|
+
sysparm_fields: 'value',
|
|
111
|
+
sysparm_limit: 1
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
if (updateSetPrefResponse.data.result && updateSetPrefResponse.data.result.length > 0) {
|
|
115
|
+
const updateSetId = updateSetPrefResponse.data.result[0].value;
|
|
116
|
+
if (updateSetId) {
|
|
117
|
+
const updateSetResponse = await client.get(`/api/now/table/sys_update_set/${updateSetId}`, {
|
|
118
|
+
params: {
|
|
119
|
+
sysparm_fields: 'sys_id,name,description,state,application,sys_created_on'
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
if (updateSetResponse.data.result) {
|
|
123
|
+
const us = updateSetResponse.data.result;
|
|
124
|
+
// Get application name for the Update Set
|
|
125
|
+
let usAppName = 'Global';
|
|
126
|
+
let usAppScope = 'global';
|
|
127
|
+
if (us.application && us.application !== 'global') {
|
|
128
|
+
try {
|
|
129
|
+
const usAppResponse = await client.get(`/api/now/table/sys_app/${us.application}`, {
|
|
130
|
+
params: {
|
|
131
|
+
sysparm_fields: 'name,scope'
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
if (usAppResponse.data.result) {
|
|
135
|
+
usAppName = usAppResponse.data.result.name;
|
|
136
|
+
usAppScope = usAppResponse.data.result.scope;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
// Ignore - might be global
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
result.update_set = {
|
|
144
|
+
sys_id: us.sys_id,
|
|
145
|
+
name: us.name,
|
|
146
|
+
description: us.description || null,
|
|
147
|
+
state: us.state,
|
|
148
|
+
created_at: us.sys_created_on,
|
|
149
|
+
application: {
|
|
150
|
+
sys_id: us.application || 'global',
|
|
151
|
+
name: usAppName,
|
|
152
|
+
scope: usAppScope
|
|
153
|
+
},
|
|
154
|
+
scope_matches: (us.application === currentScope.sys_id) ||
|
|
155
|
+
(us.application === 'global' && currentScope.is_global)
|
|
156
|
+
};
|
|
157
|
+
// Check for scope mismatch
|
|
158
|
+
if (!result.update_set.scope_matches) {
|
|
159
|
+
result.recommendations.push(`⚠️ SCOPE MISMATCH: Current scope is "${currentScope.name}" but Update Set is in "${usAppName}". ` +
|
|
160
|
+
`Consider switching scope or creating a new Update Set.`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (!result.update_set) {
|
|
166
|
+
result.recommendations.push('⚠️ No active Update Set! Create one with snow_update_set_manage before making changes.');
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Get recent artifact count if requested
|
|
170
|
+
if (include_recent_artifacts && !currentScope.is_global) {
|
|
171
|
+
try {
|
|
172
|
+
// Count artifacts in the current scope from the last 24 hours
|
|
173
|
+
const oneDayAgo = new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
|
|
174
|
+
const artifactCountResponse = await client.get('/api/now/table/sys_metadata', {
|
|
175
|
+
params: {
|
|
176
|
+
sysparm_query: `sys_scope=${currentScope.sys_id}^sys_created_on>=${oneDayAgo}`,
|
|
177
|
+
sysparm_fields: 'sys_id',
|
|
178
|
+
sysparm_limit: 100
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
result.recent_artifacts = {
|
|
182
|
+
count: artifactCountResponse.data.result?.length || 0,
|
|
183
|
+
period: 'last 24 hours',
|
|
184
|
+
scope: currentScope.scope
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
catch (e) {
|
|
188
|
+
// Ignore - optional feature
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Add general recommendations
|
|
192
|
+
if (currentScope.is_global) {
|
|
193
|
+
result.recommendations.push('You are in Global scope. Artifacts created will be available across all applications.');
|
|
194
|
+
result.recommendations.push('Consider creating a scoped application if building a complete feature set.');
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
result.recommendations.push(`You are in "${currentScope.name}" scope (${currentScope.scope}). ` +
|
|
198
|
+
`Artifacts created will belong to this application.`);
|
|
199
|
+
}
|
|
200
|
+
// Build summary message
|
|
201
|
+
let message = `Current scope: ${currentScope.is_global ? 'Global' : `"${currentScope.name}" (${currentScope.scope})`}`;
|
|
202
|
+
if (result.update_set) {
|
|
203
|
+
message += ` | Update Set: "${result.update_set.name}" (${result.update_set.state})`;
|
|
204
|
+
if (!result.update_set.scope_matches) {
|
|
205
|
+
message += ' ⚠️ SCOPE MISMATCH';
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
message += ' | No active Update Set';
|
|
210
|
+
}
|
|
211
|
+
result.message = message;
|
|
212
|
+
return (0, error_handler_js_1.createSuccessResult)(result);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
return (0, error_handler_js_1.createErrorResult)(error.message);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
exports.version = '1.0.0';
|
|
219
|
+
exports.author = 'Snow-Flow Application Scope Enhancement';
|
|
220
|
+
//# sourceMappingURL=snow_get_current_scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_get_current_scope.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/applications/snow_get_current_scope.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAiDH,0BA8LC;AA5OD,kDAA8D;AAC9D,oEAAuF;AAE1E,QAAA,c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,EAAE,CAAC;gBACrC,OAAO,IAAI,oBAAoB,CAAC;YAClC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,yBAAyB,CAAC;QACvC,CAAC;QACD,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QAEzB,OAAO,IAAA,sCAAmB,EAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAA,oCAAiB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAEY,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* snow_list_applications - List Available Applications
|
|
3
|
+
*
|
|
4
|
+
* Lists all scoped applications in the ServiceNow instance with filtering
|
|
5
|
+
* and search capabilities. Useful for finding the right scope to work in.
|
|
6
|
+
*/
|
|
7
|
+
import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
|
|
8
|
+
export declare const toolDefinition: MCPToolDefinition;
|
|
9
|
+
export declare function execute(args: any, context: ServiceNowContext): Promise<ToolResult>;
|
|
10
|
+
export declare const version = "1.0.0";
|
|
11
|
+
export declare const author = "Snow-Flow Application Scope Enhancement";
|
|
12
|
+
//# sourceMappingURL=snow_list_applications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_list_applications.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/applications/snow_list_applications.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBAiE5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAsLxF;AAED,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,4CAA4C,CAAC"}
|