snow-flow 1.4.37 → 1.4.39
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-flow/metrics/system-metrics.json +1524 -0
- package/CLAUDE.md +0 -8
- package/README.md +2 -10
- package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts.map +1 -1
- package/dist/mcp/servicenow-deployment-mcp-refactored.js.map +1 -1
- package/dist/mcp/servicenow-deployment-mcp.js +0 -110
- package/dist/mcp/servicenow-deployment-mcp.js.map +1 -1
- package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -3
- package/dist/mcp/servicenow-intelligent-mcp.d.ts.map +1 -1
- package/dist/mcp/servicenow-intelligent-mcp.js +129 -575
- package/dist/mcp/servicenow-intelligent-mcp.js.map +1 -1
- package/dist/mcp/servicenow-operations-mcp-refactored.d.ts +0 -2
- package/dist/mcp/servicenow-operations-mcp-refactored.d.ts.map +1 -1
- package/dist/mcp/servicenow-operations-mcp-refactored.js +0 -144
- package/dist/mcp/servicenow-operations-mcp-refactored.js.map +1 -1
- package/dist/mcp/servicenow-operations-mcp.js +1 -769
- package/dist/mcp/servicenow-operations-mcp.js.map +1 -1
- package/dist/mcp/snow-flow-mcp.js +66 -129
- package/dist/mcp/snow-flow-mcp.js.map +1 -1
- package/dist/mcp/start-all-mcp-servers.js +0 -8
- package/dist/mcp/start-all-mcp-servers.js.map +1 -1
- package/dist/version.d.ts +3 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +17 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -160,40 +160,13 @@ class ServiceNowIntelligentMCP {
|
|
|
160
160
|
},
|
|
161
161
|
},
|
|
162
162
|
},
|
|
163
|
-
{
|
|
164
|
-
name: 'snow_discover_existing_flows',
|
|
165
|
-
description: 'SMART flow discovery - finds existing flows to prevent duplication, analyzes similarities, suggests reuse or modification instead of creating new flows.',
|
|
166
|
-
inputSchema: {
|
|
167
|
-
type: 'object',
|
|
168
|
-
properties: {
|
|
169
|
-
flow_purpose: { type: 'string', description: 'Description of what the new flow should do' },
|
|
170
|
-
include_inactive: { type: 'boolean', description: 'Include inactive flows in search', default: false },
|
|
171
|
-
similarity_threshold: { type: 'number', description: 'Minimum similarity score (0.0-1.0)', default: 0.7 },
|
|
172
|
-
},
|
|
173
|
-
required: ['flow_purpose'],
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: 'snow_test_flow_execution',
|
|
178
|
-
description: 'LIVE flow testing - executes flows in the live ServiceNow instance with test data, monitors execution, provides detailed results and performance metrics.',
|
|
179
|
-
inputSchema: {
|
|
180
|
-
type: 'object',
|
|
181
|
-
properties: {
|
|
182
|
-
flow_sys_id: { type: 'string', description: 'Sys ID of the flow to test' },
|
|
183
|
-
test_data: { type: 'object', description: 'Test input data for the flow' },
|
|
184
|
-
monitor_execution: { type: 'boolean', description: 'Monitor detailed execution steps', default: true },
|
|
185
|
-
timeout_seconds: { type: 'number', description: 'Test timeout in seconds', default: 300 },
|
|
186
|
-
},
|
|
187
|
-
required: ['flow_sys_id'],
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
163
|
{
|
|
191
164
|
name: 'batch_deployment_validator',
|
|
192
165
|
description: 'COMPREHENSIVE batch validation - validates multiple deployments simultaneously, checks dependencies, conflicts, and provides rollback recommendations.',
|
|
193
166
|
inputSchema: {
|
|
194
167
|
type: 'object',
|
|
195
168
|
properties: {
|
|
196
|
-
artifacts: { type: 'array', items: { type: 'object', properties: {
|
|
169
|
+
artifacts: { type: 'array', items: { type: 'object', properties: { type: { type: 'string' }, sys_id: { type: 'string' }, table: { type: 'string' } } }, description: 'List of artifacts to validate' },
|
|
197
170
|
validation_level: { type: 'string', enum: ['syntax', 'dependencies', 'full'], description: 'Level of validation', default: 'full' },
|
|
198
171
|
check_conflicts: { type: 'boolean', description: 'Check for conflicts between artifacts', default: true },
|
|
199
172
|
},
|
|
@@ -294,217 +267,9 @@ class ServiceNowIntelligentMCP {
|
|
|
294
267
|
required: ['artifacts'],
|
|
295
268
|
},
|
|
296
269
|
},
|
|
297
|
-
{
|
|
298
|
-
name: 'snow_comprehensive_flow_test',
|
|
299
|
-
description: 'COMPREHENSIVE FLOW TESTING - Advanced flow testing with automatic test data generation, edge case detection, performance validation, and integration testing.',
|
|
300
|
-
inputSchema: {
|
|
301
|
-
type: 'object',
|
|
302
|
-
properties: {
|
|
303
|
-
flow_sys_id: { type: 'string', description: 'Flow sys_id to test' },
|
|
304
|
-
test_data_generation: { type: 'string', enum: ['automatic', 'manual', 'hybrid'], description: 'Test data generation method', default: 'automatic' },
|
|
305
|
-
edge_case_detection: { type: 'boolean', description: 'Enable edge case detection', default: true },
|
|
306
|
-
performance_validation: { type: 'boolean', description: 'Enable performance validation', default: true },
|
|
307
|
-
integration_testing: { type: 'boolean', description: 'Enable integration testing', default: true },
|
|
308
|
-
test_scenarios: { type: 'array', items: { type: 'object' }, description: 'Custom test scenarios' },
|
|
309
|
-
},
|
|
310
|
-
required: ['flow_sys_id'],
|
|
311
|
-
},
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
name: 'snow_verify_artifact_searchable',
|
|
315
|
-
description: '🔴 SNOW-002 FIX: Verify newly created artifact is searchable - Use immediately after creating artifacts to ensure they can be found in search',
|
|
316
|
-
inputSchema: {
|
|
317
|
-
type: 'object',
|
|
318
|
-
properties: {
|
|
319
|
-
artifact_name: { type: 'string', description: 'Name of the artifact to verify' },
|
|
320
|
-
artifact_type: { type: 'string', description: 'Type of artifact (flow, widget, script, etc.)' },
|
|
321
|
-
expected_sys_id: { type: 'string', description: 'Expected sys_id (if known from creation)' },
|
|
322
|
-
max_wait_time: { type: 'number', description: 'Maximum wait time in seconds', default: 30 },
|
|
323
|
-
},
|
|
324
|
-
required: ['artifact_name', 'artifact_type'],
|
|
325
|
-
},
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
name: 'snow_generate_documentation',
|
|
329
|
-
description: '📚 SELF-DOCUMENTING SYSTEM - Automatically generate comprehensive documentation from code, flows, and system behavior without manual intervention.',
|
|
330
|
-
inputSchema: {
|
|
331
|
-
type: 'object',
|
|
332
|
-
properties: {
|
|
333
|
-
scope: { type: 'string', enum: ['full', 'partial', 'incremental'], default: 'full', description: 'Documentation scope' },
|
|
334
|
-
components: { type: 'array', items: { type: 'string' }, description: 'Specific components to document' },
|
|
335
|
-
format: { type: 'string', enum: ['markdown', 'html', 'pdf'], default: 'markdown', description: 'Output format' },
|
|
336
|
-
include_diagrams: { type: 'boolean', default: true, description: 'Include system diagrams' },
|
|
337
|
-
include_examples: { type: 'boolean', default: true, description: 'Include code examples' },
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
name: 'snow_documentation_suggestions',
|
|
343
|
-
description: '💡 Get intelligent documentation improvement suggestions based on current system state and best practices.',
|
|
344
|
-
inputSchema: {
|
|
345
|
-
type: 'object',
|
|
346
|
-
properties: {
|
|
347
|
-
profile_id: { type: 'string', description: 'Documentation profile ID (optional - uses latest if not provided)' },
|
|
348
|
-
},
|
|
349
|
-
},
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
name: 'snow_start_continuous_documentation',
|
|
353
|
-
description: '🔄 Start autonomous continuous documentation that monitors changes and updates documentation automatically.',
|
|
354
|
-
inputSchema: {
|
|
355
|
-
type: 'object',
|
|
356
|
-
properties: {
|
|
357
|
-
interval: { type: 'number', description: 'Update interval in milliseconds (default: 1 hour)' },
|
|
358
|
-
scope: { type: 'array', items: { type: 'string' }, description: 'Components to monitor' },
|
|
359
|
-
auto_commit: { type: 'boolean', default: false, description: 'Automatically commit documentation changes' },
|
|
360
|
-
},
|
|
361
|
-
},
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
name: 'snow_analyze_costs',
|
|
365
|
-
description: '💰 COST OPTIMIZATION ENGINE - Analyze AI usage costs and generate autonomous optimization recommendations.',
|
|
366
|
-
inputSchema: {
|
|
367
|
-
type: 'object',
|
|
368
|
-
properties: {
|
|
369
|
-
scope: { type: 'string', enum: ['all', 'service', 'agent', 'operation'], default: 'all', description: 'Analysis scope' },
|
|
370
|
-
target_reduction: { type: 'number', description: 'Target cost reduction percentage' },
|
|
371
|
-
auto_implement: { type: 'boolean', default: false, description: 'Automatically implement optimizations' },
|
|
372
|
-
testing_enabled: { type: 'boolean', default: true, description: 'Test optimizations before implementing' },
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
name: 'snow_cost_dashboard',
|
|
378
|
-
description: '📊 Get real-time cost optimization dashboard with current spending, savings, and recommendations.',
|
|
379
|
-
inputSchema: {
|
|
380
|
-
type: 'object',
|
|
381
|
-
properties: {},
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
name: 'snow_start_autonomous_cost_optimization',
|
|
386
|
-
description: '🤖 Start autonomous cost monitoring and optimization that automatically implements cost-saving strategies.',
|
|
387
|
-
inputSchema: {
|
|
388
|
-
type: 'object',
|
|
389
|
-
properties: {
|
|
390
|
-
target_savings: { type: 'number', description: 'Target savings percentage' },
|
|
391
|
-
check_interval: { type: 'number', description: 'Check interval in milliseconds' },
|
|
392
|
-
auto_implement_threshold: { type: 'number', description: 'Minimum savings to auto-implement ($)' },
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
name: 'snow_implement_cost_optimization',
|
|
398
|
-
description: '🔧 Manually implement a specific cost optimization recommendation.',
|
|
399
|
-
inputSchema: {
|
|
400
|
-
type: 'object',
|
|
401
|
-
properties: {
|
|
402
|
-
optimization_id: { type: 'string', description: 'Optimization ID to implement' },
|
|
403
|
-
test_first: { type: 'boolean', default: true, description: 'Test before implementing' },
|
|
404
|
-
rollback_on_failure: { type: 'boolean', default: true, description: 'Auto-rollback on failure' },
|
|
405
|
-
},
|
|
406
|
-
required: ['optimization_id'],
|
|
407
|
-
},
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
name: 'snow_assess_compliance',
|
|
411
|
-
description: '🔐 ADVANCED COMPLIANCE SYSTEM - Perform comprehensive compliance assessment across multiple frameworks.',
|
|
412
|
-
inputSchema: {
|
|
413
|
-
type: 'object',
|
|
414
|
-
properties: {
|
|
415
|
-
frameworks: { type: 'array', items: { type: 'string' }, description: 'Compliance frameworks to assess (SOX, GDPR, HIPAA, etc.)' },
|
|
416
|
-
scope: { type: 'string', enum: ['full', 'incremental', 'specific-controls'], default: 'full', description: 'Assessment scope' },
|
|
417
|
-
include_evidence: { type: 'boolean', default: true, description: 'Include compliance evidence' },
|
|
418
|
-
auto_remediate: { type: 'boolean', default: false, description: 'Automatically remediate violations' },
|
|
419
|
-
generate_report: { type: 'boolean', default: false, description: 'Generate compliance report' },
|
|
420
|
-
},
|
|
421
|
-
},
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
name: 'snow_compliance_dashboard',
|
|
425
|
-
description: '📊 Get real-time compliance dashboard with status, violations, and certifications.',
|
|
426
|
-
inputSchema: {
|
|
427
|
-
type: 'object',
|
|
428
|
-
properties: {},
|
|
429
|
-
},
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
name: 'snow_start_compliance_monitoring',
|
|
433
|
-
description: '🔄 Start continuous compliance monitoring with automatic violation detection and remediation.',
|
|
434
|
-
inputSchema: {
|
|
435
|
-
type: 'object',
|
|
436
|
-
properties: {
|
|
437
|
-
frameworks: { type: 'array', items: { type: 'string' }, description: 'Frameworks to monitor' },
|
|
438
|
-
check_interval: { type: 'number', description: 'Check interval in milliseconds' },
|
|
439
|
-
auto_remediate: { type: 'boolean', default: false, description: 'Enable auto-remediation' },
|
|
440
|
-
alert_threshold: { type: 'string', description: 'Alert threshold level' },
|
|
441
|
-
},
|
|
442
|
-
},
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
name: 'snow_execute_corrective_action',
|
|
446
|
-
description: '🔧 Execute a specific corrective action for compliance violations.',
|
|
447
|
-
inputSchema: {
|
|
448
|
-
type: 'object',
|
|
449
|
-
properties: {
|
|
450
|
-
action_id: { type: 'string', description: 'Corrective action ID' },
|
|
451
|
-
verify_first: { type: 'boolean', default: true, description: 'Verify safety before execution' },
|
|
452
|
-
generate_evidence: { type: 'boolean', default: true, description: 'Generate compliance evidence' },
|
|
453
|
-
},
|
|
454
|
-
required: ['action_id'],
|
|
455
|
-
},
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
name: 'snow_health_check',
|
|
459
|
-
description: '🏥 SELF-HEALING SYSTEM - Perform comprehensive system health check with autonomous error detection and healing.',
|
|
460
|
-
inputSchema: {
|
|
461
|
-
type: 'object',
|
|
462
|
-
properties: {
|
|
463
|
-
scope: { type: 'string', enum: ['full', 'incremental', 'specific-services'], default: 'full', description: 'Health check scope' },
|
|
464
|
-
services: { type: 'array', items: { type: 'string' }, description: 'Specific services to check' },
|
|
465
|
-
auto_heal: { type: 'boolean', default: false, description: 'Automatically heal detected issues' },
|
|
466
|
-
predictive: { type: 'boolean', default: true, description: 'Generate health predictions' },
|
|
467
|
-
learning: { type: 'boolean', default: true, description: 'Enable learning from patterns' },
|
|
468
|
-
},
|
|
469
|
-
},
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
name: 'snow_health_dashboard',
|
|
473
|
-
description: '📊 Get real-time system health dashboard with incidents, metrics, and predictions.',
|
|
474
|
-
inputSchema: {
|
|
475
|
-
type: 'object',
|
|
476
|
-
properties: {},
|
|
477
|
-
},
|
|
478
|
-
},
|
|
479
|
-
{
|
|
480
|
-
name: 'snow_start_autonomous_healing',
|
|
481
|
-
description: '🤖 Start autonomous self-healing that continuously monitors and repairs system issues automatically.',
|
|
482
|
-
inputSchema: {
|
|
483
|
-
type: 'object',
|
|
484
|
-
properties: {
|
|
485
|
-
check_interval: { type: 'number', description: 'Health check interval in milliseconds' },
|
|
486
|
-
healing_threshold: { type: 'number', description: 'Confidence threshold for auto-healing (0-1)' },
|
|
487
|
-
max_retries: { type: 'number', description: 'Maximum healing retry attempts' },
|
|
488
|
-
preventive: { type: 'boolean', default: true, description: 'Enable preventive healing' },
|
|
489
|
-
},
|
|
490
|
-
},
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
name: 'snow_execute_healing_action',
|
|
494
|
-
description: '💊 Manually execute a specific healing action for system recovery.',
|
|
495
|
-
inputSchema: {
|
|
496
|
-
type: 'object',
|
|
497
|
-
properties: {
|
|
498
|
-
action_id: { type: 'string', description: 'Healing action ID' },
|
|
499
|
-
verify: { type: 'boolean', default: true, description: 'Verify safety before execution' },
|
|
500
|
-
monitor: { type: 'boolean', default: true, description: 'Monitor healing progress' },
|
|
501
|
-
rollback_on_failure: { type: 'boolean', default: true, description: 'Auto-rollback on failure' },
|
|
502
|
-
},
|
|
503
|
-
required: ['action_id'],
|
|
504
|
-
},
|
|
505
|
-
},
|
|
506
270
|
],
|
|
507
271
|
}));
|
|
272
|
+
// Register tool handlers
|
|
508
273
|
this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
509
274
|
const { name, arguments: args } = request.params;
|
|
510
275
|
try {
|
|
@@ -527,10 +292,6 @@ class ServiceNowIntelligentMCP {
|
|
|
527
292
|
return await this.syncDataConsistency(args);
|
|
528
293
|
case 'snow_validate_live_connection':
|
|
529
294
|
return await this.validateLiveConnection(args);
|
|
530
|
-
case 'snow_discover_existing_flows':
|
|
531
|
-
return await this.discoverExistingFlows(args);
|
|
532
|
-
case 'snow_test_flow_execution':
|
|
533
|
-
return await this.testFlowExecution(args);
|
|
534
295
|
case 'batch_deployment_validator':
|
|
535
296
|
return await this.batchDeploymentValidator(args);
|
|
536
297
|
case 'deployment_rollback_manager':
|
|
@@ -545,8 +306,6 @@ class ServiceNowIntelligentMCP {
|
|
|
545
306
|
return await this.orchestrateDevelopment(args);
|
|
546
307
|
case 'snow_resilient_deployment':
|
|
547
308
|
return await this.resilientDeployment(args);
|
|
548
|
-
case 'snow_comprehensive_flow_test':
|
|
549
|
-
return await this.comprehensiveFlowTest(args);
|
|
550
309
|
case 'snow_verify_artifact_searchable':
|
|
551
310
|
return await this.verifyArtifactSearchable(args);
|
|
552
311
|
case 'snow_generate_documentation':
|
|
@@ -555,8 +314,134 @@ class ServiceNowIntelligentMCP {
|
|
|
555
314
|
return await this.getDocumentationSuggestions(args);
|
|
556
315
|
case 'snow_start_continuous_documentation':
|
|
557
316
|
return await this.startContinuousDocumentation(args);
|
|
317
|
+
case 'snow_analyze_costs':
|
|
318
|
+
const costRequest = {
|
|
319
|
+
scope: args.scope || 'all',
|
|
320
|
+
auto_implement: args.auto_implement || false,
|
|
321
|
+
target_reduction: args.target_reduction,
|
|
322
|
+
testing_enabled: args.testing_enabled !== false
|
|
323
|
+
};
|
|
324
|
+
const costResult = await this.costOptimizationEngine.analyzeCosts(costRequest);
|
|
325
|
+
return {
|
|
326
|
+
content: [
|
|
327
|
+
{
|
|
328
|
+
type: 'text',
|
|
329
|
+
text: JSON.stringify(costResult, null, 2)
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
};
|
|
333
|
+
case 'snow_cost_dashboard':
|
|
334
|
+
const dashboardResult = await this.costOptimizationEngine.getCostDashboard();
|
|
335
|
+
return {
|
|
336
|
+
content: [
|
|
337
|
+
{
|
|
338
|
+
type: 'text',
|
|
339
|
+
text: JSON.stringify(dashboardResult, null, 2)
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
};
|
|
343
|
+
case 'snow_start_autonomous_cost_optimization':
|
|
344
|
+
const startResult = await this.costOptimizationEngine.startAutonomousOptimization(args);
|
|
345
|
+
return {
|
|
346
|
+
content: [
|
|
347
|
+
{
|
|
348
|
+
type: 'text',
|
|
349
|
+
text: JSON.stringify(startResult, null, 2)
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
};
|
|
353
|
+
case 'snow_implement_cost_optimization':
|
|
354
|
+
const implementResult = await this.costOptimizationEngine.implementOptimization(String(args.optimization_id));
|
|
355
|
+
return {
|
|
356
|
+
content: [
|
|
357
|
+
{
|
|
358
|
+
type: 'text',
|
|
359
|
+
text: JSON.stringify(implementResult, null, 2)
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
};
|
|
363
|
+
case 'snow_assess_compliance':
|
|
364
|
+
const complianceResult = await this.complianceSystem.assessCompliance(args);
|
|
365
|
+
return {
|
|
366
|
+
content: [
|
|
367
|
+
{
|
|
368
|
+
type: 'text',
|
|
369
|
+
text: JSON.stringify(complianceResult, null, 2)
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
};
|
|
373
|
+
case 'snow_compliance_dashboard':
|
|
374
|
+
const complianceDashboard = await this.complianceSystem.getComplianceDashboard();
|
|
375
|
+
return {
|
|
376
|
+
content: [
|
|
377
|
+
{
|
|
378
|
+
type: 'text',
|
|
379
|
+
text: JSON.stringify(complianceDashboard, null, 2)
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
};
|
|
383
|
+
case 'snow_start_compliance_monitoring':
|
|
384
|
+
const monitoringResult = await this.complianceSystem.startContinuousMonitoring(args);
|
|
385
|
+
return {
|
|
386
|
+
content: [
|
|
387
|
+
{
|
|
388
|
+
type: 'text',
|
|
389
|
+
text: '✅ Compliance monitoring started successfully'
|
|
390
|
+
}
|
|
391
|
+
]
|
|
392
|
+
};
|
|
393
|
+
case 'snow_execute_corrective_action':
|
|
394
|
+
const actionResult = await this.complianceSystem.executeCorrectiveAction(String(args.action_id), args);
|
|
395
|
+
return {
|
|
396
|
+
content: [
|
|
397
|
+
{
|
|
398
|
+
type: 'text',
|
|
399
|
+
text: JSON.stringify(actionResult, null, 2)
|
|
400
|
+
}
|
|
401
|
+
]
|
|
402
|
+
};
|
|
403
|
+
case 'snow_health_check':
|
|
404
|
+
const healthResult = await this.selfHealingSystem.performHealthCheck(args);
|
|
405
|
+
return {
|
|
406
|
+
content: [
|
|
407
|
+
{
|
|
408
|
+
type: 'text',
|
|
409
|
+
text: JSON.stringify(healthResult, null, 2)
|
|
410
|
+
}
|
|
411
|
+
]
|
|
412
|
+
};
|
|
413
|
+
case 'snow_health_dashboard':
|
|
414
|
+
const healthDashboard = await this.selfHealingSystem.getHealthDashboard();
|
|
415
|
+
return {
|
|
416
|
+
content: [
|
|
417
|
+
{
|
|
418
|
+
type: 'text',
|
|
419
|
+
text: JSON.stringify(healthDashboard, null, 2)
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
};
|
|
423
|
+
case 'snow_start_autonomous_healing':
|
|
424
|
+
const healingStartResult = await this.selfHealingSystem.startAutonomousHealing(args);
|
|
425
|
+
return {
|
|
426
|
+
content: [
|
|
427
|
+
{
|
|
428
|
+
type: 'text',
|
|
429
|
+
text: '✅ Autonomous healing started successfully'
|
|
430
|
+
}
|
|
431
|
+
]
|
|
432
|
+
};
|
|
433
|
+
case 'snow_execute_healing_action':
|
|
434
|
+
const healingResult = await this.selfHealingSystem.executeHealingAction(String(args.action_id), args);
|
|
435
|
+
return {
|
|
436
|
+
content: [
|
|
437
|
+
{
|
|
438
|
+
type: 'text',
|
|
439
|
+
text: JSON.stringify(healingResult, null, 2)
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
};
|
|
558
443
|
default:
|
|
559
|
-
throw new
|
|
444
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
560
445
|
}
|
|
561
446
|
}
|
|
562
447
|
catch (error) {
|
|
@@ -2591,206 +2476,6 @@ class ServiceNowIntelligentMCP {
|
|
|
2591
2476
|
}] };
|
|
2592
2477
|
}
|
|
2593
2478
|
}
|
|
2594
|
-
async discoverExistingFlows(args) {
|
|
2595
|
-
const { flow_purpose, include_inactive = false, similarity_threshold = 0.7 } = args;
|
|
2596
|
-
try {
|
|
2597
|
-
// Search for existing flows
|
|
2598
|
-
const searchQuery = include_inactive ? '' : 'active=true';
|
|
2599
|
-
const flows = await this.client.get('/api/now/table/wf_workflow', {
|
|
2600
|
-
sysparm_query: searchQuery,
|
|
2601
|
-
sysparm_fields: 'sys_id,name,description,active,sys_created_on,sys_updated_on',
|
|
2602
|
-
sysparm_limit: 100
|
|
2603
|
-
});
|
|
2604
|
-
const existingFlows = flows.result || [];
|
|
2605
|
-
const similarFlows = [];
|
|
2606
|
-
// Analyze similarity using keywords and context
|
|
2607
|
-
const purposeKeywords = flow_purpose.toLowerCase().split(/\s+/);
|
|
2608
|
-
for (const flow of existingFlows) {
|
|
2609
|
-
const flowText = `${flow.name} ${flow.description || ''}`.toLowerCase();
|
|
2610
|
-
const matchingKeywords = purposeKeywords.filter(keyword => flowText.includes(keyword) || keyword.includes(flowText.split(/\s+/)[0]));
|
|
2611
|
-
const similarity = matchingKeywords.length / purposeKeywords.length;
|
|
2612
|
-
if (similarity >= similarity_threshold) {
|
|
2613
|
-
similarFlows.push({
|
|
2614
|
-
...flow,
|
|
2615
|
-
similarity_score: similarity,
|
|
2616
|
-
matching_keywords: matchingKeywords,
|
|
2617
|
-
recommendation: similarity > 0.9 ? 'modify_existing' : 'consider_reuse'
|
|
2618
|
-
});
|
|
2619
|
-
}
|
|
2620
|
-
}
|
|
2621
|
-
// Sort by similarity score
|
|
2622
|
-
similarFlows.sort((a, b) => b.similarity_score - a.similarity_score);
|
|
2623
|
-
const result = {
|
|
2624
|
-
flow_purpose,
|
|
2625
|
-
total_existing_flows: existingFlows.length,
|
|
2626
|
-
similar_flows_found: similarFlows.length,
|
|
2627
|
-
recommendations: {
|
|
2628
|
-
create_new: similarFlows.length === 0,
|
|
2629
|
-
modify_existing: similarFlows.some(f => f.similarity_score > 0.9),
|
|
2630
|
-
consider_reuse: similarFlows.some(f => f.similarity_score > 0.7 && f.similarity_score <= 0.9)
|
|
2631
|
-
},
|
|
2632
|
-
similar_flows: similarFlows.slice(0, 5), // Top 5 matches
|
|
2633
|
-
analysis_timestamp: new Date().toISOString()
|
|
2634
|
-
};
|
|
2635
|
-
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
2636
|
-
}
|
|
2637
|
-
catch (error) {
|
|
2638
|
-
return { content: [{
|
|
2639
|
-
type: 'text',
|
|
2640
|
-
text: `❌ Flow Discovery Failed: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
2641
|
-
}] };
|
|
2642
|
-
}
|
|
2643
|
-
}
|
|
2644
|
-
async testFlowExecution(args) {
|
|
2645
|
-
const { flow_sys_id, test_data = {}, monitor_execution = true, timeout_seconds = 300 } = args;
|
|
2646
|
-
try {
|
|
2647
|
-
const executionResults = {
|
|
2648
|
-
flow_sys_id,
|
|
2649
|
-
test_initiated: new Date().toISOString(),
|
|
2650
|
-
execution_status: 'unknown',
|
|
2651
|
-
execution_steps: [],
|
|
2652
|
-
performance_metrics: {},
|
|
2653
|
-
test_data_used: test_data
|
|
2654
|
-
};
|
|
2655
|
-
// Try modern Flow Designer API first
|
|
2656
|
-
let flowDetails;
|
|
2657
|
-
let flowType = 'flow_designer';
|
|
2658
|
-
try {
|
|
2659
|
-
// First try sys_hub_flow (modern Flow Designer)
|
|
2660
|
-
flowDetails = await this.client.get(`/api/now/table/sys_hub_flow/${flow_sys_id}`, {
|
|
2661
|
-
sysparm_fields: 'name,description,active,type,status,sys_id,latest_snapshot'
|
|
2662
|
-
});
|
|
2663
|
-
if (!flowDetails.result) {
|
|
2664
|
-
throw new Error('Not found in sys_hub_flow');
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
catch (error) {
|
|
2668
|
-
// Fallback to legacy workflow if not found
|
|
2669
|
-
try {
|
|
2670
|
-
flowDetails = await this.client.get(`/api/now/table/wf_workflow/${flow_sys_id}`, {
|
|
2671
|
-
sysparm_fields: 'name,description,active,table'
|
|
2672
|
-
});
|
|
2673
|
-
flowType = 'legacy_workflow';
|
|
2674
|
-
if (!flowDetails.result) {
|
|
2675
|
-
throw new Error('Not found in wf_workflow');
|
|
2676
|
-
}
|
|
2677
|
-
}
|
|
2678
|
-
catch (fallbackError) {
|
|
2679
|
-
// Try searching by name if sys_id fails
|
|
2680
|
-
const searchResults = await this.findFlowByNameOrSysId(flow_sys_id);
|
|
2681
|
-
if (searchResults) {
|
|
2682
|
-
flowDetails = { result: searchResults };
|
|
2683
|
-
flowType = searchResults.sys_class_name === 'sys_hub_flow' ? 'flow_designer' : 'legacy_workflow';
|
|
2684
|
-
}
|
|
2685
|
-
else {
|
|
2686
|
-
throw new Error(`Flow not found with identifier: ${flow_sys_id}`);
|
|
2687
|
-
}
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
|
-
executionResults.flow_info = flowDetails.result;
|
|
2691
|
-
// For flows that can be triggered programmatically
|
|
2692
|
-
const startTime = Date.now();
|
|
2693
|
-
const artifactSysId = flowDetails.result?.sys_id || 'unknown';
|
|
2694
|
-
try {
|
|
2695
|
-
// Attempt to analyze and test the flow based on its type and trigger conditions
|
|
2696
|
-
const testResult = await this.performFlowAnalysis(artifactSysId, flowType, flowDetails.result);
|
|
2697
|
-
let flowActivities;
|
|
2698
|
-
if (flowType === 'flow_designer') {
|
|
2699
|
-
// For modern flows, get activities from flow definition
|
|
2700
|
-
const flowData = flowDetails.result;
|
|
2701
|
-
if (flowData.latest_snapshot) {
|
|
2702
|
-
try {
|
|
2703
|
-
const snapshot = JSON.parse(flowData.latest_snapshot);
|
|
2704
|
-
flowActivities = {
|
|
2705
|
-
result: (snapshot.activities || snapshot.steps || []).map((activity, index) => ({
|
|
2706
|
-
name: activity.name || activity.label || `Activity ${index + 1}`,
|
|
2707
|
-
order: index * 100,
|
|
2708
|
-
active: true,
|
|
2709
|
-
type: activity.activity_type || activity.type,
|
|
2710
|
-
script: activity.script || ''
|
|
2711
|
-
}))
|
|
2712
|
-
};
|
|
2713
|
-
}
|
|
2714
|
-
catch (parseError) {
|
|
2715
|
-
flowActivities = { result: [] };
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
else {
|
|
2719
|
-
flowActivities = { result: [] };
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2722
|
-
else {
|
|
2723
|
-
// Legacy workflow activities
|
|
2724
|
-
flowActivities = await this.client.get('/api/now/table/wf_activity', {
|
|
2725
|
-
sysparm_query: `workflow=${flow_sys_id}`,
|
|
2726
|
-
sysparm_fields: 'name,order,active,script',
|
|
2727
|
-
sysparm_orderby: 'order'
|
|
2728
|
-
});
|
|
2729
|
-
}
|
|
2730
|
-
executionResults.execution_steps = flowActivities.result || [];
|
|
2731
|
-
executionResults.total_steps = executionResults.execution_steps.length;
|
|
2732
|
-
// Simulated execution analysis
|
|
2733
|
-
executionResults.execution_status = 'analysis_complete';
|
|
2734
|
-
executionResults.performance_metrics = {
|
|
2735
|
-
analysis_time_ms: Date.now() - startTime,
|
|
2736
|
-
estimated_execution_time_ms: executionResults.total_steps * 500, // Rough estimate
|
|
2737
|
-
complexity_score: this.calculateFlowComplexity(executionResults.execution_steps)
|
|
2738
|
-
};
|
|
2739
|
-
// Provide testing recommendations based on flow type
|
|
2740
|
-
executionResults.testing_recommendations = [
|
|
2741
|
-
`Flow Type: ${flowType === 'flow_designer' ? 'Modern Flow Designer' : 'Legacy Workflow'}`,
|
|
2742
|
-
`Flow Sys ID: ${flowDetails.result.sys_id}`,
|
|
2743
|
-
`Flow Name: ${flowDetails.result.name}`,
|
|
2744
|
-
'',
|
|
2745
|
-
'📋 Testing Steps:',
|
|
2746
|
-
'1. Use snow_test_flow_with_mock for mock data testing (recommended)',
|
|
2747
|
-
'2. Create test records in the target table before execution',
|
|
2748
|
-
'3. Monitor execution via sys_flow_context (Flow Designer) or wf_context (Legacy)',
|
|
2749
|
-
'4. Verify all conditions and approval steps work as expected',
|
|
2750
|
-
'5. Test error handling and rollback scenarios',
|
|
2751
|
-
'',
|
|
2752
|
-
'💡 Alternative Testing Tools:',
|
|
2753
|
-
'- snow_test_flow_with_mock: Test with mock users and data (always works)',
|
|
2754
|
-
'- snow_comprehensive_flow_test: Advanced testing with edge cases',
|
|
2755
|
-
'- Direct execution: Trigger via actual record creation/update',
|
|
2756
|
-
'',
|
|
2757
|
-
'🔍 Sys ID Tracking:',
|
|
2758
|
-
`- Flow Sys ID: ${flowDetails.result.sys_id}`,
|
|
2759
|
-
`- Table: ${flowType === 'flow_designer' ? 'sys_hub_flow' : 'wf_workflow'}`,
|
|
2760
|
-
`- URL: ${process.env.SNOW_INSTANCE ? `https://${process.env.SNOW_INSTANCE.replace(/\/$/, '')}.service-now.com` : ''}/${flowType === 'flow_designer' ? 'nav_to.do?uri=sys_hub_flow.do?sys_id=' : 'workflow_ide.do?sysparm_nostack=true&sysparm_sys_id='}${flowDetails.result.sys_id}`
|
|
2761
|
-
];
|
|
2762
|
-
if (monitor_execution) {
|
|
2763
|
-
executionResults.monitoring_notes = 'Full monitoring requires Flow Designer integration';
|
|
2764
|
-
}
|
|
2765
|
-
}
|
|
2766
|
-
catch (executionError) {
|
|
2767
|
-
executionResults.execution_status = 'failed';
|
|
2768
|
-
executionResults.error = executionError instanceof Error ? executionError.message : 'Execution failed';
|
|
2769
|
-
}
|
|
2770
|
-
return { content: [{ type: 'text', text: JSON.stringify(executionResults, null, 2) }] };
|
|
2771
|
-
}
|
|
2772
|
-
catch (error) {
|
|
2773
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
2774
|
-
let helpText = `❌ Flow Testing Failed: ${errorMessage}\n\n`;
|
|
2775
|
-
if (errorMessage.includes('not found')) {
|
|
2776
|
-
helpText += `🔍 Flow Discovery Tips:\n`;
|
|
2777
|
-
helpText += `- Provided identifier: "${flow_sys_id}"\n`;
|
|
2778
|
-
helpText += `- This could be a sys_id OR a flow name\n`;
|
|
2779
|
-
helpText += `- Checked tables: sys_hub_flow (modern), wf_workflow (legacy)\n\n`;
|
|
2780
|
-
helpText += `💡 Try these alternatives:\n`;
|
|
2781
|
-
helpText += `1. Use snow_find_artifact to search for the flow:\n`;
|
|
2782
|
-
helpText += ` snow_find_artifact({ query: "${flow_sys_id}", type: "flow" })\n\n`;
|
|
2783
|
-
helpText += `2. Use snow_test_flow_with_mock for testing without sys_id:\n`;
|
|
2784
|
-
helpText += ` snow_test_flow_with_mock({ flow_id: "${flow_sys_id}" })\n\n`;
|
|
2785
|
-
helpText += `3. Search by partial name:\n`;
|
|
2786
|
-
helpText += ` snow_discover_existing_flows({ flow_purpose: "${flow_sys_id}" })\n\n`;
|
|
2787
|
-
helpText += `4. Get exact sys_id from ServiceNow UI:\n`;
|
|
2788
|
-
helpText += ` - Flow Designer → Flows → Copy sys_id from list\n`;
|
|
2789
|
-
helpText += ` - Or right-click flow → Copy sys_id\n`;
|
|
2790
|
-
}
|
|
2791
|
-
return { content: [{ type: 'text', text: helpText }] };
|
|
2792
|
-
}
|
|
2793
|
-
}
|
|
2794
2479
|
async batchDeploymentValidator(args) {
|
|
2795
2480
|
const { artifacts, validation_level = 'full', check_conflicts = true } = args;
|
|
2796
2481
|
try {
|
|
@@ -3645,137 +3330,6 @@ class ServiceNowIntelligentMCP {
|
|
|
3645
3330
|
}] };
|
|
3646
3331
|
}
|
|
3647
3332
|
}
|
|
3648
|
-
async comprehensiveFlowTest(args) {
|
|
3649
|
-
const { flow_sys_id, test_data_generation = 'automatic', edge_case_detection = true, performance_validation = true, integration_testing = true, test_scenarios = [] } = args;
|
|
3650
|
-
try {
|
|
3651
|
-
// 🔧 TEST-001 FIX: Validate sys_id before proceeding
|
|
3652
|
-
if (!flow_sys_id || flow_sys_id === 'id' || flow_sys_id === 'flow_id' || flow_sys_id.length < 32) {
|
|
3653
|
-
return {
|
|
3654
|
-
content: [{
|
|
3655
|
-
type: 'text',
|
|
3656
|
-
text: `❌ TEST-001 FIX: Invalid flow_sys_id provided: "${flow_sys_id}"\n\n` +
|
|
3657
|
-
`🔧 Valid ServiceNow sys_ids are 32-character hex strings.\n` +
|
|
3658
|
-
`💡 To test a flow:\n` +
|
|
3659
|
-
` 1. First create a flow using snow_create_flow\n` +
|
|
3660
|
-
` 2. Use the returned sys_id for testing\n` +
|
|
3661
|
-
` 3. Example: snow_comprehensive_flow_test({ flow_sys_id: "actual_32_char_sys_id" })\n\n` +
|
|
3662
|
-
`🎯 Alternative: Use snow_test_flow_with_mock for mock testing without requiring a real sys_id.`
|
|
3663
|
-
}]
|
|
3664
|
-
};
|
|
3665
|
-
}
|
|
3666
|
-
const testResults = {
|
|
3667
|
-
flow_sys_id,
|
|
3668
|
-
test_session_id: `test_${Date.now()}`,
|
|
3669
|
-
started_at: new Date().toISOString(),
|
|
3670
|
-
test_configuration: {
|
|
3671
|
-
test_data_generation,
|
|
3672
|
-
edge_case_detection,
|
|
3673
|
-
performance_validation,
|
|
3674
|
-
integration_testing
|
|
3675
|
-
},
|
|
3676
|
-
test_results: {
|
|
3677
|
-
functional_tests: [],
|
|
3678
|
-
edge_case_tests: [],
|
|
3679
|
-
performance_tests: [],
|
|
3680
|
-
integration_tests: []
|
|
3681
|
-
},
|
|
3682
|
-
overall_status: 'running',
|
|
3683
|
-
recommendations: []
|
|
3684
|
-
};
|
|
3685
|
-
// Get flow details using improved discovery
|
|
3686
|
-
let flowDetails;
|
|
3687
|
-
let flowType = 'flow_designer';
|
|
3688
|
-
try {
|
|
3689
|
-
// First try sys_hub_flow (modern Flow Designer)
|
|
3690
|
-
flowDetails = await this.client.get(`/api/now/table/sys_hub_flow/${flow_sys_id}`, {
|
|
3691
|
-
sysparm_fields: 'name,description,active,type,status,sys_id,latest_snapshot'
|
|
3692
|
-
});
|
|
3693
|
-
if (!flowDetails.result) {
|
|
3694
|
-
throw new Error('Not found in sys_hub_flow');
|
|
3695
|
-
}
|
|
3696
|
-
}
|
|
3697
|
-
catch (error) {
|
|
3698
|
-
// Fallback to legacy workflow if not found
|
|
3699
|
-
try {
|
|
3700
|
-
flowDetails = await this.client.get(`/api/now/table/wf_workflow/${flow_sys_id}`, {
|
|
3701
|
-
sysparm_fields: 'name,description,active,table'
|
|
3702
|
-
});
|
|
3703
|
-
flowType = 'legacy_workflow';
|
|
3704
|
-
if (!flowDetails.result) {
|
|
3705
|
-
throw new Error('Not found in wf_workflow');
|
|
3706
|
-
}
|
|
3707
|
-
}
|
|
3708
|
-
catch (fallbackError) {
|
|
3709
|
-
// Try searching by name if sys_id fails
|
|
3710
|
-
const searchResults = await this.findFlowByNameOrSysId(flow_sys_id);
|
|
3711
|
-
if (searchResults) {
|
|
3712
|
-
flowDetails = { result: searchResults };
|
|
3713
|
-
flowType = searchResults.sys_class_name === 'sys_hub_flow' ? 'flow_designer' : 'legacy_workflow';
|
|
3714
|
-
}
|
|
3715
|
-
else {
|
|
3716
|
-
throw new Error(`Flow not found with identifier: ${flow_sys_id}`);
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
}
|
|
3720
|
-
testResults.flow_info = flowDetails.result;
|
|
3721
|
-
// Generate test data automatically
|
|
3722
|
-
if (test_data_generation === 'automatic') {
|
|
3723
|
-
testResults.generated_test_data = await this.generateFlowTestData(flowDetails.result);
|
|
3724
|
-
}
|
|
3725
|
-
// Functional testing
|
|
3726
|
-
const functionalTests = await this.runFunctionalTests(flow_sys_id, testResults.generated_test_data);
|
|
3727
|
-
testResults.test_results.functional_tests = functionalTests;
|
|
3728
|
-
// Edge case testing
|
|
3729
|
-
if (edge_case_detection) {
|
|
3730
|
-
const edgeCaseTests = await this.runEdgeCaseTests(flow_sys_id);
|
|
3731
|
-
testResults.test_results.edge_case_tests = edgeCaseTests;
|
|
3732
|
-
}
|
|
3733
|
-
// Performance testing
|
|
3734
|
-
if (performance_validation) {
|
|
3735
|
-
const performanceTests = await this.runPerformanceTests(flow_sys_id);
|
|
3736
|
-
testResults.test_results.performance_tests = performanceTests;
|
|
3737
|
-
}
|
|
3738
|
-
// Integration testing
|
|
3739
|
-
if (integration_testing) {
|
|
3740
|
-
const integrationTests = await this.runIntegrationTests(flow_sys_id);
|
|
3741
|
-
testResults.test_results.integration_tests = integrationTests;
|
|
3742
|
-
}
|
|
3743
|
-
// Run custom scenarios
|
|
3744
|
-
if (test_scenarios.length > 0) {
|
|
3745
|
-
testResults.test_results.custom_scenarios = [];
|
|
3746
|
-
for (const scenario of test_scenarios) {
|
|
3747
|
-
const scenarioResult = await this.runCustomTestScenario(flow_sys_id, scenario);
|
|
3748
|
-
testResults.test_results.custom_scenarios.push(scenarioResult);
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
// Analyze overall results
|
|
3752
|
-
const allTests = [
|
|
3753
|
-
...testResults.test_results.functional_tests,
|
|
3754
|
-
...testResults.test_results.edge_case_tests,
|
|
3755
|
-
...testResults.test_results.performance_tests,
|
|
3756
|
-
...testResults.test_results.integration_tests
|
|
3757
|
-
];
|
|
3758
|
-
const passedTests = allTests.filter(test => test.status === 'passed').length;
|
|
3759
|
-
const totalTests = allTests.length;
|
|
3760
|
-
testResults.overall_status = passedTests === totalTests ? 'passed' :
|
|
3761
|
-
passedTests > totalTests * 0.8 ? 'mostly_passed' : 'failed';
|
|
3762
|
-
testResults.test_summary = {
|
|
3763
|
-
total_tests: totalTests,
|
|
3764
|
-
passed: passedTests,
|
|
3765
|
-
failed: totalTests - passedTests,
|
|
3766
|
-
success_rate: `${Math.round((passedTests / totalTests) * 100)}%`
|
|
3767
|
-
};
|
|
3768
|
-
// Generate recommendations
|
|
3769
|
-
testResults.recommendations = this.generateTestRecommendations(testResults);
|
|
3770
|
-
return { content: [{ type: 'text', text: JSON.stringify(testResults, null, 2) }] };
|
|
3771
|
-
}
|
|
3772
|
-
catch (error) {
|
|
3773
|
-
return { content: [{
|
|
3774
|
-
type: 'text',
|
|
3775
|
-
text: `❌ Comprehensive Flow Testing Failed: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
3776
|
-
}] };
|
|
3777
|
-
}
|
|
3778
|
-
}
|
|
3779
3333
|
// Helper methods for the new functionality
|
|
3780
3334
|
inferArtifactType(component) {
|
|
3781
3335
|
if (component.includes('workflow') || component.includes('approval'))
|