snow-flow 4.3.5 → 4.3.8

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/cli.js CHANGED
@@ -754,28 +754,36 @@ Memory.store("swarm_session_${sessionId}", JSON.stringify({
754
754
  }));
755
755
  \`\`\`
756
756
 
757
- ### 2. Validate ServiceNow Connection
758
- **Execute these steps IN ORDER:**
757
+ ### 2. 🚨 MANDATORY: ServiceNow Auth & Update Set Setup
758
+ **CRITICAL: These steps are REQUIRED for ALL development work:**
759
759
 
760
760
  \`\`\`javascript
761
- // Step 2.1: Test ServiceNow authentication
761
+ // Step 2.1: MANDATORY - Test ServiceNow authentication
762
762
  const authCheck = await snow_auth_diagnostics();
763
763
  if (!authCheck.success) {
764
- throw new Error("Authentication failed! Run: snow-flow auth login");
764
+ throw new Error("āŒ CRITICAL: Authentication failed! Run: snow-flow auth login");
765
765
  }
766
766
 
767
- // Step 2.2: Create Update Set for tracking changes
767
+ // Step 2.2: MANDATORY - Create Update Set for tracking ALL changes
768
768
  const updateSetName = "Snow-Flow: ${objective.substring(0, 50)}... - ${new Date().toISOString().split('T')[0]}";
769
769
  const updateSet = await snow_update_set_create({
770
770
  name: updateSetName,
771
- description: "Automated creation for: ${objective}\\n\\nSession: ${sessionId}",
772
- auto_switch: true
771
+ description: "Automated Snow-Flow development for: ${objective}\\n\\nSession: ${sessionId}\\nAll changes tracked automatically",
772
+ auto_switch: true // 🚨 CRITICAL: Sets as current update set!
773
773
  });
774
774
 
775
- // Store Update Set info in memory
775
+ // Store Update Set info in memory for all agents
776
776
  Memory.store("update_set_${sessionId}", JSON.stringify(updateSet));
777
+ Memory.store("current_update_set", updateSet.sys_id);
777
778
  \`\`\`
778
779
 
780
+ **WHY THIS IS CRITICAL:**
781
+ - āœ… All ServiceNow changes are automatically tracked
782
+ - āœ… Enables deployment to other instances later
783
+ - āœ… Provides rollback capabilities
784
+ - āœ… Follows ServiceNow development best practices
785
+ - āŒ **WITHOUT UPDATE SET: Changes are untracked and risky!**
786
+
779
787
  ### 3. Create Master Task List
780
788
  After completing setup steps, create task breakdown:
781
789
  \`\`\`javascript
@@ -816,12 +824,14 @@ TodoWrite([
816
824
  ### 4. Agent Spawning Strategy
817
825
  Based on the task analysis, spawn ${taskAnalysis.estimatedAgentCount} agents in smart batches:
818
826
 
819
- **Agent Spawn Order (Use Snow-Flow MCP Tools):**
827
+ **Dynamic Agent Discovery & Spawning (Use Snow-Flow MCP Tools):**
820
828
  1. **Initialize Swarm**: \`swarm_init({ topology: 'hierarchical', maxAgents: ${parseInt(options.maxAgents)} })\`
821
- 2. **Primary Agent**: \`agent_spawn({ type: '${taskAnalysis.primaryAgent}', name: 'Primary${taskAnalysis.primaryAgent.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join('')}' })\`
822
- 3. **Supporting Agents**: Use \`agent_spawn\` for each: ${taskAnalysis.supportingAgents.map(agent => `'${agent}'`).join(', ')}
829
+ 2. **Discover Agents Dynamically**: \`agent_discover({ task_analysis: ${JSON.stringify(taskAnalysis)}, required_capabilities: [], context: { max_agents: ${parseInt(options.maxAgents)}, include_new_types: true } })\`
830
+ 3. **Spawn Discovered Agents**: Use \`agent_spawn({ type: 'agent_type_from_discovery', name: 'Agent Name', capabilities: ['discovered_capabilities'] })\` for each discovered agent
823
831
  4. **Coordination**: \`task_orchestrate({ task: '${objective}', strategy: 'adaptive' })\`
824
832
 
833
+ **IMPORTANT**: Do NOT use hardcoded agent types like 'widget-creator', 'specialist' etc. Let \`agent_discover\` determine the optimal agent types for this specific task!
834
+
825
835
  ### 5. Memory Coordination Pattern
826
836
  All agents MUST use this simple memory coordination:
827
837
 
@@ -888,10 +898,11 @@ ${isAuthenticated ? 'āœ… Authentication detected - full deployment capabilities'
888
898
 
889
899
  Your agents MUST use these MCP tools IN THIS ORDER:
890
900
 
891
- šŸ” **PRE-FLIGHT CHECKS** (Always do first!):
901
+ 🚨 **MANDATORY PRE-FLIGHT CHECKS** (ALWAYS do first!):
892
902
  1. \`snow_auth_diagnostics\` - Test authentication and permissions
893
- 2. If auth fails, the tool provides specific instructions
894
- 3. Continue with appropriate strategy based on auth status
903
+ 2. \`snow_update_set_create\` - Create and activate update set for tracking
904
+ 3. If auth fails, STOP and provide instructions to run 'snow-flow auth login'
905
+ 4. If update set fails, STOP - development work is not safe without tracking
895
906
 
896
907
  šŸŽÆ **Core Development Tools**:
897
908
  1. **Universal Query Tool**: \`snow_query_table\` - Works with ALL ServiceNow tables
@@ -1315,49 +1315,50 @@ ${args.help_text ? `ā“ Help: ${args.help_text}` : ''}
1315
1315
  * Helper function to format action details for display
1316
1316
  */
1317
1317
  }
1318
- /**
1319
- * Helper function to format action details for display
1320
- */
1321
- formatActionDetails(action) {
1322
- const details = [];
1323
- if (action.mandatory !== undefined) {
1324
- details.push(`Mandatory: ${action.mandatory}`);
1325
- }
1326
- if (action.visible !== undefined) {
1327
- details.push(`Visible: ${action.visible}`);
1328
- }
1329
- if (action.readonly !== undefined) {
1330
- details.push(`Read-only: ${action.readonly}`);
1331
- }
1332
- if (action.value !== undefined && action.value !== '') {
1333
- details.push(`Value: "${action.value}"`);
1334
- }
1335
- return details.length > 0 ? details.join(', ') : 'No specific action';
1318
+ catch(error) { n; this.logger.error('Failed to create catalog UI policy:', error); n; return { content: [{ type: 'text', text: `āŒ Failed to create catalog UI policy: ${error.message || error}` }] }; n; }
1319
+ }
1320
+ n;
1321
+ n;
1322
+ formatActionDetails(action, any);
1323
+ string;
1324
+ {
1325
+ const details = [];
1326
+ if (action.mandatory !== undefined) {
1327
+ details.push(`Mandatory: ${action.mandatory}`);
1336
1328
  }
1337
- /**
1338
- * Create Catalog Client Script
1339
- * Uses catalog_script_client table
1340
- */
1341
- async createCatalogClientScript(args) {
1342
- try {
1343
- this.logger.info('Creating catalog client script...');
1344
- const scriptData = {
1345
- cat_item: args.cat_item,
1346
- name: args.name,
1347
- script: args.script,
1348
- type: args.type,
1349
- applies_to: args.applies_to || 'item',
1350
- cat_variable: args.variable || '',
1351
- active: args.active !== false
1352
- };
1353
- const response = await this.client.createRecord('catalog_script_client', scriptData);
1354
- if (!response.success) {
1355
- throw new Error(`Failed to create catalog client script: ${response.error}`);
1356
- }
1357
- return {
1358
- content: [{
1359
- type: 'text',
1360
- text: `āœ… Catalog Client Script created successfully!
1329
+ if (action.visible !== undefined) {
1330
+ details.push(`Visible: ${action.visible}`);
1331
+ }
1332
+ if (action.readonly !== undefined) {
1333
+ details.push(`Read-only: ${action.readonly}`);
1334
+ }
1335
+ if (action.value !== undefined && action.value !== '') {
1336
+ details.push(`Value: "${action.value}"`);
1337
+ }
1338
+ return details.length > 0 ? details.join(', ') : 'No specific action';
1339
+ }
1340
+ async;
1341
+ createCatalogClientScript(args, any);
1342
+ {
1343
+ try {
1344
+ this.logger.info('Creating catalog client script...');
1345
+ const scriptData = {
1346
+ cat_item: args.cat_item,
1347
+ name: args.name,
1348
+ script: args.script,
1349
+ type: args.type,
1350
+ applies_to: args.applies_to || 'item',
1351
+ cat_variable: args.variable || '',
1352
+ active: args.active !== false
1353
+ };
1354
+ const response = await this.client.createRecord('catalog_script_client', scriptData);
1355
+ if (!response.success) {
1356
+ throw new Error(`Failed to create catalog client script: ${response.error}`);
1357
+ }
1358
+ return {
1359
+ content: [{
1360
+ type: 'text',
1361
+ text: `āœ… Catalog Client Script created successfully!
1361
1362
 
1362
1363
  šŸ“œ **${args.name}**
1363
1364
  šŸ†” sys_id: ${response.data.sys_id}
@@ -1367,118 +1368,115 @@ ${args.variable ? `šŸ“ Variable: ${args.variable}` : ''}
1367
1368
  šŸ”„ Active: ${args.active !== false ? 'Yes' : 'No'}
1368
1369
 
1369
1370
  ✨ Client script added to catalog item!`
1371
+ }]
1372
+ };
1373
+ }
1374
+ catch (error) {
1375
+ this.logger.error('Failed to create catalog client script:', error);
1376
+ throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to create catalog client script: ${error}`);
1377
+ }
1378
+ }
1379
+ async;
1380
+ searchCatalog(args, any);
1381
+ {
1382
+ try {
1383
+ this.logger.info('Searching service catalog...');
1384
+ let query = args.query ? `nameLIKE${args.query}^ORshort_descriptionLIKE${args.query}` : '';
1385
+ if (args.category) {
1386
+ query += query ? '^' : '';
1387
+ query += `category=${args.category}`;
1388
+ }
1389
+ if (args.catalog) {
1390
+ query += query ? '^' : '';
1391
+ query += `sc_catalogs=${args.catalog}`;
1392
+ }
1393
+ if (args.active_only) {
1394
+ query += query ? '^' : '';
1395
+ query += 'active=true';
1396
+ }
1397
+ const limit = args.limit || 20;
1398
+ this.logger.trackAPICall('SEARCH', 'sc_cat_item', limit);
1399
+ const response = await this.client.searchRecords('sc_cat_item', query, limit);
1400
+ if (!response.success) {
1401
+ throw new Error('Failed to search catalog');
1402
+ }
1403
+ const items = response.data.result;
1404
+ if (!items.length) {
1405
+ return {
1406
+ content: [{
1407
+ type: 'text',
1408
+ text: `āŒ No catalog items found${args.query ? ` matching "${args.query}"` : ''}`
1370
1409
  }]
1371
1410
  };
1372
1411
  }
1373
- catch (error) {
1374
- this.logger.error('Failed to create catalog client script:', error);
1375
- throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to create catalog client script: ${error}`);
1376
- }
1377
- }
1378
- /**
1379
- * Search Service Catalog
1380
- */
1381
- async searchCatalog(args) {
1382
- try {
1383
- this.logger.info('Searching service catalog...');
1384
- let query = args.query ? `nameLIKE${args.query}^ORshort_descriptionLIKE${args.query}` : '';
1385
- if (args.category) {
1386
- query += query ? '^' : '';
1387
- query += `category=${args.category}`;
1388
- }
1389
- if (args.catalog) {
1390
- query += query ? '^' : '';
1391
- query += `sc_catalogs=${args.catalog}`;
1392
- }
1393
- if (args.active_only) {
1394
- query += query ? '^' : '';
1395
- query += 'active=true';
1396
- }
1397
- const limit = args.limit || 20;
1398
- this.logger.trackAPICall('SEARCH', 'sc_cat_item', limit);
1399
- const response = await this.client.searchRecords('sc_cat_item', query, limit);
1400
- if (!response.success) {
1401
- throw new Error('Failed to search catalog');
1402
- }
1403
- const items = response.data.result;
1404
- if (!items.length) {
1405
- return {
1406
- content: [{
1407
- type: 'text',
1408
- text: `āŒ No catalog items found${args.query ? ` matching "${args.query}"` : ''}`
1409
- }]
1410
- };
1411
- }
1412
- const itemList = items.map((item) => {
1413
- return `šŸ›ļø **${item.name}**
1412
+ const itemList = items.map((item) => {
1413
+ return `šŸ›ļø **${item.name}**
1414
1414
  šŸ†” ${item.sys_id}
1415
1415
  šŸ“ ${item.short_description}
1416
1416
  ${item.price && item.price !== '0' ? `šŸ’° Price: $${item.price}` : ''}
1417
1417
  šŸ”„ Active: ${item.active ? 'Yes' : 'No'}`;
1418
- }).join('\n\n');
1419
- return {
1420
- content: [{
1421
- type: 'text',
1422
- text: `šŸ” Catalog Search Results${args.query ? ` for "${args.query}"` : ''}:
1418
+ }).join('\n\n');
1419
+ return {
1420
+ content: [{
1421
+ type: 'text',
1422
+ text: `šŸ” Catalog Search Results${args.query ? ` for "${args.query}"` : ''}:
1423
1423
 
1424
1424
  ${itemList}
1425
1425
 
1426
1426
  ✨ Found ${items.length} catalog item(s)`
1427
- }]
1428
- };
1427
+ }]
1428
+ };
1429
+ }
1430
+ catch (error) {
1431
+ this.logger.error('Failed to search catalog:', error);
1432
+ throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to search catalog: ${error}`);
1433
+ }
1434
+ }
1435
+ async;
1436
+ orderCatalogItem(args, any);
1437
+ {
1438
+ try {
1439
+ this.logger.info('Ordering catalog item...');
1440
+ // Create service catalog request
1441
+ const requestData = {
1442
+ requested_for: args.requested_for,
1443
+ opened_by: args.requested_for,
1444
+ special_instructions: args.special_instructions || ''
1445
+ };
1446
+ const requestResponse = await this.client.createRecord('sc_request', requestData);
1447
+ if (!requestResponse.success) {
1448
+ throw new Error(`Failed to create request: ${requestResponse.error}`);
1429
1449
  }
1430
- catch (error) {
1431
- this.logger.error('Failed to search catalog:', error);
1432
- throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to search catalog: ${error}`);
1450
+ const requestId = requestResponse.data.sys_id;
1451
+ // Create requested item (RITM)
1452
+ const ritmData = {
1453
+ request: requestId,
1454
+ cat_item: args.cat_item,
1455
+ requested_for: args.requested_for,
1456
+ quantity: args.quantity || 1,
1457
+ delivery_address: args.delivery_address || ''
1458
+ };
1459
+ const ritmResponse = await this.client.createRecord('sc_req_item', ritmData);
1460
+ if (!ritmResponse.success) {
1461
+ throw new Error(`Failed to create requested item: ${ritmResponse.error}`);
1433
1462
  }
