snow-flow 8.39.1 → 8.39.3
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/dist/mcp/base-mcp-server.d.ts +3 -0
- package/dist/mcp/base-mcp-server.d.ts.map +1 -1
- package/dist/mcp/base-mcp-server.js +48 -21
- package/dist/mcp/base-mcp-server.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts +6 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js +19 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/index.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.js +185 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_email_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.js +280 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_flow_execution_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.js +233 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_inbound_http_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.js +218 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_outbound_http_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.js +276 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_scheduled_job_logs.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.js +340 -0
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_get_slow_queries.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.d.ts +10 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.js +34 -1
- package/dist/mcp/servicenow-mcp-unified/tools/integration/index.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.js +397 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_configure_mid_server.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.js +234 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_connection_alias.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.js +280 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_credential_alias.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.js +358 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.js +237 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.js +326 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.js +442 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_mid_capabilities.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.js +348 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_oauth_tokens.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.js +427 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_manage_spoke_connection.js.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.d.ts +12 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.d.ts.map +1 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.js +432 -0
- package/dist/mcp/servicenow-mcp-unified/tools/integration/snow_test_mid_connectivity.js.map +1 -0
- package/dist/monitoring/performance-tracker.d.ts +1 -1
- package/dist/monitoring/performance-tracker.d.ts.map +1 -1
- package/dist/monitoring/performance-tracker.js +44 -9
- package/dist/monitoring/performance-tracker.js.map +1 -1
- package/dist/snow-flow-system.d.ts +12 -2
- package/dist/snow-flow-system.d.ts.map +1 -1
- package/dist/snow-flow-system.js +55 -12
- package/dist/snow-flow-system.js.map +1 -1
- package/dist/templates/agents-md-template.d.ts +2 -2
- package/dist/templates/agents-md-template.d.ts.map +1 -1
- package/dist/templates/agents-md-template.js +57 -2
- package/dist/templates/agents-md-template.js.map +1 -1
- package/dist/templates/claude-md-template.d.ts +2 -2
- package/dist/templates/claude-md-template.d.ts.map +1 -1
- package/dist/templates/claude-md-template.js +17 -1
- package/dist/templates/claude-md-template.js.map +1 -1
- package/dist/utils/mcp-on-demand-manager.d.ts.map +1 -1
- package/dist/utils/mcp-on-demand-manager.js +18 -5
- package/dist/utils/mcp-on-demand-manager.js.map +1 -1
- package/dist/utils/mcp-persistent-guard.d.ts +4 -0
- package/dist/utils/mcp-persistent-guard.d.ts.map +1 -1
- package/dist/utils/mcp-persistent-guard.js +26 -2
- package/dist/utils/mcp-persistent-guard.js.map +1 -1
- package/dist/utils/mcp-process-manager.d.ts.map +1 -1
- package/dist/utils/mcp-process-manager.js +5 -0
- package/dist/utils/mcp-process-manager.js.map +1 -1
- package/dist/utils/memory-safe-collections.d.ts +119 -0
- package/dist/utils/memory-safe-collections.d.ts.map +1 -0
- package/dist/utils/memory-safe-collections.js +212 -0
- package/dist/utils/memory-safe-collections.js.map +1 -0
- package/dist/utils/timer-registry.d.ts +138 -0
- package/dist/utils/timer-registry.d.ts.map +1 -0
- package/dist/utils/timer-registry.js +289 -0
- package/dist/utils/timer-registry.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* snow_create_flow_action - Create custom IntegrationHub actions
|
|
4
|
+
*
|
|
5
|
+
* Create custom Flow Designer actions for IntegrationHub to extend
|
|
6
|
+
* spoke capabilities or create new integrations.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.author = exports.version = exports.toolDefinition = void 0;
|
|
10
|
+
exports.execute = execute;
|
|
11
|
+
const auth_js_1 = require("../../shared/auth.js");
|
|
12
|
+
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
13
|
+
exports.toolDefinition = {
|
|
14
|
+
name: 'snow_create_flow_action',
|
|
15
|
+
description: 'Create custom IntegrationHub action for Flow Designer',
|
|
16
|
+
category: 'integration',
|
|
17
|
+
subcategory: 'integrationhub',
|
|
18
|
+
use_cases: ['flow-designer', 'integration-hub', 'custom-actions', 'automation'],
|
|
19
|
+
complexity: 'advanced',
|
|
20
|
+
frequency: 'medium',
|
|
21
|
+
permission: 'write',
|
|
22
|
+
allowedRoles: ['developer', 'admin'],
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
name: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Action name (e.g., "Create Jira Issue", "Send Slack Message")'
|
|
29
|
+
},
|
|
30
|
+
description: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Description of what the action does'
|
|
33
|
+
},
|
|
34
|
+
category: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Category for organizing the action',
|
|
37
|
+
default: 'Custom'
|
|
38
|
+
},
|
|
39
|
+
action_type: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
enum: ['rest', 'script', 'subflow', 'powershell', 'ssh'],
|
|
42
|
+
description: 'Type of action implementation',
|
|
43
|
+
default: 'rest'
|
|
44
|
+
},
|
|
45
|
+
connection_alias: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'sys_id or name of connection alias to use'
|
|
48
|
+
},
|
|
49
|
+
inputs: {
|
|
50
|
+
type: 'array',
|
|
51
|
+
description: 'Input parameters for the action',
|
|
52
|
+
items: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
name: { type: 'string', description: 'Input parameter name' },
|
|
56
|
+
label: { type: 'string', description: 'Display label' },
|
|
57
|
+
type: { type: 'string', enum: ['string', 'integer', 'boolean', 'reference', 'object', 'array'], description: 'Data type' },
|
|
58
|
+
mandatory: { type: 'boolean', description: 'Is input required' },
|
|
59
|
+
default_value: { type: 'string', description: 'Default value' }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
outputs: {
|
|
64
|
+
type: 'array',
|
|
65
|
+
description: 'Output parameters for the action',
|
|
66
|
+
items: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
properties: {
|
|
69
|
+
name: { type: 'string', description: 'Output parameter name' },
|
|
70
|
+
label: { type: 'string', description: 'Display label' },
|
|
71
|
+
type: { type: 'string', enum: ['string', 'integer', 'boolean', 'reference', 'object', 'array'], description: 'Data type' }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
rest_config: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
description: 'REST action configuration (for rest action_type)',
|
|
78
|
+
properties: {
|
|
79
|
+
http_method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] },
|
|
80
|
+
endpoint_path: { type: 'string', description: 'Relative endpoint path (can use {{input.param}} syntax)' },
|
|
81
|
+
request_body: { type: 'string', description: 'Request body template (JSON with {{input.param}} placeholders)' },
|
|
82
|
+
headers: { type: 'object', description: 'Additional headers' },
|
|
83
|
+
content_type: { type: 'string', default: 'application/json' }
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
script_config: {
|
|
87
|
+
type: 'object',
|
|
88
|
+
description: 'Script action configuration (for script action_type)',
|
|
89
|
+
properties: {
|
|
90
|
+
script: { type: 'string', description: 'ES5 JavaScript script to execute' }
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
active: {
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
description: 'Whether the action is active',
|
|
96
|
+
default: true
|
|
97
|
+
},
|
|
98
|
+
annotation: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
description: 'Annotation/label for the action in Flow Designer'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
required: ['name']
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
async function execute(args, context) {
|
|
107
|
+
var name = args.name;
|
|
108
|
+
var description = args.description || '';
|
|
109
|
+
var category = args.category || 'Custom';
|
|
110
|
+
var action_type = args.action_type || 'rest';
|
|
111
|
+
var connection_alias = args.connection_alias || '';
|
|
112
|
+
var inputs = args.inputs || [];
|
|
113
|
+
var outputs = args.outputs || [];
|
|
114
|
+
var rest_config = args.rest_config || {};
|
|
115
|
+
var script_config = args.script_config || {};
|
|
116
|
+
var active = args.active !== false;
|
|
117
|
+
var annotation = args.annotation || '';
|
|
118
|
+
try {
|
|
119
|
+
var client = await (0, auth_js_1.getAuthenticatedClient)(context);
|
|
120
|
+
var usedBackgroundScript = false;
|
|
121
|
+
// Resolve connection alias if name provided
|
|
122
|
+
var connectionAliasId = connection_alias;
|
|
123
|
+
if (connection_alias && !connection_alias.match(/^[a-f0-9]{32}$/)) {
|
|
124
|
+
var aliasLookup = await client.get('/api/now/table/sys_alias', {
|
|
125
|
+
params: {
|
|
126
|
+
sysparm_query: 'name=' + connection_alias,
|
|
127
|
+
sysparm_limit: 1,
|
|
128
|
+
sysparm_fields: 'sys_id'
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
if (aliasLookup.data.result && aliasLookup.data.result.length > 0) {
|
|
132
|
+
connectionAliasId = aliasLookup.data.result[0].sys_id;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Create the action type definition
|
|
136
|
+
var actionData = {
|
|
137
|
+
name: name,
|
|
138
|
+
description: description,
|
|
139
|
+
category: category,
|
|
140
|
+
active: active,
|
|
141
|
+
annotation: annotation
|
|
142
|
+
};
|
|
143
|
+
if (connectionAliasId) {
|
|
144
|
+
actionData.connection_alias = connectionAliasId;
|
|
145
|
+
}
|
|
146
|
+
var actionResponse;
|
|
147
|
+
try {
|
|
148
|
+
actionResponse = await client.post('/api/now/table/sys_hub_action_type_definition', actionData);
|
|
149
|
+
}
|
|
150
|
+
catch (tableError) {
|
|
151
|
+
if (tableError.response?.status === 403) {
|
|
152
|
+
usedBackgroundScript = true;
|
|
153
|
+
var script = `
|
|
154
|
+
var gr = new GlideRecord('sys_hub_action_type_definition');
|
|
155
|
+
gr.initialize();
|
|
156
|
+
gr.name = ${JSON.stringify(name)};
|
|
157
|
+
gr.description = ${JSON.stringify(description)};
|
|
158
|
+
gr.category = ${JSON.stringify(category)};
|
|
159
|
+
gr.active = ${active};
|
|
160
|
+
gr.annotation = ${JSON.stringify(annotation)};
|
|
161
|
+
${connectionAliasId ? `gr.connection_alias = ${JSON.stringify(connectionAliasId)};` : ''}
|
|
162
|
+
var sysId = gr.insert();
|
|
163
|
+
|
|
164
|
+
if (sysId) {
|
|
165
|
+
gs.print(JSON.stringify({
|
|
166
|
+
sys_id: sysId,
|
|
167
|
+
name: gr.name.toString()
|
|
168
|
+
}));
|
|
169
|
+
} else {
|
|
170
|
+
gs.error('Failed to create action');
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
173
|
+
var scriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
174
|
+
script: script,
|
|
175
|
+
description: 'Create Flow action: ' + name
|
|
176
|
+
});
|
|
177
|
+
var output = scriptResponse.data.result?.output || '';
|
|
178
|
+
var match = output.match(/\{[^}]+\}/);
|
|
179
|
+
if (match) {
|
|
180
|
+
actionResponse = { data: { result: JSON.parse(match[0]) } };
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
throw new Error('Failed to create action via background script');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
throw tableError;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var action = actionResponse.data.result;
|
|
191
|
+
// Create input parameters
|
|
192
|
+
var createdInputs = [];
|
|
193
|
+
for (var i = 0; i < inputs.length; i++) {
|
|
194
|
+
var input = inputs[i];
|
|
195
|
+
var inputData = {
|
|
196
|
+
action_type: action.sys_id,
|
|
197
|
+
name: input.name,
|
|
198
|
+
label: input.label || input.name,
|
|
199
|
+
type: input.type || 'string',
|
|
200
|
+
mandatory: input.mandatory || false,
|
|
201
|
+
default_value: input.default_value || ''
|
|
202
|
+
};
|
|
203
|
+
try {
|
|
204
|
+
var inputResponse = await client.post('/api/now/table/sys_hub_action_input', inputData);
|
|
205
|
+
createdInputs.push({
|
|
206
|
+
sys_id: inputResponse.data.result.sys_id,
|
|
207
|
+
name: input.name,
|
|
208
|
+
type: input.type || 'string'
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
catch (inputError) {
|
|
212
|
+
if (inputError.response?.status === 403) {
|
|
213
|
+
var inputScript = `
|
|
214
|
+
var gr = new GlideRecord('sys_hub_action_input');
|
|
215
|
+
gr.initialize();
|
|
216
|
+
gr.action_type = ${JSON.stringify(action.sys_id)};
|
|
217
|
+
gr.name = ${JSON.stringify(input.name)};
|
|
218
|
+
gr.label = ${JSON.stringify(input.label || input.name)};
|
|
219
|
+
gr.type = ${JSON.stringify(input.type || 'string')};
|
|
220
|
+
gr.mandatory = ${input.mandatory || false};
|
|
221
|
+
gr.default_value = ${JSON.stringify(input.default_value || '')};
|
|
222
|
+
var sysId = gr.insert();
|
|
223
|
+
if (sysId) {
|
|
224
|
+
gs.print(JSON.stringify({ sys_id: sysId, name: ${JSON.stringify(input.name)} }));
|
|
225
|
+
}
|
|
226
|
+
`;
|
|
227
|
+
var inputScriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
228
|
+
script: inputScript,
|
|
229
|
+
description: 'Create action input: ' + input.name
|
|
230
|
+
});
|
|
231
|
+
var inputOutput = inputScriptResponse.data.result?.output || '';
|
|
232
|
+
var inputMatch = inputOutput.match(/\{[^}]+\}/);
|
|
233
|
+
if (inputMatch) {
|
|
234
|
+
createdInputs.push(JSON.parse(inputMatch[0]));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// Create output parameters
|
|
240
|
+
var createdOutputs = [];
|
|
241
|
+
for (var j = 0; j < outputs.length; j++) {
|
|
242
|
+
var outputParam = outputs[j];
|
|
243
|
+
var outputData = {
|
|
244
|
+
action_type: action.sys_id,
|
|
245
|
+
name: outputParam.name,
|
|
246
|
+
label: outputParam.label || outputParam.name,
|
|
247
|
+
type: outputParam.type || 'string'
|
|
248
|
+
};
|
|
249
|
+
try {
|
|
250
|
+
var outputResponse = await client.post('/api/now/table/sys_hub_action_output', outputData);
|
|
251
|
+
createdOutputs.push({
|
|
252
|
+
sys_id: outputResponse.data.result.sys_id,
|
|
253
|
+
name: outputParam.name,
|
|
254
|
+
type: outputParam.type || 'string'
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
catch (outputError) {
|
|
258
|
+
if (outputError.response?.status === 403) {
|
|
259
|
+
var outputScript = `
|
|
260
|
+
var gr = new GlideRecord('sys_hub_action_output');
|
|
261
|
+
gr.initialize();
|
|
262
|
+
gr.action_type = ${JSON.stringify(action.sys_id)};
|
|
263
|
+
gr.name = ${JSON.stringify(outputParam.name)};
|
|
264
|
+
gr.label = ${JSON.stringify(outputParam.label || outputParam.name)};
|
|
265
|
+
gr.type = ${JSON.stringify(outputParam.type || 'string')};
|
|
266
|
+
var sysId = gr.insert();
|
|
267
|
+
if (sysId) {
|
|
268
|
+
gs.print(JSON.stringify({ sys_id: sysId, name: ${JSON.stringify(outputParam.name)} }));
|
|
269
|
+
}
|
|
270
|
+
`;
|
|
271
|
+
var outputScriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
272
|
+
script: outputScript,
|
|
273
|
+
description: 'Create action output: ' + outputParam.name
|
|
274
|
+
});
|
|
275
|
+
var outputOutput = outputScriptResponse.data.result?.output || '';
|
|
276
|
+
var outputMatch = outputOutput.match(/\{[^}]+\}/);
|
|
277
|
+
if (outputMatch) {
|
|
278
|
+
createdOutputs.push(JSON.parse(outputMatch[0]));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// Create action step based on type
|
|
284
|
+
var stepCreated = null;
|
|
285
|
+
if (action_type === 'rest' && rest_config.http_method) {
|
|
286
|
+
var restStepData = {
|
|
287
|
+
action_type: action.sys_id,
|
|
288
|
+
name: name + ' - REST Step',
|
|
289
|
+
step_type: 'rest',
|
|
290
|
+
http_method: rest_config.http_method,
|
|
291
|
+
rest_endpoint: rest_config.endpoint_path || '',
|
|
292
|
+
request_body: rest_config.request_body || '',
|
|
293
|
+
content_type: rest_config.content_type || 'application/json'
|
|
294
|
+
};
|
|
295
|
+
try {
|
|
296
|
+
var restStepResponse = await client.post('/api/now/table/sys_hub_step_ext', restStepData);
|
|
297
|
+
stepCreated = {
|
|
298
|
+
sys_id: restStepResponse.data.result.sys_id,
|
|
299
|
+
type: 'rest',
|
|
300
|
+
http_method: rest_config.http_method
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
catch (stepError) {
|
|
304
|
+
// Step creation failed, but action is still created
|
|
305
|
+
stepCreated = null;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
else if (action_type === 'script' && script_config.script) {
|
|
309
|
+
var scriptStepData = {
|
|
310
|
+
action_type: action.sys_id,
|
|
311
|
+
name: name + ' - Script Step',
|
|
312
|
+
step_type: 'script',
|
|
313
|
+
script: script_config.script
|
|
314
|
+
};
|
|
315
|
+
try {
|
|
316
|
+
var scriptStepResponse = await client.post('/api/now/table/sys_hub_step_ext', scriptStepData);
|
|
317
|
+
stepCreated = {
|
|
318
|
+
sys_id: scriptStepResponse.data.result.sys_id,
|
|
319
|
+
type: 'script'
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
catch (stepError) {
|
|
323
|
+
stepCreated = null;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
327
|
+
created: true,
|
|
328
|
+
method: usedBackgroundScript ? 'background_script' : 'table_api',
|
|
329
|
+
action: {
|
|
330
|
+
sys_id: action.sys_id,
|
|
331
|
+
name: action.name || name,
|
|
332
|
+
category: category,
|
|
333
|
+
action_type: action_type,
|
|
334
|
+
active: active
|
|
335
|
+
},
|
|
336
|
+
inputs: createdInputs,
|
|
337
|
+
outputs: createdOutputs,
|
|
338
|
+
step: stepCreated,
|
|
339
|
+
connection_alias: connectionAliasId || null,
|
|
340
|
+
usage: [
|
|
341
|
+
'Action is now available in Flow Designer',
|
|
342
|
+
'Use in flows via "Action" step type',
|
|
343
|
+
'Access inputs with inputs.parameter_name',
|
|
344
|
+
'Set outputs with outputs.parameter_name = value'
|
|
345
|
+
]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
if (error.response?.status === 403) {
|
|
350
|
+
return (0, error_handler_js_1.createErrorResult)('Permission denied (403): Your ServiceNow user lacks permissions to create Flow actions. ' +
|
|
351
|
+
'Required roles: "flow_designer" or "admin". Please contact your ServiceNow administrator.');
|
|
352
|
+
}
|
|
353
|
+
return (0, error_handler_js_1.createErrorResult)(error.message);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
exports.version = '1.0.0';
|
|
357
|
+
exports.author = 'Snow-Flow Team';
|
|
358
|
+
//# sourceMappingURL=snow_create_flow_action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_create_flow_action.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/integration/snow_create_flow_action.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAqGH,0BAuQC;AAzWD,kDAA8D;AAC9D,oEAAuF;AAE1E,QAAA,cAAc,GAAsB;IAC/C,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,uDAAuD;IACpE,QAAQ,EAAE,aAAa;IACvB,WAAW,EAAE,gBAAgB;IAC7B,SAAS,EAAE,CAAC,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,YAAY,CAAC;IAC/E,UAAU,EAAE,UAAU;IACtB,SAAS,EAAE,QAAQ;IAEnB,UAAU,EAAE,OAAO;IACnB,YAAY,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;IACpC,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+DAA+D;aAC7E;YACD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AAQ,EAAE,MAAM,KAAK,GAAG,EAAE,CAAC;YACnC,OAAO,IAAA,oCAAiB,EACtB,0FAA0F;gBAC1F,2FAA2F,CAC5F,CAAC;QACJ,CAAC;QACD,OAAO,IAAA,oCAAiB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAEY,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* snow_create_oauth_profile - Create OAuth profiles for external integrations
|
|
3
|
+
*
|
|
4
|
+
* Create and configure OAuth 2.0 profiles for authenticating with external
|
|
5
|
+
* APIs and services like Jira, Azure, Salesforce, etc.
|
|
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 Team";
|
|
12
|
+
//# sourceMappingURL=snow_create_oauth_profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_create_oauth_profile.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBAkE5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAqKxF;AAED,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* snow_create_oauth_profile - Create OAuth profiles for external integrations
|
|
4
|
+
*
|
|
5
|
+
* Create and configure OAuth 2.0 profiles for authenticating with external
|
|
6
|
+
* APIs and services like Jira, Azure, Salesforce, etc.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.author = exports.version = exports.toolDefinition = void 0;
|
|
10
|
+
exports.execute = execute;
|
|
11
|
+
const auth_js_1 = require("../../shared/auth.js");
|
|
12
|
+
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
13
|
+
exports.toolDefinition = {
|
|
14
|
+
name: 'snow_create_oauth_profile',
|
|
15
|
+
description: 'Create OAuth 2.0 profile for external API authentication (Jira, Azure, Salesforce, etc.)',
|
|
16
|
+
category: 'integration',
|
|
17
|
+
subcategory: 'oauth',
|
|
18
|
+
use_cases: ['oauth', 'authentication', 'integration', 'external-api'],
|
|
19
|
+
complexity: 'intermediate',
|
|
20
|
+
frequency: 'medium',
|
|
21
|
+
permission: 'write',
|
|
22
|
+
allowedRoles: ['developer', 'admin'],
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
name: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'OAuth profile name (e.g., "Jira Cloud OAuth", "Azure AD")'
|
|
29
|
+
},
|
|
30
|
+
grant_type: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['authorization_code', 'client_credentials', 'password', 'refresh_token', 'jwt_bearer'],
|
|
33
|
+
description: 'OAuth grant type',
|
|
34
|
+
default: 'client_credentials'
|
|
35
|
+
},
|
|
36
|
+
client_id: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'OAuth client ID'
|
|
39
|
+
},
|
|
40
|
+
client_secret: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'OAuth client secret (stored securely)'
|
|
43
|
+
},
|
|
44
|
+
token_url: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Token endpoint URL (e.g., https://oauth.provider.com/token)'
|
|
47
|
+
},
|
|
48
|
+
authorization_url: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: 'Authorization endpoint URL (for authorization_code grant)'
|
|
51
|
+
},
|
|
52
|
+
redirect_url: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
description: 'Redirect URL after authorization'
|
|
55
|
+
},
|
|
56
|
+
scope: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: 'OAuth scopes (space-separated)'
|
|
59
|
+
},
|
|
60
|
+
default_headers: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
description: 'Default headers to include in token requests'
|
|
63
|
+
},
|
|
64
|
+
send_credentials: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
enum: ['header', 'body'],
|
|
67
|
+
description: 'How to send client credentials',
|
|
68
|
+
default: 'header'
|
|
69
|
+
},
|
|
70
|
+
active: {
|
|
71
|
+
type: 'boolean',
|
|
72
|
+
description: 'Whether the profile is active',
|
|
73
|
+
default: true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
required: ['name', 'client_id', 'token_url']
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
async function execute(args, context) {
|
|
80
|
+
var name = args.name;
|
|
81
|
+
var grant_type = args.grant_type || 'client_credentials';
|
|
82
|
+
var client_id = args.client_id;
|
|
83
|
+
var client_secret = args.client_secret || '';
|
|
84
|
+
var token_url = args.token_url;
|
|
85
|
+
var authorization_url = args.authorization_url || '';
|
|
86
|
+
var redirect_url = args.redirect_url || '';
|
|
87
|
+
var scope = args.scope || '';
|
|
88
|
+
var default_headers = args.default_headers || {};
|
|
89
|
+
var send_credentials = args.send_credentials || 'header';
|
|
90
|
+
var active = args.active !== false;
|
|
91
|
+
try {
|
|
92
|
+
var client = await (0, auth_js_1.getAuthenticatedClient)(context);
|
|
93
|
+
// First, create the OAuth entity provider
|
|
94
|
+
var providerData = {
|
|
95
|
+
name: name,
|
|
96
|
+
type: 'oauth_provider',
|
|
97
|
+
active: active
|
|
98
|
+
};
|
|
99
|
+
var providerResponse;
|
|
100
|
+
var usedBackgroundScript = false;
|
|
101
|
+
try {
|
|
102
|
+
providerResponse = await client.post('/api/now/table/oauth_entity', providerData);
|
|
103
|
+
}
|
|
104
|
+
catch (tableError) {
|
|
105
|
+
if (tableError.response?.status === 403) {
|
|
106
|
+
usedBackgroundScript = true;
|
|
107
|
+
// Fallback to background script
|
|
108
|
+
var script = `
|
|
109
|
+
var gr = new GlideRecord('oauth_entity');
|
|
110
|
+
gr.initialize();
|
|
111
|
+
gr.name = ${JSON.stringify(name)};
|
|
112
|
+
gr.type = 'oauth_provider';
|
|
113
|
+
gr.active = ${active};
|
|
114
|
+
var sysId = gr.insert();
|
|
115
|
+
|
|
116
|
+
if (sysId) {
|
|
117
|
+
gs.print(JSON.stringify({
|
|
118
|
+
sys_id: sysId,
|
|
119
|
+
name: gr.name.toString()
|
|
120
|
+
}));
|
|
121
|
+
} else {
|
|
122
|
+
gs.error('Failed to create OAuth entity');
|
|
123
|
+
}
|
|
124
|
+
`;
|
|
125
|
+
var scriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
126
|
+
script: script,
|
|
127
|
+
description: 'Create OAuth entity: ' + name
|
|
128
|
+
});
|
|
129
|
+
var output = scriptResponse.data.result?.output || '';
|
|
130
|
+
var match = output.match(/\{[^}]+\}/);
|
|
131
|
+
if (match) {
|
|
132
|
+
providerResponse = { data: { result: JSON.parse(match[0]) } };
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
throw new Error('Failed to create OAuth entity via background script');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
throw tableError;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
var entityId = providerResponse.data.result.sys_id;
|
|
143
|
+
// Now create the OAuth profile with credentials
|
|
144
|
+
var profileData = {
|
|
145
|
+
name: name + ' Profile',
|
|
146
|
+
oauth_entity: entityId,
|
|
147
|
+
grant_type: grant_type,
|
|
148
|
+
client_id: client_id,
|
|
149
|
+
client_secret: client_secret,
|
|
150
|
+
token_url: token_url,
|
|
151
|
+
auth_url: authorization_url,
|
|
152
|
+
redirect_url: redirect_url,
|
|
153
|
+
default_grant_type: grant_type,
|
|
154
|
+
send_credentials: send_credentials
|
|
155
|
+
};
|
|
156
|
+
if (scope) {
|
|
157
|
+
profileData.scope = scope;
|
|
158
|
+
}
|
|
159
|
+
var profileResponse;
|
|
160
|
+
try {
|
|
161
|
+
profileResponse = await client.post('/api/now/table/oauth_entity_profile', profileData);
|
|
162
|
+
}
|
|
163
|
+
catch (profileError) {
|
|
164
|
+
if (profileError.response?.status === 403) {
|
|
165
|
+
usedBackgroundScript = true;
|
|
166
|
+
var profileScript = `
|
|
167
|
+
var gr = new GlideRecord('oauth_entity_profile');
|
|
168
|
+
gr.initialize();
|
|
169
|
+
gr.name = ${JSON.stringify(name + ' Profile')};
|
|
170
|
+
gr.oauth_entity = ${JSON.stringify(entityId)};
|
|
171
|
+
gr.grant_type = ${JSON.stringify(grant_type)};
|
|
172
|
+
gr.client_id = ${JSON.stringify(client_id)};
|
|
173
|
+
gr.client_secret = ${JSON.stringify(client_secret)};
|
|
174
|
+
gr.token_url = ${JSON.stringify(token_url)};
|
|
175
|
+
gr.auth_url = ${JSON.stringify(authorization_url)};
|
|
176
|
+
gr.redirect_url = ${JSON.stringify(redirect_url)};
|
|
177
|
+
gr.default_grant_type = ${JSON.stringify(grant_type)};
|
|
178
|
+
gr.send_credentials = ${JSON.stringify(send_credentials)};
|
|
179
|
+
${scope ? `gr.scope = ${JSON.stringify(scope)};` : ''}
|
|
180
|
+
var sysId = gr.insert();
|
|
181
|
+
|
|
182
|
+
if (sysId) {
|
|
183
|
+
gs.print(JSON.stringify({
|
|
184
|
+
sys_id: sysId,
|
|
185
|
+
name: gr.name.toString(),
|
|
186
|
+
grant_type: gr.grant_type.toString()
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
`;
|
|
190
|
+
var profileScriptResponse = await client.post('/api/now/table/sys_script_execution', {
|
|
191
|
+
script: profileScript,
|
|
192
|
+
description: 'Create OAuth profile: ' + name
|
|
193
|
+
});
|
|
194
|
+
var profileOutput = profileScriptResponse.data.result?.output || '';
|
|
195
|
+
var profileMatch = profileOutput.match(/\{[^}]+\}/);
|
|
196
|
+
if (profileMatch) {
|
|
197
|
+
profileResponse = { data: { result: JSON.parse(profileMatch[0]) } };
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
throw new Error('Failed to create OAuth profile via background script');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
throw profileError;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
var profile = profileResponse.data.result;
|
|
208
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
209
|
+
created: true,
|
|
210
|
+
method: usedBackgroundScript ? 'background_script' : 'table_api',
|
|
211
|
+
oauth_entity: {
|
|
212
|
+
sys_id: entityId,
|
|
213
|
+
name: name
|
|
214
|
+
},
|
|
215
|
+
oauth_profile: {
|
|
216
|
+
sys_id: profile.sys_id,
|
|
217
|
+
name: profile.name,
|
|
218
|
+
grant_type: grant_type,
|
|
219
|
+
token_url: token_url,
|
|
220
|
+
scope: scope || 'none specified'
|
|
221
|
+
},
|
|
222
|
+
next_steps: grant_type === 'authorization_code'
|
|
223
|
+
? ['Navigate to OAuth profile in ServiceNow', 'Click "Get OAuth Token" to complete authorization flow']
|
|
224
|
+
: ['OAuth profile is ready to use', 'Reference this profile in your REST messages or integrations']
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
if (error.response?.status === 403) {
|
|
229
|
+
return (0, error_handler_js_1.createErrorResult)('Permission denied (403): Your ServiceNow user lacks permissions to create OAuth profiles. ' +
|
|
230
|
+
'Required roles: "oauth_admin" or "admin". Please contact your ServiceNow administrator.');
|
|
231
|
+
}
|
|
232
|
+
return (0, error_handler_js_1.createErrorResult)(error.message);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
exports.version = '1.0.0';
|
|
236
|
+
exports.author = 'Snow-Flow Team';
|
|
237
|
+
//# sourceMappingURL=snow_create_oauth_profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_create_oauth_profile.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/integration/snow_create_oauth_profile.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA0EH,0BAqKC;AA5OD,kDAA8D;AAC9D,oEAAuF;AAE1E,QAAA,cAAc,GAAsB;IAC/C,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,0FAA0F;IACvG,QAAQ,EAAE,aAAa;IACvB,WAAW,EAAE,OAAO;IACpB,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,CAAC;IACrE,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,QAAQ;IAEnB,UAAU,EAAE,OAAO;IACnB,YAAY,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;IACpC,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2DAA2D;aACzE;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,CAAC;gBAC7F,WAAW,EAAE,kBAAkB;gBAC/B,OAAO,EAAE,oBAAoB;aAC9B;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iBAAiB;aAC/B;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EA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M,EAAE,QAAQ;gBAChB,IAAI,EAAE,IAAI;aACX;YACD,aAAa,EAAE;gBACb,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,UAAU,EAAE,UAAU;gBACtB,SAAS,EAAE,SAAS;gBACpB,KAAK,EAAE,KAAK,IAAI,gBAAgB;aACjC;YACD,UAAU,EAAE,UAAU,KAAK,oBAAoB;gBAC7C,CAAC,CAAC,CAAC,yCAAyC,EAAE,wDAAwD,CAAC;gBACvG,CAAC,CAAC,CAAC,+BAA+B,EAAE,8DAA8D,CAAC;SACtG,CAAC,CAAC;IAEL,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG,EAAE,CAAC;YACnC,OAAO,IAAA,oCAAiB,EACtB,4FAA4F;gBAC5F,yFAAyF,CAC1F,CAAC;QACJ,CAAC;QACD,OAAO,IAAA,oCAAiB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAEY,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* snow_install_spoke - Install and manage IntegrationHub Spokes
|
|
3
|
+
*
|
|
4
|
+
* Install, activate, and configure IntegrationHub Spokes from the
|
|
5
|
+
* ServiceNow Store or custom repositories (Jira, Slack, Azure, etc.).
|
|
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 Team";
|
|
12
|
+
//# sourceMappingURL=snow_install_spoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow_install_spoke.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/integration/snow_install_spoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBA6C5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAwSxF;AAED,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,mBAAmB,CAAC"}
|