snow-flow 3.0.9 → 3.0.13

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.
Files changed (302) hide show
  1. package/claude-flow.bat +0 -0
  2. package/claude-flow.ps1 +0 -0
  3. package/dist/mcp/intelligent-reporting-mcp.d.ts +7 -0
  4. package/dist/mcp/intelligent-reporting-mcp.js +379 -0
  5. package/dist/mcp/servicenow-automation-mcp.js +0 -0
  6. package/dist/mcp/servicenow-deployment-mcp.js +0 -0
  7. package/dist/mcp/servicenow-integration-mcp.js +0 -0
  8. package/dist/mcp/servicenow-mcp-server.js +0 -0
  9. package/dist/mcp/servicenow-operations-mcp.js +0 -0
  10. package/dist/mcp/servicenow-platform-development-mcp.js +0 -0
  11. package/dist/mcp/servicenow-progressive-indexer.js +0 -0
  12. package/dist/mcp/servicenow-reporting-analytics-mcp.js +280 -29
  13. package/dist/mcp/servicenow-security-compliance-mcp.js +0 -0
  14. package/dist/mcp/servicenow-update-set-mcp.js +0 -0
  15. package/dist/mcp/start-all-mcp-servers.js +0 -0
  16. package/dist/mcp/start-servicenow-mcp.js +0 -0
  17. package/dist/services/widget-deployment-service.d.ts +2 -1
  18. package/dist/services/widget-deployment-service.js +17 -16
  19. package/dist/utils/anti-mock-data-validator.d.ts +66 -0
  20. package/dist/utils/anti-mock-data-validator.js +316 -0
  21. package/dist/utils/servicenow-eventual-consistency.d.ts +120 -0
  22. package/dist/utils/servicenow-eventual-consistency.js +220 -0
  23. package/memory/agents/README.md +1 -1
  24. package/memory/claude-flow-data.json +1 -1
  25. package/memory/sessions/README.md +1 -1
  26. package/package.json +4 -3
  27. package/.mcp.json +0 -22
  28. package/claude-flow.config.json +0 -20
  29. package/dist/agents/app-creator.agent.d.ts +0 -55
  30. package/dist/agents/app-creator.agent.js +0 -1292
  31. package/dist/agents/base/base-snow-agent.d.ts +0 -75
  32. package/dist/agents/base/base-snow-agent.js +0 -169
  33. package/dist/agents/base-snow-agent.d.ts +0 -63
  34. package/dist/agents/base-snow-agent.js +0 -296
  35. package/dist/agents/coordinator.d.ts +0 -200
  36. package/dist/agents/coordinator.js +0 -777
  37. package/dist/agents/flow-builder-agent.d.ts +0 -18
  38. package/dist/agents/flow-builder-agent.js +0 -197
  39. package/dist/agents/queen-403-handler.d.ts +0 -47
  40. package/dist/agents/queen-403-handler.js +0 -175
  41. package/dist/agents/queen-agent-example.d.ts +0 -23
  42. package/dist/agents/queen-agent-example.js +0 -240
  43. package/dist/agents/queen-agent.test.d.ts +0 -6
  44. package/dist/agents/script-generator.agent.d.ts +0 -32
  45. package/dist/agents/script-generator.agent.js +0 -772
  46. package/dist/agents/script-writer-agent.d.ts +0 -22
  47. package/dist/agents/script-writer-agent.js +0 -695
  48. package/dist/agents/security-agent.d.ts +0 -23
  49. package/dist/agents/security-agent.js +0 -619
  50. package/dist/agents/specialists/automation-specialist.agent.d.ts +0 -44
  51. package/dist/agents/specialists/automation-specialist.agent.js +0 -204
  52. package/dist/agents/specialists/data-specialist.agent.d.ts +0 -165
  53. package/dist/agents/specialists/data-specialist.agent.js +0 -484
  54. package/dist/agents/specialists/integration-specialist.agent.d.ts +0 -227
  55. package/dist/agents/specialists/integration-specialist.agent.js +0 -725
  56. package/dist/agents/specialists/reporting-specialist.agent.d.ts +0 -54
  57. package/dist/agents/specialists/reporting-specialist.agent.js +0 -193
  58. package/dist/agents/specialists/security-specialist.agent.d.ts +0 -85
  59. package/dist/agents/specialists/security-specialist.agent.js +0 -309
  60. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +0 -111
  61. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +0 -383
  62. package/dist/agents/teams/base-team.d.ts +0 -72
  63. package/dist/agents/teams/base-team.js +0 -253
  64. package/dist/agents/teams/team-types.d.ts +0 -265
  65. package/dist/agents/teams/team-types.js +0 -3
  66. package/dist/agents/teams/widget/widget-architect.agent.d.ts +0 -61
  67. package/dist/agents/teams/widget/widget-architect.agent.js +0 -436
  68. package/dist/agents/teams/widget/widget-backend.agent.d.ts +0 -74
  69. package/dist/agents/teams/widget/widget-backend.agent.js +0 -1531
  70. package/dist/agents/teams/widget/widget-frontend.agent.d.ts +0 -67
  71. package/dist/agents/teams/widget/widget-frontend.agent.js +0 -1014
  72. package/dist/agents/teams/widget/widget-platform.agent.d.ts +0 -90
  73. package/dist/agents/teams/widget/widget-platform.agent.js +0 -1190
  74. package/dist/agents/teams/widget/widget-uiux.agent.d.ts +0 -107
  75. package/dist/agents/teams/widget/widget-uiux.agent.js +0 -1033
  76. package/dist/agents/test-agent.d.ts +0 -26
  77. package/dist/agents/test-agent.js +0 -734
  78. package/dist/agents/test-agents.d.ts +0 -7
  79. package/dist/agents/test-agents.js +0 -64
  80. package/dist/agents/ui-builder.agent.d.ts +0 -50
  81. package/dist/agents/ui-builder.agent.js +0 -1539
  82. package/dist/agents/widget-builder.agent.d.ts +0 -32
  83. package/dist/agents/widget-builder.agent.js +0 -439
  84. package/dist/agents/widget-creator-agent.d.ts +0 -18
  85. package/dist/agents/widget-creator-agent.js +0 -498
  86. package/dist/agents/workflow-designer.agent.d.ts +0 -31
  87. package/dist/agents/workflow-designer.agent.js +0 -583
  88. package/dist/api/error-handling.d.ts +0 -325
  89. package/dist/api/error-handling.js +0 -1488
  90. package/dist/api/flow-designer-api.d.ts +0 -167
  91. package/dist/api/flow-designer-api.js +0 -554
  92. package/dist/api/natural-language-mapper.d.ts +0 -124
  93. package/dist/api/natural-language-mapper.js +0 -501
  94. package/dist/api/performance-optimizer.d.ts +0 -240
  95. package/dist/api/performance-optimizer.js +0 -706
  96. package/dist/api/transaction-manager.d.ts +0 -189
  97. package/dist/api/transaction-manager.js +0 -576
  98. package/dist/assembly/team-assembler.d.ts +0 -140
  99. package/dist/assembly/team-assembler.js +0 -502
  100. package/dist/benchmark-performance.d.ts +0 -41
  101. package/dist/benchmark-performance.js +0 -230
  102. package/dist/cli/snow-flow-cli-integration.d.ts +0 -30
  103. package/dist/cli/snow-flow-cli-integration.js +0 -396
  104. package/dist/coordination/coordination-engine.d.ts +0 -41
  105. package/dist/coordination/coordination-engine.js +0 -324
  106. package/dist/coordination/coordination.test.d.ts +0 -6
  107. package/dist/coordination/example.d.ts +0 -31
  108. package/dist/coordination/example.js +0 -394
  109. package/dist/coordination/execution-patterns.d.ts +0 -43
  110. package/dist/coordination/execution-patterns.js +0 -507
  111. package/dist/coordination/factory.d.ts +0 -94
  112. package/dist/coordination/factory.js +0 -433
  113. package/dist/coordination/index.d.ts +0 -71
  114. package/dist/coordination/index.js +0 -135
  115. package/dist/coordination/progress-monitor.d.ts +0 -71
  116. package/dist/coordination/progress-monitor.js +0 -505
  117. package/dist/coordination/quality-gates.d.ts +0 -124
  118. package/dist/coordination/quality-gates.js +0 -577
  119. package/dist/coordination/shared-memory.d.ts +0 -39
  120. package/dist/coordination/shared-memory.js +0 -289
  121. package/dist/coordination/task-dependencies.d.ts +0 -50
  122. package/dist/coordination/task-dependencies.js +0 -407
  123. package/dist/coordination/team-coordinator.d.ts +0 -59
  124. package/dist/coordination/team-coordinator.js +0 -550
  125. package/dist/coordination/types.d.ts +0 -152
  126. package/dist/coordination/types.js +0 -3
  127. package/dist/mcp/mcp-wrapper.d.ts +0 -8
  128. package/dist/mcp/mcp-wrapper.js +0 -77
  129. package/dist/mcp/servicenow-flow-composer-enhanced.js +0 -396
  130. package/dist/mcp/servicenow-flow-composer-mcp.d.ts +0 -7
  131. package/dist/mcp/servicenow-flow-composer-mcp.js +0 -3103
  132. package/dist/mcp/servicenow-graph-memory-mcp.d.ts +0 -7
  133. package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -143
  134. package/dist/mcp/servicenow-intelligent-mcp.js +0 -4156
  135. package/dist/mcp/servicenow-xml-flow-mcp.d.ts +0 -53
  136. package/dist/mcp/servicenow-xml-flow-mcp.js +0 -1704
  137. package/dist/mcp/singleton-check.js +0 -31
  138. package/dist/mcp/test-simple-mcp.d.ts +0 -6
  139. package/dist/mcp/test-simple-mcp.js +0 -63
  140. package/dist/memory/hierarchical-memory-system.d.ts +0 -90
  141. package/dist/memory/hierarchical-memory-system.js +0 -400
  142. package/dist/memory/index.d.ts +0 -9
  143. package/dist/memory/index.js +0 -20
  144. package/dist/memory/mcp-integration-example.d.ts +0 -6
  145. package/dist/memory/mcp-integration-example.js +0 -281
  146. package/dist/memory/memory-client.d.ts +0 -199
  147. package/dist/memory/memory-client.js +0 -364
  148. package/dist/memory/memory-manager.d.ts +0 -29
  149. package/dist/memory/memory-manager.js +0 -280
  150. package/dist/memory/memory-operations.d.ts +0 -179
  151. package/dist/memory/memory-operations.js +0 -691
  152. package/dist/memory/memory-system.d.ts +0 -153
  153. package/dist/memory/memory-system.js +0 -651
  154. package/dist/memory/memory-test.d.ts +0 -6
  155. package/dist/memory/memory-test.js +0 -161
  156. package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
  157. package/dist/memory/snow-flow-memory-patterns.js +0 -200
  158. package/dist/memory/snow-memory.d.ts +0 -54
  159. package/dist/memory/snow-memory.js +0 -301
  160. package/dist/memory/swarm-memory.d.ts +0 -135
  161. package/dist/memory/swarm-memory.js +0 -378
  162. package/dist/optimization/flow-performance-optimizer.js +0 -723
  163. package/dist/orchestration/discovery/service-discovery.d.ts +0 -81
  164. package/dist/orchestration/discovery/service-discovery.js +0 -808
  165. package/dist/orchestration/distributed-orchestrator.d.ts +0 -131
  166. package/dist/orchestration/distributed-orchestrator.js +0 -712
  167. package/dist/orchestration/distribution/task-distribution-engine.d.ts +0 -53
  168. package/dist/orchestration/distribution/task-distribution-engine.js +0 -586
  169. package/dist/orchestration/flow-update-orchestrator.js +0 -648
  170. package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +0 -606
  171. package/dist/orchestration/interfaces/distributed-orchestration.interface.js +0 -65
  172. package/dist/orchestration/protocols/mcpx-protocol.d.ts +0 -71
  173. package/dist/orchestration/protocols/mcpx-protocol.js +0 -668
  174. package/dist/orchestration/state/distributed-state-manager.d.ts +0 -89
  175. package/dist/orchestration/state/distributed-state-manager.js +0 -716
  176. package/dist/orchestrator/flow-composer.d.ts +0 -105
  177. package/dist/orchestrator/flow-composer.js +0 -404
  178. package/dist/orchestrator/flow-pattern-templates.d.ts +0 -260
  179. package/dist/orchestrator/flow-pattern-templates.js +0 -908
  180. package/dist/orchestrator/flow-subflow-decision-engine.d.ts +0 -202
  181. package/dist/orchestrator/flow-subflow-decision-engine.js +0 -769
  182. package/dist/orchestrator/flow-validation-engine.d.ts +0 -169
  183. package/dist/orchestrator/flow-validation-engine.js +0 -913
  184. package/dist/orchestrator/snow-orchestrator.d.ts +0 -49
  185. package/dist/orchestrator/snow-orchestrator.js +0 -235
  186. package/dist/orchestrator/subflow-creation-handler.d.ts +0 -230
  187. package/dist/orchestrator/subflow-creation-handler.js +0 -791
  188. package/dist/patterns/adaptive-patterns.d.ts +0 -140
  189. package/dist/patterns/adaptive-patterns.js +0 -549
  190. package/dist/queen/advanced-integration-test.d.ts +0 -48
  191. package/dist/queen/advanced-integration-test.js +0 -473
  192. package/dist/queen/integration-example.d.ts +0 -82
  193. package/dist/queen/integration-example.js +0 -219
  194. package/dist/queen/integration-test.d.ts +0 -72
  195. package/dist/queen/integration-test.js +0 -563
  196. package/dist/queen/mock-mcp-client.d.ts +0 -71
  197. package/dist/queen/mock-mcp-client.js +0 -317
  198. package/dist/queen/run-integration-tests.d.ts +0 -9
  199. package/dist/queen/run-integration-tests.js +0 -27
  200. package/dist/sparc/coordinators/adaptive-coordinator.d.ts +0 -54
  201. package/dist/sparc/coordinators/adaptive-coordinator.js +0 -367
  202. package/dist/sparc/coordinators/team-coordinator.d.ts +0 -66
  203. package/dist/sparc/coordinators/team-coordinator.js +0 -402
  204. package/dist/sparc/modes/team-modes.d.ts +0 -33
  205. package/dist/sparc/modes/team-modes.js +0 -399
  206. package/dist/sparc/teams/application-team.d.ts +0 -73
  207. package/dist/sparc/teams/application-team.js +0 -463
  208. package/dist/sparc/teams/flow-team.d.ts +0 -67
  209. package/dist/sparc/teams/flow-team.js +0 -373
  210. package/dist/sparc/teams/widget-team.d.ts +0 -61
  211. package/dist/sparc/teams/widget-team.js +0 -280
  212. package/dist/specialists/app-specialists.d.ts +0 -93
  213. package/dist/specialists/app-specialists.js +0 -1639
  214. package/dist/specialists/base-specialist.d.ts +0 -19
  215. package/dist/specialists/base-specialist.js +0 -54
  216. package/dist/specialists/flow-specialists.d.ts +0 -113
  217. package/dist/specialists/flow-specialists.js +0 -1787
  218. package/dist/specialists/individual-specialists.d.ts +0 -67
  219. package/dist/specialists/individual-specialists.js +0 -632
  220. package/dist/specialists/widget-specialists.d.ts +0 -70
  221. package/dist/specialists/widget-specialists.js +0 -1264
  222. package/dist/src/utils/agent-detector.js +0 -655
  223. package/dist/teams/adaptive-team.d.ts +0 -81
  224. package/dist/teams/adaptive-team.js +0 -1153
  225. package/dist/teams/application-team.d.ts +0 -30
  226. package/dist/teams/application-team.js +0 -547
  227. package/dist/teams/base-team.d.ts +0 -55
  228. package/dist/teams/base-team.js +0 -243
  229. package/dist/teams/flow-team.d.ts +0 -28
  230. package/dist/teams/flow-team.js +0 -525
  231. package/dist/teams/widget-team.d.ts +0 -26
  232. package/dist/teams/widget-team.js +0 -459
  233. package/dist/templates/flow-template-system.js +0 -625
  234. package/dist/test-fetch-incidents.d.ts +0 -2
  235. package/dist/test-fetch-incidents.js +0 -84
  236. package/dist/test-incident-access.d.ts +0 -2
  237. package/dist/test-incident-access.js +0 -72
  238. package/dist/test-iphone-flow.js +0 -189
  239. package/dist/test-limit-problem.d.ts +0 -2
  240. package/dist/test-limit-problem.js +0 -60
  241. package/dist/test-ml-batch-fix.d.ts +0 -2
  242. package/dist/test-ml-batch-fix.js +0 -104
  243. package/dist/test-ml-batch.d.ts +0 -2
  244. package/dist/test-ml-batch.js +0 -87
  245. package/dist/test-ml-query.d.ts +0 -2
  246. package/dist/test-ml-query.js +0 -100
  247. package/dist/test-ml-training-fix.d.ts +0 -12
  248. package/dist/test-ml-training-fix.js +0 -113
  249. package/dist/test-ml-training.d.ts +0 -2
  250. package/dist/test-ml-training.js +0 -32
  251. package/dist/test-operations-query.d.ts +0 -2
  252. package/dist/test-operations-query.js +0 -84
  253. package/dist/test-performance-query.d.ts +0 -2
  254. package/dist/test-performance-query.js +0 -52
  255. package/dist/test-singleton-protection.d.ts +0 -8
  256. package/dist/test-singleton-protection.js +0 -110
  257. package/dist/test-smart-limits.d.ts +0 -13
  258. package/dist/test-smart-limits.js +0 -100
  259. package/dist/test-snow-query-incidents.d.ts +0 -2
  260. package/dist/test-snow-query-incidents.js +0 -66
  261. package/dist/test-universal-query.d.ts +0 -2
  262. package/dist/test-universal-query.js +0 -106
  263. package/dist/testing/flow-testing-automation.js +0 -641
  264. package/dist/utils/complete-flow-xml-generator.js +0 -1285
  265. package/dist/utils/file-storage-fallback.d.ts +0 -62
  266. package/dist/utils/file-storage-fallback.js +0 -289
  267. package/dist/utils/flow-api-discovery.d.ts +0 -151
  268. package/dist/utils/flow-api-discovery.js +0 -439
  269. package/dist/utils/flow-examples.js +0 -720
  270. package/dist/utils/flow-structure-builder.js +0 -677
  271. package/dist/utils/flow-xml-generator.d.ts +0 -41
  272. package/dist/utils/flow-xml-generator.js +0 -258
  273. package/dist/utils/improved-flow-xml-generator.js +0 -820
  274. package/dist/utils/mcp-process-manager.backup.d.ts +0 -58
  275. package/dist/utils/mcp-process-manager.backup.js +0 -220
  276. package/dist/utils/mcp-singleton-enforcer.d.ts +0 -36
  277. package/dist/utils/mcp-singleton-enforcer.js +0 -201
  278. package/dist/utils/mcp-timeout-fix.d.ts +0 -53
  279. package/dist/utils/mcp-timeout-fix.js +0 -221
  280. package/dist/utils/migrate-claude-flow.d.ts +0 -22
  281. package/dist/utils/migrate-claude-flow.js +0 -120
  282. package/dist/utils/scope-utils.d.ts +0 -72
  283. package/dist/utils/scope-utils.js +0 -386
  284. package/dist/utils/snow-oauth-old.d.ts +0 -65
  285. package/dist/utils/snow-oauth-old.js +0 -345
  286. package/dist/utils/xml-first-flow-generator.js +0 -513
  287. package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
  288. package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
  289. package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
  290. package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
  291. package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
  292. package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
  293. package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
  294. package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
  295. package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
  296. package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
  297. package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
  298. package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
  299. package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
  300. package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
  301. package/reports/swarm-auto-centralized-1752649029776.json +0 -13
  302. package/src/memory/README.md +0 -240