1434
- }
1435
- /**
1436
- * Order Catalog Item
1437
- * Creates sc_request and sc_req_item records
1438
- */
1439
- async orderCatalogItem(args) {
1440
- try {
1441
- this.logger.info('Ordering catalog item...');
1442
- // Create service catalog request
1443
- const requestData = {
1444
- requested_for: args.requested_for,
1445
- opened_by: args.requested_for,
1446
- special_instructions: args.special_instructions || ''
1447
- };
1448
- const requestResponse = await this.client.createRecord('sc_request', requestData);
1449
- if (!requestResponse.success) {
1450
- throw new Error(`Failed to create request: ${requestResponse.error}`);
1451
- }
1452
- const requestId = requestResponse.data.sys_id;
1453
- // Create requested item (RITM)
1454
- const ritmData = {
1455
- request: requestId,
1456
- cat_item: args.cat_item,
1457
- requested_for: args.requested_for,
1458
- quantity: args.quantity || 1,
1459
- delivery_address: args.delivery_address || ''
1460
- };
1461
- const ritmResponse = await this.client.createRecord('sc_req_item', ritmData);
1462
- if (!ritmResponse.success) {
1463
- throw new Error(`Failed to create requested item: ${ritmResponse.error}`);
1464
- }
1465
- const ritmId = ritmResponse.data.sys_id;
1466
- const ritmNumber = ritmResponse.data.number;
1467
- // Set variable values if provided
1468
- if (args.variables) {
1469
- for (const [varName, varValue] of Object.entries(args.variables)) {
1470
- const varData = {
1471
- request_item: ritmId,
1472
- name: varName,
1473
- value: varValue
1474
- };
1475
- await this.client.createRecord('sc_item_option_mtom', varData);
1476
- }
1463
+ const ritmId = ritmResponse.data.sys_id;
1464
+ const ritmNumber = ritmResponse.data.number;
1465
+ // Set variable values if provided
1466
+ if (args.variables) {
1467
+ for (const [varName, varValue] of Object.entries(args.variables)) {
1468
+ const varData = {
1469
+ request_item: ritmId,
1470
+ name: varName,
1471
+ value: varValue
1472
+ };
1473
+ await this.client.createRecord('sc_item_option_mtom', varData);
1477
1474
  }
1478
- return {
1479
- content: [{
1480
- type: 'text',
1481
- text: `āœ… Catalog Item ordered successfully!
1475
+ }
1476
+ return {
1477
+ content: [{
1478
+ type: 'text',
1479
+ text: `āœ… Catalog Item ordered successfully!
1482
1480
 
1483
1481
  šŸ›ļø **Order Placed**
1484
1482
  šŸ†” Request: ${requestId}
@@ -1489,52 +1487,51 @@ ${args.delivery_address ? `šŸ“ Delivery: ${args.delivery_address}` : ''}
1489
1487
  ${args.special_instructions ? `šŸ“ Instructions: ${args.special_instructions}` : ''}
1490
1488
 
1491
1489
  ✨ Order submitted for fulfillment!`
1492
- }]
1493
- };
1494
- }
1495
- catch (error) {
1496
- this.logger.error('Failed to order catalog item:', error);
1497
- throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to order catalog item: ${error}`);
1498
- }
1490
+ }]
1491
+ };
1499
1492
  }
1500
- /**
1501
- * Get Catalog Item Details
1502
- */
1503
- async getCatalogItemDetails(args) {
1504
- try {
1505
- this.logger.info('Getting catalog item details...', { sys_id: args.sys_id });
1506
- // šŸ” DEBUGGING: Try different methods to find the item
1507
- this.logger.info('šŸ” Step 1: Trying getRecord method...');
1508
- let itemResponse = await this.client.getRecord('sc_cat_item', args.sys_id);
1509
- if (!itemResponse.success) {
1510
- this.logger.warn('āŒ getRecord failed, trying searchRecords as fallback...');
1511
- this.logger.warn('getRecord error:', itemResponse.error);
1512
- // Fallback: try searchRecords method
1513
- itemResponse = await this.client.searchRecords('sc_cat_item', `sys_id=${args.sys_id}`, 1);
1514
- if (!itemResponse.success || itemResponse.data.result.length === 0) {
1515
- this.logger.error('āŒ Both getRecord and searchRecords failed');
1516
- this.logger.error('searchRecords error:', itemResponse.error);
1517
- // Final fallback: try to query with different parameters
1518
- const queryResponse = await this.client.queryTable('sc_cat_item', `sys_id=${args.sys_id}`, 1);
1519
- if (queryResponse.success && queryResponse.data.result.length > 0) {
1520
- this.logger.info('āœ… Found item using queryTable fallback');
1521
- itemResponse = { success: true, data: queryResponse.data.result[0] };
1522
- }
1523
- else {
1524
- this.logger.error('āŒ All methods failed to find catalog item');
1525
- throw new Error(`Catalog item not found with sys_id: ${args.sys_id}. Tried getRecord, searchRecords, and queryTable.`);
1526
- }
1493
+ catch (error) {
1494
+ this.logger.error('Failed to order catalog item:', error);
1495
+ throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to order catalog item: ${error}`);
1496
+ }
1497
+ }
1498
+ async;
1499
+ getCatalogItemDetails(args, any);
1500
+ {
1501
+ try {
1502
+ this.logger.info('Getting catalog item details...', { sys_id: args.sys_id });
1503
+ // šŸ” DEBUGGING: Try different methods to find the item
1504
+ this.logger.info('šŸ” Step 1: Trying getRecord method...');
1505
+ let itemResponse = await this.client.getRecord('sc_cat_item', args.sys_id);
1506
+ if (!itemResponse.success) {
1507
+ this.logger.warn('āŒ getRecord failed, trying searchRecords as fallback...');
1508
+ this.logger.warn('getRecord error:', itemResponse.error);
1509
+ // Fallback: try searchRecords method
1510
+ itemResponse = await this.client.searchRecords('sc_cat_item', `sys_id=${args.sys_id}`, 1);
1511
+ if (!itemResponse.success || itemResponse.data.result.length === 0) {
1512
+ this.logger.error('āŒ Both getRecord and searchRecords failed');
1513
+ this.logger.error('searchRecords error:', itemResponse.error);
1514
+ // Final fallback: try to query with different parameters
1515
+ const queryResponse = await this.client.queryTable('sc_cat_item', `sys_id=${args.sys_id}`, 1);
1516
+ if (queryResponse.success && queryResponse.data.result.length > 0) {
1517
+ this.logger.info('āœ… Found item using queryTable fallback');
1518
+ itemResponse = { success: true, data: queryResponse.data.result[0] };
1527
1519
  }
1528
1520
  else {
1529
- this.logger.info('āœ… Found item using searchRecords fallback');
1530
- itemResponse = { success: true, data: itemResponse.data.result[0] };
1521
+ this.logger.error('āŒ All methods failed to find catalog item');
1522
+ throw new Error(`Catalog item not found with sys_id: ${args.sys_id}. Tried getRecord, searchRecords, and queryTable.`);
1531
1523
  }
1532
1524
  }
1533
1525
  else {
1534
- this.logger.info('āœ… Found item using getRecord');
1526
+ this.logger.info('āœ… Found item using searchRecords fallback');
1527
+ itemResponse = { success: true, data: itemResponse.data.result[0] };
1535
1528
  }
1536
- const item = itemResponse.data;
1537
- let details = `šŸ›ļø **${item.name}**
1529
+ }
1530
+ else {
1531
+ this.logger.info('āœ… Found item using getRecord');
1532
+ }
1533
+ const item = itemResponse.data;
1534
+ let details = `šŸ›ļø **${item.name}**
1538
1535
  šŸ†” sys_id: ${item.sys_id}
1539
1536
  šŸ“ ${item.short_description}
1540
1537
  šŸ“„ ${item.description || 'No detailed description'}
@@ -1542,82 +1539,82 @@ ${item.price && item.price !== '0' ? `šŸ’° Price: $${item.price}` : ''}
1542
1539
  ${item.recurring_price && item.recurring_price !== '0' ? `šŸ”„ Recurring: $${item.recurring_price}` : ''}
1543
1540
  šŸ“¦ Delivery: ${item.delivery_time || '3 business days'}
1544
1541
  šŸ”„ Active: ${item.active ? 'Yes' : 'No'}`;
1545
- // Get variables if requested
1546
- if (args.include_variables) {
1547
- const varResponse = await this.client.searchRecords('sc_cat_item_option', `cat_item=${args.sys_id}`, 50);
1548
- if (varResponse.success && varResponse.data.result.length) {
1549
- const variables = varResponse.data.result.map((v) => ` - ${v.question_text} (${v.type})${v.mandatory ? ' *Required' : ''}`).join('\n');
1550
- details += `\n\nšŸ“‹ **Variables:**\n${variables}`;
1551
- }
1542
+ // Get variables if requested
1543
+ if (args.include_variables) {
1544
+ const varResponse = await this.client.searchRecords('sc_cat_item_option', `cat_item=${args.sys_id}`, 50);
1545
+ if (varResponse.success && varResponse.data.result.length) {
1546
+ const variables = varResponse.data.result.map((v) => ` - ${v.question_text} (${v.type})${v.mandatory ? ' *Required' : ''}`).join('\n');
1547
+ details += `\n\nšŸ“‹ **Variables:**\n${variables}`;
1552
1548
  }
1553
- return {
1554
- content: [{
1555
- type: 'text',
1556
- text: details + '\n\n✨ Catalog item details retrieved!'
1557
- }]
1558
- };
1559
- }
1560
- catch (error) {
1561
- this.logger.error('Failed to get catalog item details:', error);
1562
- throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to get catalog item details: ${error}`);
1563
1549
  }
1550
+ return {
1551
+ content: [{
1552
+ type: 'text',
1553
+ text: details + '\n\n✨ Catalog item details retrieved!'
1554
+ }]
1555
+ };
1564
1556
  }
1565
- /**
1566
- * Discover Service Catalogs
1567
- */
1568
- async discoverCatalogs(args) {
1569
- try {
1570
- this.logger.info('Discovering service catalogs...');
1571
- let query = '';
1572
- if (args.active_only) {
1573
- query = 'active=true';
1574
- }
1575
- const catalogResponse = await this.client.searchRecords('sc_catalog', query, 50);
1576
- if (!catalogResponse.success) {
1577
- throw new Error('Failed to discover catalogs');
1557
+ catch (error) {
1558
+ this.logger.error('Failed to get catalog item details:', error);
1559
+ throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to get catalog item details: ${error}`);
1560
+ }
1561
+ }
1562
+ async;
1563
+ discoverCatalogs(args, any);
1564
+ {
1565
+ try {
1566
+ this.logger.info('Discovering service catalogs...');
1567
+ let query = '';
1568
+ if (args.active_only) {
1569
+ query = 'active=true';
1570
+ }
1571
+ const catalogResponse = await this.client.searchRecords('sc_catalog', query, 50);
1572
+ if (!catalogResponse.success) {
1573
+ throw new Error('Failed to discover catalogs');
1574
+ }
1575
+ const catalogs = catalogResponse.data.result;
1576
+ // Get categories if requested
1577
+ const catalogsWithDetails = await Promise.all(catalogs.map(async (catalog) => {
1578
+ if (args.include_categories) {
1579
+ const catResponse = await this.client.searchRecords('sc_category', `sc_catalog=${catalog.sys_id}`, 20);
1580
+ const categories = catResponse.success ? catResponse.data.result : [];
1581
+ return { ...catalog, categories };
1578
1582
  }
1579
- const catalogs = catalogResponse.data.result;
1580
- // Get categories if requested
1581
- const catalogsWithDetails = await Promise.all(catalogs.map(async (catalog) => {
1582
- if (args.include_categories) {
1583
- const catResponse = await this.client.searchRecords('sc_category', `sc_catalog=${catalog.sys_id}`, 20);
1584
- const categories = catResponse.success ? catResponse.data.result : [];
1585
- return { ...catalog, categories };
1586
- }
1587
- return catalog;
1588
- }));
1589
- const catalogText = catalogsWithDetails.map((catalog) => {
1590
- let text = `šŸ›ļø **${catalog.title}** ${catalog.active ? 'āœ…' : 'āŒ'}
1583
+ return catalog;
1584
+ }));
1585
+ const catalogText = catalogsWithDetails.map((catalog) => {
1586
+ let text = `šŸ›ļø **${catalog.title}** ${catalog.active ? 'āœ…' : 'āŒ'}
1591
1587
  šŸ†” ${catalog.sys_id}
1592
1588
  šŸ“ ${catalog.description || 'No description'}`;
1593
- if (catalog.categories) {
1594
- const categoryList = catalog.categories.map((cat) => ` - ${cat.title}`).join('\n');
1595
- text += `\nšŸ“‚ Categories:\n${categoryList || ' No categories'}`;
1596
- }
1597
- return text;
1598
- }).join('\n\n');
1599
- return {
1600
- content: [{
1601
- type: 'text',
1602
- text: `šŸ” Discovered Service Catalogs:
1589
+ if (catalog.categories) {
1590
+ const categoryList = catalog.categories.map((cat) => ` - ${cat.title}`).join('\n');
1591
+ text += `\nšŸ“‚ Categories:\n${categoryList || ' No categories'}`;
1592
+ }
1593
+ return text;
1594
+ }).join('\n\n');
1595
+ return {
1596
+ content: [{
1597
+ type: 'text',
1598
+ text: `šŸ” Discovered Service Catalogs:
1603
1599
 
1604
1600
  ${catalogText}
1605
1601
 
1606
1602
  ✨ Found ${catalogs.length} catalog(s)`
1607
- }]
1608
- };
1609
- }
1610
- catch (error) {
1611
- this.logger.error('Failed to discover catalogs:', error);
1612
- throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to discover catalogs: ${error}`);
1613
- }
1603
+ }]
1604
+ };
1614
1605
  }
1615
- async run() {
1616
- const transport = new stdio_js_1.StdioServerTransport();
1617
- await this.server.connect(transport);
1618
- this.logger.info('ServiceNow Knowledge & Catalog MCP Server running on stdio');
1606
+ catch (error) {
1607
+ this.logger.error('Failed to discover catalogs:', error);
1608
+ throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to discover catalogs: ${error}`);
1619
1609
  }
1620
1610
  }
1611
+ async;
1612
+ run();
1613
+ {
1614
+ const transport = new stdio_js_1.StdioServerTransport();
1615
+ await this.server.connect(transport);
1616
+ this.logger.info('ServiceNow Knowledge & Catalog MCP Server running on stdio');
1617
+ }
1621
1618
  const server = new ServiceNowKnowledgeCatalogMCP();
1622
1619
  server.run().catch(console.error);
1623
1620
  //# sourceMappingURL=servicenow-knowledge-catalog-mcp.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.3.5",
3
+ "version": "4.3.8",
4
4
  "description": "Conversational ServiceNow development platform using Claude Code. Multi-agent orchestration with 20+ MCP servers providing 200+ ServiceNow tools for comprehensive platform development.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",