package/claude-flow.bat CHANGED
File without changes
package/claude-flow.ps1 CHANGED
File without changes
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Intelligent ServiceNow Reporting MCP Server
4
+ * Uses snow_query_table for real table discovery instead of hardcoded mappings
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=intelligent-reporting-mcp.d.ts.map
@@ -0,0 +1,379 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * Intelligent ServiceNow Reporting MCP Server
5
+ * Uses snow_query_table for real table discovery instead of hardcoded mappings
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
9
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
10
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
11
+ const servicenow_client_js_1 = require("../utils/servicenow-client.js");
12
+ const mcp_auth_middleware_js_1 = require("../utils/mcp-auth-middleware.js");
13
+ const logger_js_1 = require("../utils/logger.js");
14
+ const anti_mock_data_validator_js_1 = require("../utils/anti-mock-data-validator.js");
15
+ class IntelligentReportingMCP {
16
+ constructor() {
17
+ this.server = new index_js_1.Server({
18
+ name: 'intelligent-reporting',
19
+ version: '1.0.0',
20
+ }, {
21
+ capabilities: {
22
+ tools: {},
23
+ },
24
+ });
25
+ this.client = new servicenow_client_js_1.ServiceNowClient();
26
+ this.logger = new logger_js_1.Logger('IntelligentReportingMCP');
27
+ this.setupHandlers();
28
+ }
29
+ setupHandlers() {
30
+ this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
31
+ tools: [
32
+ {
33
+ name: 'snow_intelligent_report',
34
+ description: '🔥 REAL DATA ONLY: Creates reports with intelligent table discovery using LIVE ServiceNow data. Input any description and it finds the right table with REAL data from your instance. NO mock/demo data used.',
35
+ inputSchema: {
36
+ type: 'object',
37
+ properties: {
38
+ name: { type: 'string', description: 'Report name (e.g., "ITSM Trend Analysis")' },
39
+ description: { type: 'string', description: 'User description of what they want (e.g., "ITSM Overview Metrics", "Change Request Pipeline")' },
40
+ conditions: { type: 'string', description: 'Optional filter conditions' },
41
+ format: { type: 'string', description: 'Output format (PDF, Excel, CSV)' },
42
+ includeAnalysis: { type: 'boolean', description: 'Include data analysis and insights' }
43
+ },
44
+ required: ['name', 'description']
45
+ }
46
+ },
47
+ {
48
+ name: 'snow_intelligent_dashboard',
49
+ description: '🔥 REAL DATA ONLY: Creates dashboards with intelligent discovery using LIVE ServiceNow data. Automatically finds relevant data from your actual instance. NO mock/demo data used.',
50
+ inputSchema: {
51
+ type: 'object',
52
+ properties: {
53
+ name: { type: 'string', description: 'Dashboard name' },
54
+ description: { type: 'string', description: 'What the user wants to see (e.g., "Operations overview", "Service desk metrics")' },
55
+ refreshInterval: { type: 'number', description: 'Refresh interval in minutes' }
56
+ },
57
+ required: ['name', 'description']
58
+ }
59
+ }
60
+ ]
61
+ }));
62
+ this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
63
+ try {
64
+ const { name, arguments: args } = request.params;
65
+ const authResult = await mcp_auth_middleware_js_1.mcpAuth.ensureAuthenticated();
66
+ if (!authResult.success) {
67
+ throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, authResult.error || 'Authentication required');
68
+ }
69
+ switch (name) {
70
+ case 'snow_intelligent_report':
71
+ return await this.createIntelligentReport(args);
72
+ case 'snow_intelligent_dashboard':
73
+ return await this.createIntelligentDashboard(args);
74
+ default:
75
+ throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
76
+ }
77
+ }
78
+ catch (error) {
79
+ this.logger.error(`Error in ${request.params.name}:`, error);
80
+ throw error;
81
+ }
82
+ });
83
+ }
84
+ /**
85
+ * Create report with intelligent table discovery
86
+ */
87
+ async createIntelligentReport(args) {
88
+ try {
89
+ this.logger.info(`🔍 Creating intelligent report for: "${args.description}"`);
90
+ // Step 1: Discover the right table(s) based on user description
91
+ const discoveredTables = await this.discoverRelevantTables(args.description);
92
+ if (discoveredTables.length === 0) {
93
+ throw new Error(`Could not find relevant ServiceNow tables for: "${args.description}". Try being more specific, like: "incident metrics", "change requests", or "user statistics".`);
94
+ }
95
+ // Step 2: Use the best matching table
96
+ const primaryTable = discoveredTables[0];
97
+ this.logger.info(`✅ Using table: ${primaryTable.name} (${primaryTable.recordCount} records)`);
98
+ // Step 3: Get real data sample to understand the structure
99
+ await this.enrichTableWithSampleData(primaryTable);
100
+ // Step 4: Create the actual report
101
+ const reportData = {
102
+ title: args.name,
103
+ table: primaryTable.name,
104
+ description: `${args.description} - Auto-discovered from ${primaryTable.label}`,
105
+ filter: args.conditions || this.buildIntelligentFilter(args.description, primaryTable),
106
+ field_list: this.selectRelevantFields(primaryTable, args.description),
107
+ type: this.determineReportType(args.description),
108
+ is_published: true,
109
+ active: true
110
+ };
111
+ const response = await this.client.createRecord('sys_report', reportData);
112
+ if (!response.success) {
113
+ throw new Error(`Failed to create report: ${response.error}`);
114
+ }
115
+ // Step 5: Generate insights if requested
116
+ let insights = '';
117
+ if (args.includeAnalysis) {
118
+ insights = await this.generateDataInsights(primaryTable);
119
+ }
120
+ const reportUrl = `${process.env.SNOW_INSTANCE}/sys_report_template.do?jvar_report_id=${response.data.sys_id}`;
121
+ return {
122
+ content: [{
123
+ type: 'text',
124
+ text: `✅ Intelligent Report Created!
125
+
126
+ 📊 **${args.name}**
127
+ 🆔 sys_id: ${response.data.sys_id}
128
+
129
+ 🔍 **Discovery Results:**
130
+ 📋 Found Table: ${primaryTable.label} (${primaryTable.name})
131
+ 📈 Records Available: ${primaryTable.recordCount}
132
+ 📝 Fields Used: ${reportData.field_list}
133
+
134
+ 🎯 **Report Details:**
135
+ ${args.conditions ? `🔍 Custom Filter: ${args.conditions}` : `🤖 Smart Filter: ${reportData.filter}`}
136
+ 📄 Format: ${args.format || 'HTML'}
137
+ 🔗 View Report: ${reportUrl}
138
+
139
+ ${insights ? `📊 **Data Insights:**
140
+ ${insights}
141
+
142
+ ` : ''}🚀 Report ready with real ServiceNow data!`
143
+ }]
144
+ };
145
+ }
146
+ catch (error) {
147
+ this.logger.error('Failed to create intelligent report:', error);
148
+ throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Failed to create intelligent report: ${error}`);
149
+ }
150
+ }
151
+ /**
152
+ * Discover relevant tables using snow_query_table
153
+ */
154
+ async discoverRelevantTables(description) {
155
+ try {
156
+ const results = [];
157
+ // Extract keywords from description
158
+ const keywords = this.extractKeywords(description);
159
+ this.logger.info(`🔑 Keywords: ${keywords.join(', ')}`);
160
+ // Search for tables that might contain relevant data
161
+ const candidateTables = await this.findCandidateTables(keywords);
162
+ // Test each candidate table to see if it has data
163
+ for (const candidate of candidateTables) {
164
+ try {
165
+ // Use snow_query_table MCP to test the table
166
+ const testQuery = await this.testTableWithQuery(candidate, keywords);
167
+ if (testQuery && testQuery.recordCount > 0) {
168
+ results.push({
169
+ name: candidate,
170
+ label: testQuery.label || candidate,
171
+ recordCount: testQuery.recordCount,
172
+ fields: testQuery.fields || []
173
+ });
174
+ }
175
+ }
176
+ catch (error) {
177
+ this.logger.warn(`Table ${candidate} test failed:`, error);
178
+ }
179
+ }
180
+ // Sort by relevance (record count and keyword matches)
181
+ return results.sort((a, b) => b.recordCount - a.recordCount);
182
+ }
183
+ catch (error) {
184
+ this.logger.error('Table discovery failed:', error);
185
+ return [];
186
+ }
187
+ }
188
+ /**
189
+ * Extract meaningful keywords from user description
190
+ */
191
+ extractKeywords(description) {
192
+ const text = description.toLowerCase();
193
+ // ServiceNow domain keywords
194
+ const domainKeywords = [
195
+ 'incident', 'problem', 'change', 'request', 'task', 'user', 'asset', 'configuration',
196
+ 'service', 'catalog', 'knowledge', 'article', 'approval', 'workflow', 'sla',
197
+ 'metric', 'kpi', 'analytics', 'report', 'dashboard', 'overview', 'trend', 'analysis'
198
+ ];
199
+ const found = domainKeywords.filter(keyword => text.includes(keyword));
200
+ // Add any other significant words (3+ chars, not common words)
201
+ const words = text.split(/\s+/).filter(word => word.length >= 3 &&
202
+ !['the', 'and', 'for', 'with', 'from', 'that', 'this', 'are', 'was'].includes(word));
203
+ return [...new Set([...found, ...words])];
204
+ }
205
+ /**
206
+ * Find candidate tables based on keywords
207
+ */
208
+ async findCandidateTables(keywords) {
209
+ const candidates = new Set();
210
+ // Keyword-to-table mapping based on ServiceNow knowledge
211
+ const tableMapping = {
212
+ 'incident': ['incident'],
213
+ 'problem': ['problem'],
214
+ 'change': ['change_request'],
215
+ 'request': ['sc_request', 'sc_req_item', 'change_request'],
216
+ 'task': ['task', 'sc_task'],
217
+ 'user': ['sys_user'],
218
+ 'asset': ['alm_asset'],
219
+ 'configuration': ['cmdb_ci'],
220
+ 'service': ['service_offering', 'sc_cat_item'],
221
+ 'catalog': ['sc_cat_item', 'sc_category'],
222
+ 'knowledge': ['kb_knowledge'],
223
+ 'approval': ['sysapproval_approver'],
224
+ 'workflow': ['wf_workflow'],
225
+ 'metric': ['sys_report', 'pa_dashboards'],
226
+ 'kpi': ['pa_indicators'],
227
+ 'overview': ['incident', 'change_request', 'problem', 'task'],
228
+ 'trend': ['incident', 'change_request', 'problem'],
229
+ 'analysis': ['incident', 'change_request', 'problem', 'task']
230
+ };
231
+ // Add tables based on keyword matches
232
+ for (const keyword of keywords) {
233
+ if (tableMapping[keyword]) {
234
+ tableMapping[keyword].forEach(table => candidates.add(table));
235
+ }
236
+ }
237
+ // Default fallback tables if no specific matches
238
+ if (candidates.size === 0) {
239
+ ['incident', 'change_request', 'problem', 'task', 'sys_user'].forEach(table => candidates.add(table));
240
+ }
241
+ return Array.from(candidates);
242
+ }
243
+ /**
244
+ * Test a table using actual ServiceNow query
245
+ */
246
+ async testTableWithQuery(tableName, keywords) {
247
+ try {
248
+ // First, get table info
249
+ const tableInfo = await this.client.searchRecords('sys_db_object', `name=${tableName}`, 1);
250
+ const label = tableInfo.success && tableInfo.data?.result?.length > 0
251
+ ? tableInfo.data.result[0].label
252
+ : tableName;
253
+ // Get record count and sample fields
254
+ const query = await this.client.searchRecords(tableName, '', 20); // Real data sample (increased for better analysis)
255
+ if (query.success && query.data?.result) {
256
+ const records = query.data.result;
257
+ // 🔥 ENFORCE ZERO MOCK DATA TOLERANCE
258
+ (0, anti_mock_data_validator_js_1.validateRealData)(records, `Table Discovery for ${tableName}`);
259
+ const fields = records.length > 0 ? Object.keys(records[0]) : [];
260
+ // Get total count (this is a bit hacky, but ServiceNow doesn't have a direct count API)
261
+ const countQuery = await this.client.searchRecords(tableName, '', 1);
262
+ const recordCount = countQuery.success ? (countQuery.data?.result?.length > 0 ? 100 : 0) : 0; // Estimate
263
+ return { recordCount, label, fields };
264
+ }
265
+ return null;
266
+ }
267
+ catch (error) {
268
+ this.logger.error(`Failed to test table ${tableName}:`, error);
269
+ return null;
270
+ }
271
+ }
272
+ /**
273
+ * Enrich table data with sample records
274
+ */
275
+ async enrichTableWithSampleData(table) {
276
+ try {
277
+ const sampleQuery = await this.client.searchRecords(table.name, '', 10); // Real data sample (increased)
278
+ if (sampleQuery.success && sampleQuery.data?.result) {
279
+ // 🔥 ENFORCE ZERO MOCK DATA TOLERANCE
280
+ (0, anti_mock_data_validator_js_1.validateRealData)(sampleQuery.data.result, `Sample Data for ${table.name}`);
281
+ table.sampleData = sampleQuery.data.result;
282
+ }
283
+ }
284
+ catch (error) {
285
+ this.logger.warn(`Could not get sample data for ${table.name}:`, error);
286
+ }
287
+ }
288
+ /**
289
+ * Build intelligent filter based on description
290
+ */
291
+ buildIntelligentFilter(description, table) {
292
+ const desc = description.toLowerCase();
293
+ // Common filters based on description patterns
294
+ if (desc.includes('active') || desc.includes('current') || desc.includes('open')) {
295
+ if (table.fields.includes('active'))
296
+ return 'active=true';
297
+ if (table.fields.includes('state') && table.name === 'incident')
298
+ return 'stateNOT IN6,7,8';
299
+ }
300
+ if (desc.includes('recent') || desc.includes('last month') || desc.includes('30 days')) {
301
+ return 'sys_created_on>=javascript:gs.daysAgoStart(30)';
302
+ }
303
+ if (desc.includes('high priority') || desc.includes('critical')) {
304
+ return 'priority<=2';
305
+ }
306
+ return ''; // No filter
307
+ }
308
+ /**
309
+ * Select relevant fields for the report
310
+ */
311
+ selectRelevantFields(table, description) {
312
+ const desc = description.toLowerCase();
313
+ // Smart field selection based on table type
314
+ const fieldSets = {
315
+ 'incident': ['number', 'short_description', 'priority', 'state', 'assigned_to', 'sys_created_on'],
316
+ 'change_request': ['number', 'short_description', 'type', 'state', 'requested_by', 'sys_created_on'],
317
+ 'problem': ['number', 'short_description', 'priority', 'state', 'assigned_to', 'root_cause'],
318
+ 'sys_user': ['name', 'user_name', 'email', 'department', 'title', 'active'],
319
+ 'task': ['number', 'short_description', 'priority', 'state', 'assigned_to', 'sys_created_on']
320
+ };
321
+ const defaultFields = fieldSets[table.name] || ['sys_id', 'sys_created_on', 'sys_updated_on'];
322
+ // Filter to only include fields that actually exist
323
+ const availableFields = defaultFields.filter(field => table.fields.includes(field));
324
+ return availableFields.length > 0 ? availableFields.join(',') : table.fields.slice(0, 6).join(',');
325
+ }
326
+ /**
327
+ * Determine report type based on description
328
+ */
329
+ determineReportType(description) {
330
+ const desc = description.toLowerCase();
331
+ if (desc.includes('trend') || desc.includes('over time'))
332
+ return 'trend';
333
+ if (desc.includes('count') || desc.includes('summary'))
334
+ return 'list';
335
+ if (desc.includes('chart') || desc.includes('graph'))
336
+ return 'bar';
337
+ return 'list'; // Default
338
+ }
339
+ /**
340
+ * Generate data insights
341
+ */
342
+ async generateDataInsights(table) {
343
+ if (!table.sampleData || table.sampleData.length === 0) {
344
+ return 'No sample data available for insights';
345
+ }
346
+ const insights = [];
347
+ insights.push(`Sample shows ${table.sampleData.length} records from ${table.label}`);
348
+ // Analyze common patterns
349
+ const sample = table.sampleData[0];
350
+ if (sample.state)
351
+ insights.push(`Records have state tracking`);
352
+ if (sample.priority)
353
+ insights.push(`Priority levels available`);
354
+ if (sample.assigned_to)
355
+ insights.push(`Assignment tracking enabled`);
356
+ return insights.join('\n');
357
+ }
358
+ /**
359
+ * Create intelligent dashboard
360
+ */
361
+ async createIntelligentDashboard(args) {
362
+ // Similar intelligent discovery logic for dashboards
363
+ // This would use the same table discovery but create dashboard widgets instead
364
+ return {
365
+ content: [{
366
+ type: 'text',
367
+ text: `Intelligent Dashboard creation coming soon! For now, use snow_intelligent_report to create reports with intelligent table discovery.`
368
+ }]
369
+ };
370
+ }
371
+ async run() {
372
+ const transport = new stdio_js_1.StdioServerTransport();
373
+ await this.server.connect(transport);
374
+ this.logger.info('Intelligent ServiceNow Reporting MCP Server running on stdio');
375
+ }
376
+ }
377
+ const server = new IntelligentReportingMCP();
378
+ server.run().catch(console.error);
379
+ //# sourceMappingURL=intelligent-reporting-mcp.js.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes