@fluentcommerce/ai-skills 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @fluentcommerce/ai-skills might be problematic. Click here for more details.

Files changed (168) hide show
  1. package/README.md +866 -622
  2. package/bin/cli.mjs +2112 -1973
  3. package/content/cli/agents/fluent-cli/agent.json +149 -149
  4. package/content/cli/agents/fluent-cli.md +132 -132
  5. package/content/cli/skills/fluent-bootstrap/SKILL.md +214 -181
  6. package/content/cli/skills/fluent-cli-index/SKILL.md +1 -1
  7. package/content/cli/skills/fluent-cli-mcp-cicd/SKILL.md +117 -1
  8. package/content/cli/skills/fluent-cli-reference/SKILL.md +1040 -1031
  9. package/content/cli/skills/fluent-cli-retailer/SKILL.md +27 -2
  10. package/content/cli/skills/fluent-cli-settings/SKILL.md +21 -1
  11. package/content/cli/skills/fluent-connect/SKILL.md +937 -886
  12. package/content/cli/skills/fluent-module-deploy/SKILL.md +63 -5
  13. package/content/cli/skills/fluent-profile/SKILL.md +73 -0
  14. package/content/cli/skills/fluent-workflow/SKILL.md +360 -310
  15. package/content/dev/agents/fluent-backend-dev/AGENT.md +58 -0
  16. package/content/dev/agents/fluent-backend-dev/agent.json +69 -0
  17. package/content/dev/agents/fluent-backend-dev.md +287 -0
  18. package/content/dev/agents/fluent-dev/AGENT.md +98 -0
  19. package/content/dev/agents/fluent-dev/agent.json +14 -2
  20. package/content/dev/agents/fluent-dev.md +194 -525
  21. package/content/dev/agents/fluent-frontend-dev/AGENT.md +63 -0
  22. package/content/dev/agents/fluent-frontend-dev/agent.json +52 -0
  23. package/content/dev/agents/fluent-frontend-dev.md +323 -0
  24. package/content/dev/skills/fluent-archive/SKILL.md +234 -0
  25. package/content/dev/skills/fluent-build/SKILL.md +312 -192
  26. package/content/dev/skills/fluent-connection-analysis/SKILL.md +422 -386
  27. package/content/dev/skills/fluent-custom-code/SKILL.md +15 -9
  28. package/content/dev/skills/fluent-data-module-scaffold/SKILL.md +19 -2
  29. package/content/dev/skills/fluent-e2e-test/SKILL.md +501 -394
  30. package/content/dev/skills/fluent-event-api/SKILL.md +962 -945
  31. package/content/dev/skills/fluent-feature-explain/SKILL.md +680 -603
  32. package/content/dev/skills/fluent-feature-plan/PLAN_TEMPLATE.md +27 -2
  33. package/content/dev/skills/fluent-feature-plan/SKILL.md +478 -227
  34. package/content/dev/skills/fluent-feature-status/SKILL.md +335 -0
  35. package/content/dev/skills/fluent-feedback/SKILL.md +221 -0
  36. package/content/dev/skills/fluent-implementation-map/SKILL.md +644 -0
  37. package/content/dev/skills/fluent-job-batch/SKILL.md +10 -0
  38. package/content/dev/skills/fluent-module-scaffold/SKILL.md +64 -2
  39. package/content/dev/skills/fluent-module-validate/SKILL.md +778 -775
  40. package/content/dev/skills/fluent-mystique-analyze/SKILL.md +817 -0
  41. package/content/dev/skills/fluent-mystique-builder/COMPONENT_TEMPLATE.md +81 -0
  42. package/content/dev/skills/fluent-mystique-builder/README.md +63 -0
  43. package/content/dev/skills/fluent-mystique-builder/SKILL.md +1294 -0
  44. package/content/dev/skills/fluent-mystique-builder/components/INDEX.md +92 -0
  45. package/content/dev/skills/fluent-mystique-builder/components/fc.accordion.md +48 -0
  46. package/content/dev/skills/fluent-mystique-builder/components/fc.action.field.fulfilmentpack.md +20 -0
  47. package/content/dev/skills/fluent-mystique-builder/components/fc.action.field.multiparcel.md +21 -0
  48. package/content/dev/skills/fluent-mystique-builder/components/fc.action.field.returnitems.md +21 -0
  49. package/content/dev/skills/fluent-mystique-builder/components/fc.action.field.wavepick.md +21 -0
  50. package/content/dev/skills/fluent-mystique-builder/components/fc.action.inline.md +24 -0
  51. package/content/dev/skills/fluent-mystique-builder/components/fc.activity.entity.md +25 -0
  52. package/content/dev/skills/fluent-mystique-builder/components/fc.analytics.viz.md +20 -0
  53. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.column.md +111 -0
  54. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.json.md +20 -0
  55. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.jsoneditor.md +54 -0
  56. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.locationId.md +51 -0
  57. package/content/dev/skills/fluent-mystique-builder/components/fc.attribute.retailerId.md +52 -0
  58. package/content/dev/skills/fluent-mystique-builder/components/fc.button.bar.md +57 -0
  59. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.download.md +53 -0
  60. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.inline.compatibility.md +60 -0
  61. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.inline.md +53 -0
  62. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.md +24 -0
  63. package/content/dev/skills/fluent-mystique-builder/components/fc.button.print.pick.md +61 -0
  64. package/content/dev/skills/fluent-mystique-builder/components/fc.buttons.add.reject.md +20 -0
  65. package/content/dev/skills/fluent-mystique-builder/components/fc.card.attribute.md +73 -0
  66. package/content/dev/skills/fluent-mystique-builder/components/fc.card.attributes.grid.md +40 -0
  67. package/content/dev/skills/fluent-mystique-builder/components/fc.card.image.md +37 -0
  68. package/content/dev/skills/fluent-mystique-builder/components/fc.card.map.point.md +24 -0
  69. package/content/dev/skills/fluent-mystique-builder/components/fc.card.multi.md +79 -0
  70. package/content/dev/skills/fluent-mystique-builder/components/fc.card.product.md +27 -0
  71. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.area.md +34 -0
  72. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.area.wrapper.feed.md +98 -0
  73. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.bar.md +52 -0
  74. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.bar.wrapper.source.md +104 -0
  75. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.gauge.md +28 -0
  76. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.gauge.wrapper.threshold.md +118 -0
  77. package/content/dev/skills/fluent-mystique-builder/components/fc.chart.line.md +32 -0
  78. package/content/dev/skills/fluent-mystique-builder/components/fc.conditional.md +62 -0
  79. package/content/dev/skills/fluent-mystique-builder/components/fc.dashboard.threshold.md +65 -0
  80. package/content/dev/skills/fluent-mystique-builder/components/fc.daterange.wrapper.forwarder.md +56 -0
  81. package/content/dev/skills/fluent-mystique-builder/components/fc.drawer.button.md +21 -0
  82. package/content/dev/skills/fluent-mystique-builder/components/fc.event.detail.md +20 -0
  83. package/content/dev/skills/fluent-mystique-builder/components/fc.events.search.md +21 -0
  84. package/content/dev/skills/fluent-mystique-builder/components/fc.field.daterange.md +83 -0
  85. package/content/dev/skills/fluent-mystique-builder/components/fc.field.filterComplex.md +106 -0
  86. package/content/dev/skills/fluent-mystique-builder/components/fc.field.intrange.md +82 -0
  87. package/content/dev/skills/fluent-mystique-builder/components/fc.field.multistring.md +50 -0
  88. package/content/dev/skills/fluent-mystique-builder/components/fc.filterPanel.md +53 -0
  89. package/content/dev/skills/fluent-mystique-builder/components/fc.json.editor.md +22 -0
  90. package/content/dev/skills/fluent-mystique-builder/components/fc.json.viewer.md +21 -0
  91. package/content/dev/skills/fluent-mystique-builder/components/fc.list.customAction.md +79 -0
  92. package/content/dev/skills/fluent-mystique-builder/components/fc.list.md +116 -0
  93. package/content/dev/skills/fluent-mystique-builder/components/fc.list.wrapper.bppmetrics.md +69 -0
  94. package/content/dev/skills/fluent-mystique-builder/components/fc.list.wrapper.feed.md +65 -0
  95. package/content/dev/skills/fluent-mystique-builder/components/fc.list.wrapper.source.md +64 -0
  96. package/content/dev/skills/fluent-mystique-builder/components/fc.modal.button.addItem.md +60 -0
  97. package/content/dev/skills/fluent-mystique-builder/components/fc.modal.button.md +21 -0
  98. package/content/dev/skills/fluent-mystique-builder/components/fc.mutation.inline.md +88 -0
  99. package/content/dev/skills/fluent-mystique-builder/components/fc.mystique.collapsible.attributes.md +83 -0
  100. package/content/dev/skills/fluent-mystique-builder/components/fc.mystique.collapsible.text.md +33 -0
  101. package/content/dev/skills/fluent-mystique-builder/components/fc.mystique.link.md +30 -0
  102. package/content/dev/skills/fluent-mystique-builder/components/fc.order.itemDetails.md +20 -0
  103. package/content/dev/skills/fluent-mystique-builder/components/fc.order.shipmentDetails.md +20 -0
  104. package/content/dev/skills/fluent-mystique-builder/components/fc.page.filter.select.md +87 -0
  105. package/content/dev/skills/fluent-mystique-builder/components/fc.page.md +64 -0
  106. package/content/dev/skills/fluent-mystique-builder/components/fc.page.refresh.md +48 -0
  107. package/content/dev/skills/fluent-mystique-builder/components/fc.page.section.column.md +71 -0
  108. package/content/dev/skills/fluent-mystique-builder/components/fc.page.section.header.md +61 -0
  109. package/content/dev/skills/fluent-mystique-builder/components/fc.page.section.md +59 -0
  110. package/content/dev/skills/fluent-mystique-builder/components/fc.page.wizard.md +45 -0
  111. package/content/dev/skills/fluent-mystique-builder/components/fc.page.wizard.summary.md +56 -0
  112. package/content/dev/skills/fluent-mystique-builder/components/fc.progress.circular.md +20 -0
  113. package/content/dev/skills/fluent-mystique-builder/components/fc.provider.graphql.md +71 -0
  114. package/content/dev/skills/fluent-mystique-builder/components/fc.quantity.list.md +87 -0
  115. package/content/dev/skills/fluent-mystique-builder/components/fc.repeater.md +56 -0
  116. package/content/dev/skills/fluent-mystique-builder/components/fc.reports.ipuipc.md +54 -0
  117. package/content/dev/skills/fluent-mystique-builder/components/fc.return.rowExpansion.md +19 -0
  118. package/content/dev/skills/fluent-mystique-builder/components/fc.scanner.barcode.md +21 -0
  119. package/content/dev/skills/fluent-mystique-builder/components/fc.scanner.barcodeFilter.md +72 -0
  120. package/content/dev/skills/fluent-mystique-builder/components/fc.scanner.camera.md +20 -0
  121. package/content/dev/skills/fluent-mystique-builder/components/fc.settingForm.md +64 -0
  122. package/content/dev/skills/fluent-mystique-builder/components/fc.sourcing.profile.drawer.button.md +19 -0
  123. package/content/dev/skills/fluent-mystique-builder/components/fc.sourcing.profile.modal.button.md +64 -0
  124. package/content/dev/skills/fluent-mystique-builder/components/fc.sourcing.strategy.modal.button.md +20 -0
  125. package/content/dev/skills/fluent-mystique-builder/components/fc.stepper.md +20 -0
  126. package/content/dev/skills/fluent-mystique-builder/components/fc.tab.content.md +56 -0
  127. package/content/dev/skills/fluent-mystique-builder/components/fc.tabs.card.md +64 -0
  128. package/content/dev/skills/fluent-mystique-builder/components/fc.tabs.md +69 -0
  129. package/content/dev/skills/fluent-mystique-builder/components/fc.tile.metric.md +73 -0
  130. package/content/dev/skills/fluent-mystique-builder/components/fc.workflow.provider.md +77 -0
  131. package/content/dev/skills/fluent-mystique-builder/validate-docs.ps1 +260 -0
  132. package/content/dev/skills/fluent-mystique-scaffold/SKILL.md +1830 -0
  133. package/content/dev/skills/fluent-mystique-validate/SKILL.md +646 -0
  134. package/content/dev/skills/fluent-pre-deploy-check/SKILL.md +1144 -1108
  135. package/content/dev/skills/fluent-retailer-config/SKILL.md +1162 -1111
  136. package/content/dev/skills/fluent-rollback/SKILL.md +387 -0
  137. package/content/dev/skills/fluent-rule-scaffold/SKILL.md +515 -385
  138. package/content/dev/skills/fluent-scope-decompose/SKILL.md +1123 -1021
  139. package/content/dev/skills/fluent-session-audit-export/SKILL.md +880 -632
  140. package/content/dev/skills/fluent-session-summary/SKILL.md +320 -195
  141. package/content/dev/skills/fluent-settings/SKILL.md +160 -1
  142. package/content/dev/skills/fluent-source-onboard/SKILL.md +31 -3
  143. package/content/dev/skills/fluent-sourcing/SKILL.md +1185 -0
  144. package/content/dev/skills/fluent-system-monitoring/SKILL.md +771 -767
  145. package/content/dev/skills/fluent-test-data/SKILL.md +514 -513
  146. package/content/dev/skills/fluent-trace/SKILL.md +1169 -1143
  147. package/content/dev/skills/fluent-transition-api/SKILL.md +364 -346
  148. package/content/dev/skills/fluent-use-case-discover/SKILL.md +593 -0
  149. package/content/dev/skills/fluent-use-case-discover/SPEC_TEMPLATE.md +281 -0
  150. package/content/dev/skills/fluent-version-manage/SKILL.md +53 -2
  151. package/content/dev/skills/fluent-workflow-analyzer/SKILL.md +995 -959
  152. package/content/dev/skills/fluent-workflow-builder/SKILL.md +668 -319
  153. package/content/dev/skills/fluent-workflow-deploy/SKILL.md +480 -267
  154. package/content/dev/skills/fluent-workspace-tree/SKILL.md +281 -0
  155. package/content/mcp-extn/agents/fluent-mcp.md +133 -69
  156. package/content/mcp-extn/skills/fluent-mcp-tools/SKILL.md +812 -461
  157. package/content/mcp-official/agents/fluent-mcp-core.md +91 -91
  158. package/content/mcp-official/skills/fluent-mcp-core/SKILL.md +94 -94
  159. package/content/rfl/skills/fluent-rfl-assess/SKILL.md +172 -172
  160. package/docs/CAPABILITY_MAP.md +106 -77
  161. package/docs/DEPLOYMENT_PROMOTION_RUNBOOK.md +218 -0
  162. package/docs/DESIGN-implementation-map.md +698 -0
  163. package/docs/DEV_WORKFLOW.md +814 -802
  164. package/docs/FLOW_RUN.md +142 -142
  165. package/docs/GETTING_STARTED.md +427 -0
  166. package/docs/USE_CASES.md +909 -52
  167. package/metadata.json +184 -156
  168. package/package.json +3 -2
@@ -1,461 +1,812 @@
1
- ---
2
- name: fluent-mcp-tools
3
- description: Fluent Commerce MCP tools reference. Use when working with the Fluent MCP extension server for event dispatch, event flow forensics, GraphQL operations, batch ingestion, or webhook validation. Triggers on "mcp tools", "send fluent event", "event flow inspect", "trace event payloads", "fluent graphql", "batch ingestion".
4
- user-invocable: true
5
- allowed-tools: Bash, Read, Write, Edit, Glob, Grep
6
- argument-hint: <operation> [entity-type] [entity-ref]
7
- ---
8
-
9
- # Fluent MCP Tools
10
-
11
- Quick reference for Fluent Commerce MCP extension server tools.
12
-
13
- ## When to Use
14
-
15
- - Sending events to Fluent Commerce (order lifecycle, fulfilment transitions)
16
- - Retrieving UI/user-action transitions from workflow trigger contexts
17
- - Running GraphQL queries or mutations
18
- - Bulk data operations via batch ingestion
19
- - Validating inbound webhook payloads
20
-
21
- This skill is the canonical MCP tool contract reference. Other skills should link here for payload syntax and limits instead of redefining tool schemas.
22
-
23
- ## Event API Semantics
24
-
25
- For event data model, types, categories, statuses, execution model, event contracts, and query patterns — see `/fluent-event-api`. This skill focuses on MCP tool syntax and payload contracts only.
26
-
27
- ## Event Operations
28
-
29
- ### Recommended Flow
30
-
31
- 1. `config.validate` - Verify connection
32
- 2. `event.build` - Preview payload
33
- 3. `event.send` (dryRun: true) - Validate without sending
34
- 4. `event.send` (dryRun: false) - Actually send
35
- 5. `event.list` / `event.get` - Verify delivery
36
- 6. `event.flowInspect` - One-call runtime forensics for root entity
37
-
38
- ### Common Events
39
-
40
- | Event | Entity Type | Description |
41
- |-------|-------------|-------------|
42
- | `ConfirmValidation` | ORDER | Confirm order passed validation |
43
- | `ConfirmAllocation` | FULFILMENT | Confirm stock allocation |
44
- | `CreateInvoice` | FULFILMENT | Invoice created |
45
- | `ConfirmPick` | FULFILMENT | Items picked (attrs: pickedAt, pickedItems) |
46
- | `ConfirmShipment` | FULFILMENT | Shipment dispatched (attrs: trackingNumber, carrierRef) |
47
- | `ConfirmDelivery` | FULFILMENT | Delivery completed (attrs: deliveredAt) |
48
- | `CancelOrder` | ORDER | Cancel an order |
49
-
50
- ### Runtime Forensics (`event.flowInspect`)
51
-
52
- Use `event.flowInspect` when you need the full runtime evidence bundle in one call for any entity type.
53
-
54
- > **MANDATORY: Always use compact mode first.** Call with default parameters (no `compact: false`). The ~2-3k token compact summary is sufficient for 90% of use cases. Only add targeted detail flags (`includeRuleDetails`, `includeCustomLogs`, `includeSnapshots`, `includeCrossEntity`) one at a time when compact findings reveal specific issues. Setting `compact: false` returns ~24-30k tokens and WILL fill context — use only as a last resort after identifying exactly what raw data you need.
55
-
56
- **Compact mode (default `compact: true`):** Returns a pre-analyzed summary (~2-3k tokens) with an `analysis` section containing anomaly findings, status flow, failed webhook endpoints, and slowest rulesets. Audit arrays are stripped to essentials.
57
-
58
- Collects ORCHESTRATION events (plus ORCHESTRATION_AUDIT when `includeAudit=true`, and SCHEDULED when `includeScheduled=true`) for a root entity, then extracts:
59
-
60
- **Always included (both modes):**
61
- - **Orchestration timeline** status/entity type counts, top event names
62
- - **Auto-recommendations** contextual findings based on status counts, webhook failures, exceptions
63
- - **Totals** raw event counts for all categories
64
-
65
- **Compact mode additions (`compact: true`):**
66
- - `analysis.statusFlow` — ordered unique statuses seen (e.g., `["CREATED", "BOOKED", "SHIPPED"]`)
67
- - `analysis.findings[]` anomaly detection: NO_MATCH (CRITICAL), FAILED (HIGH), webhook errors (HIGH), exceptions (HIGH), PENDING (MEDIUM), slow rulesets (MEDIUM)
68
- - `analysis.failedWebhookEndpoints` — URLs that returned >= 400
69
- - `analysis.slowestRulesets` top 3 slowest
70
- - `analysis.timespan` first/last event timestamps with durationMs
71
- - `audit.webhookActions` **only failures** (responseCode >= 400)
72
- - `audit.mutationActions` **top 5 by queryName** (name + count only, no payloads)
73
- - `audit.sendEventActions` count + scheduledCount only
74
- - `diagnostics.inspectedEvents` summary (id, name, status, closeMatchCount)
75
-
76
- **Full mode additions (`compact: false`):**
77
- - **Mutation payloads** — full GraphQL mutations with `input`, `response`, `durationMs`
78
- - **Webhook diagnostics** — all webhooks with `Request Endpoint`, `Response code`, `Response Body`
79
- - **Scheduled dispatches** future-dated SendEvent evidence with full event payload
80
- - **Ruleset durations** — all rulesets ranked by processing time
81
- - **Cross-entity events**full events array per child entity type
82
-
83
- **Default-on flags:**
84
- - `compact: true` — pre-analyzed summary response
85
- - `includeAudit: true` parse ORCHESTRATION_AUDIT action evidence
86
- - `includeExceptions: true` — rule exceptions with class, message, ruleset context
87
- - `includeNoMatchDetails: true` — enhanced NO_MATCH diagnostics from ruleSet audit events
88
- - `includeEventDetails: true`compact orchestration events in response (full mode only)
89
- - `includeScheduled: true` separate SCHEDULED event fetch
90
-
91
- **Opt-in flags (default false):**
92
- - `includeRuleDetails: true` — per-rule execution trace (full mode only)
93
- - `includeCustomLogs: true` — custom plugin log messages (full mode only)
94
- - `includeSnapshots: true` — entity state snapshots (full mode only)
95
- - `includeCrossEntity: true` — fetches child entity events
96
-
97
- **Drilldown control:**
98
- - `inspectStatuses: ["NO_MATCH", "PENDING", "FAILED"]` — auto-fetches `event.get` for these statuses
99
- - `maxDrilldowns: 50` — cap on individual event.get calls
100
- - `actionSampleLimit: 100` — max rows per extraction section
101
-
102
- **Response sections (compact mode):**
103
-
104
- | Section | Key Fields | Condition |
105
- |---------|------------|-----------|
106
- | `totals` | orchestrationCount, auditCount, all category counts | Always |
107
- | `analysis` | statusFlow, entityTypes, timespan, failedWebhookEndpoints, slowestRulesets, findings[] | Always (compact only) |
108
- | `orchestration` | statusCounts, entityTypeCounts, topNames (top 10) | Always |
109
- | `audit.webhookActions` | Only failures (responseCode >= 400) | When includeAudit and failures exist |
110
- | `audit.mutationActions` | Top 5 queryName + count | When includeAudit and mutations exist |
111
- | `audit.sendEventActions` | { count, scheduledCount } | When includeAudit |
112
- | `audit.exceptions` | id, ruleset, rule, exceptionClass, message | When includeExceptions |
113
- | `diagnostics.inspectedEvents` | eventId, name, eventStatus, closeMatchCount | When inspectStatuses has entries |
114
-
115
- **Response sections (full mode, compact: false):**
116
-
117
- | Section | Key Fields | Condition |
118
- |---------|------------|-----------|
119
- | `totals` | orchestrationCount, auditCount, all category counts | Always |
120
- | `orchestration` | statusCounts, entityTypeCounts, topNames (top 30), events? | Always |
121
- | `scheduled` | SCHEDULED events with compact view | When includeScheduled and events exist |
122
- | `audit.mutationActions` | queryName, queryType, input, response, durationMs | When includeAudit |
123
- | `audit.webhookActions` | endpoint, responseCode, responseBody | When includeAudit |
124
- | `audit.sendEventActions` | eventName, futureDated, scheduledOn, event payload | When includeAudit |
125
- | `audit.rulesetDurations` | name, durationMs (sorted slowest first) | When includeAudit |
126
- | `audit.exceptions` | id, ruleset, rule, exceptionClass, message | When includeExceptions |
127
- | `audit.snapshots` | status, items, attributes, customer, toAddress, deliveryType | When includeSnapshots |
128
- | `audit.customLogs` | source, logs[] (from LogCollection) | When includeCustomLogs |
129
- | `audit.ruleEvents` | name, ruleSet, props, durationMs | When includeRuleDetails |
130
- | `diagnostics.inspectedEvents` | closeMatches, entityStatus, message, full event | When inspectStatuses has entries |
131
- | `diagnostics.noMatchAuditDetails` | rulesetName, entityStatus, message, closeMatches | When includeNoMatchDetails |
132
- | `crossEntity` | entityType, orchestrationCount, statusCounts, events | When includeCrossEntity |
133
-
134
- Example (compact the default, recommended first call):
135
-
136
- ```json
137
- {
138
- "rootEntityRef": "E2E_MULTI_202602221343",
139
- "rootEntityType": "ORDER"
140
- }
141
- ```
142
-
143
- Example (entity-agnostic by ref only):
144
-
145
- ```json
146
- {
147
- "rootEntityRef": "STORE-001",
148
- "includeScheduled": false
149
- }
150
- ```
151
-
152
- Example (deep analysis with all sections):
153
-
154
- ```json
155
- {
156
- "rootEntityRef": "ORD-001",
157
- "rootEntityType": "ORDER",
158
- "includeRuleDetails": true,
159
- "includeCustomLogs": true,
160
- "includeSnapshots": true,
161
- "includeCrossEntity": true
162
- }
163
- ```
164
-
165
- Example (lightweight — minimal output):
166
-
167
- ```json
168
- {
169
- "rootEntityRef": "ORD-001",
170
- "rootEntityType": "ORDER",
171
- "includeEventDetails": false,
172
- "includeScheduled": false,
173
- "includeExceptions": false,
174
- "includeNoMatchDetails": false,
175
- "maxDrilldowns": 0
176
- }
177
- ```
178
-
179
- ## GraphQL Operations
180
-
181
- ### Single Query
182
- Use `graphql.query` for one-off queries with manual pagination.
183
-
184
- ### Auto-Paginated Query
185
- Use `graphql.queryAll` when you need ALL records. Automatically follows cursors.
186
-
187
- ### Batch Mutations
188
- Use `graphql.batchMutate` for bulk updates (up to 50 mutations per request).
189
-
190
- ### Schema Discovery
191
- Use `graphql.introspect` to discover mutations, input types, and field requirements:
192
- - `listMutations: true` - Get all mutation names
193
- - `mutation: 'updateOrder'` - Inspect specific mutation
194
- - `type: 'UpdateOrderInput'` - See input type fields
195
-
196
- ## Batch Ingestion
197
-
198
- ### Flow
199
- 1. `batch.create` - Create job (name, entityType, action)
200
- 2. `batch.send` - Send records (jobId, payload)
201
- 3. `batch.status` - Poll until terminal state
202
- 4. `batch.results` - Get per-record outcomes
203
-
204
- ## Event Analytics
205
-
206
- ### Metrics Tools (Planned -- Not Yet Implemented)
207
-
208
- > The following tools are planned for a future release. They are documented here for reference but are not currently available in the MCP extension server.
209
-
210
- #### Health Check (Single Call)
211
-
212
- Use `metrics.healthCheck` for a one-call health assessment. Runs multiple Prometheus queries locally, applies anomaly thresholds, and returns findings + recommendations. Falls back to Event API if Prometheus is unavailable.
213
-
214
- ```json
215
- { "window": "1h", "includeTopEvents": true }
216
- ```
217
-
218
- For custom PromQL queries, use `metrics.query`. For pre-aggregated Event API rankings, use `metrics.topEvents`.
219
-
220
- #### SLO Report (Managed Services)
221
-
222
- Use `metrics.sloReport` when you need an operational KPI snapshot in one call:
223
- - failure/no-match/pending rates
224
- - p95 runtime + p95 inflight latency
225
- - threshold findings + recommendations
226
- - optional top failing events
227
-
228
- ```json
229
- {
230
- "window": "1h",
231
- "includeTopFailingEvents": true,
232
- "topN": 10
233
- }
234
- ```
235
-
236
- `metrics.sloReport` is preferred for release checks and incident triage handoffs where you need explicit SLI fields, not just raw PromQL output.
237
-
238
- #### Label Discovery (Metric -> Labels)
239
-
240
- Use `metrics.labelCatalog` before writing grouped PromQL to discover valid labels for a metric:
241
- - samples live series via `last_over_time(metric[window])`
242
- - extracts label keys + cardinality + sample values
243
- - merges known Fluent label hints for common metrics
244
-
245
- ```json
246
- {
247
- "metric": "core_event_received_total",
248
- "window": "1h",
249
- "maxValuesPerLabel": 10
250
- }
251
- ```
252
-
253
- Recommended workflow:
254
- 1. `metrics.labelCatalog` (discover labels)
255
- 2. `metrics.query` (write correct `sum by (...)` / `histogram_quantile(...)`)
256
- 3. `metrics.sloReport` (operational KPI snapshot)
257
-
258
- #### Prometheus Metrics
259
- Use `metrics.query` to execute PromQL queries via the Fluent GraphQL `metricInstant` / `metricRange` proxy:
260
- - **Instant**: Evaluate at a single point in time — `{ query: "sum(rubix_event_runtime_seconds_count)", type: "instant" }`
261
- - **Range**: Evaluate over a time window — `{ query: "...", type: "range", start: "ISO", end: "ISO", step: "1h" }`
262
-
263
- The MCP tool routes PromQL through the GraphQL API (not raw Prometheus REST endpoints, which are not exposed by the platform). The `time`, `start`, and `end` parameters accept ISO-8601 timestamps (mapped to GraphQL `DateTime` type).
264
-
265
- Access is permission-gated. If metrics calls fail for auth/authorization, verify the user/token has `METRICS_VIEW`.
266
-
267
- #### Counter Delta Pattern (`last_over_time`)
268
-
269
- For accurate daily/hourly counter deltas over wider windows, use:
270
-
271
- ```promql
272
- (last_over_time(metric[window]) - metric offset <period>)
273
- or
274
- last_over_time(metric[window])
275
- ```
276
-
277
- Use this when offset samples can be missing (scrape gaps, resets). For short-window trend estimates, `increase()`/`rate()` is usually sufficient.
278
-
279
- #### Label Hygiene (Critical)
280
-
281
- Do not assume labels are shared across all metrics. Common mappings:
282
-
283
- | Metric | Key Labels |
284
- |---|---|
285
- | `core_event_received_total` | `account_id`, `retailer_id`, `event_name`, `entity_type`, `source` |
286
- | `rubix_event_runtime_seconds_count` | `account_id`, `retailer_id`, `event_name`, `entity_type`, `source`, `status` |
287
- | `rubix_event_inflight_latency_seconds_count` | `account_id`, `retailer_id`, `event_name`, `entity_type`, `source` |
288
- | `rubix_event_runtime_seconds_bucket` | `account_id`, `retailer_id`, `event_name`, `entity_type`, `source`, `status`, `le` |
289
-
290
- Example pitfall: `status` is **not** a label on `core_event_received_total`; including it in `sum by (...)` will produce misleading/null label outputs.
291
-
292
- #### Event Volume Analytics
293
- Use `metrics.topEvents` for aggregate event analytics within a time window:
294
- - Paginates through `event.list` results, groups by (name + entityType + status)
295
- - Returns top-N rankings, failure rates, and status breakdown
296
- - Supports `eventStatus` filter for server-side pre-filtering (e.g., `"FAILED"`, `"NO_MATCH"`)
297
- - Example: `{ from: "2026-02-22T07:00:00Z", topN: 20 }`
298
- - Example (failures only): `{ from: "2026-02-22T07:00:00Z", eventStatus: "FAILED", topN: 10 }`
299
-
300
- For event model/filter semantics → `/fluent-event-api`.
301
- For diagnostic decision trees → `/fluent-trace`.
302
-
303
- ### Event Analysis via Filters
304
- Use `event.list` with targeted filters (`eventStatus`, `category`, `eventType`, `from`/`to`) to find patterns. Combine with `graphql.query` to correlate entity state with event history.
305
-
306
- ### Status/Category Alias Normalization
307
-
308
- When translating user input into `event.list` filters, normalize common aliases:
309
-
310
- | User/doc term | Canonical filter value |
311
- |---|---|
312
- | `ERROR` | `FAILED` |
313
- | `PROCESSING` | `PENDING` (or `SCHEDULED` depending on lifecycle stage) |
314
- | `ORDER_WORKFLOW` | `ORDER WORKFLOW` |
315
-
316
- Prefer canonical values in requests; keep aliases only for interpretation.
317
-
318
- ## JOB/BATCH Entities vs Batch Ingestion
319
-
320
- The MCP `batch.*` tools and JOB/BATCH workflow entities are **different concepts** that share terminology:
321
-
322
- | Concept | What It Is | MCP Tools | Event API |
323
- |---------|-----------|-----------|-----------|
324
- | **Batch Ingestion** | Data loading mechanism (bulk create/update entities) | `batch.create`, `batch.send`, `batch.status`, `batch.results` | Not event-driven; uses dedicated ingestion API |
325
- | **JOB/BATCH Entities** | Workflow-driven processing entities (orchestrated execution) | Query via `graphql.query`, trace via `event.list` | `entityType=JOB` or `entityType=BATCH`; linked by `rootEntityType=JOB` |
326
-
327
- ### Diagnosing JOB/BATCH Workflow Issues
328
-
329
- JOB and BATCH are orchestratable entities with their own workflows. To trace them:
330
-
331
- ```
332
- event.list({ "context.entityType": "JOB", "context.entityRef": "<JOB_REF>", "count": 100 })
333
- event.list({ "context.entityType": "BATCH", "context.rootEntityRef": "<JOB_REF>", "count": 100 })
334
- ```
335
-
336
- BATCH entities link to their parent JOB via `rootEntityType=JOB` / `rootEntityRef`. The `BATCH_COMPLETE` event signals batch processing completion.
337
-
338
- For event model semantics and query patterns → `/fluent-event-api`.
339
- For diagnostic decision trees `/fluent-trace`.
340
-
341
- ## Orchestration
342
-
343
- ### Rule Registry
344
-
345
- Use `plugin.list` to fetch all registered orchestration rules (standard + custom) with metadata from `GET /orchestration/rest/v1/plugin`. Returns rule name, description, accepted entity types, produced events, and parameters.
346
-
347
- - List all rules: `{}` (no params)
348
- - Filter by name: `{ "name": "SendEvent" }` (case-insensitive substring match)
349
-
350
- ### Workflow Transitions
351
-
352
- Use `workflow.transitions` to discover available user actions at any entity state
353
- (backed by `POST /api/v4.1/transition`).
354
-
355
- **When to use:**
356
- - Discover what events can be fired at a given status without reading workflow JSON
357
- - Build dynamic E2E test sequences that adapt to workflow changes
358
- - Validate that expected user actions exist after deployment
359
- - Get required attributes for each action (avoids missing-attribute errors on `event.send`)
360
-
361
- **Example — ORDER at a specific status:**
362
-
363
- ```json
364
- {
365
- "triggers": [
366
- {
367
- "type": "ORDER",
368
- "subtype": "HD",
369
- "status": "CREATED",
370
- "retailerId": "5",
371
- "flexType": "ORDER::HD"
372
- }
373
- ]
374
- }
375
- ```
376
-
377
- **Example — Module-scoped trigger:**
378
-
379
- ```json
380
- {
381
- "triggers": [
382
- {
383
- "type": "MANIFEST",
384
- "subtype": "DEFAULT",
385
- "status": "PENDING",
386
- "module": "servicepoint",
387
- "flexType": "CARRIER::DEFAULT",
388
- "retailerId": "2"
389
- }
390
- ]
391
- }
392
- ```
393
-
394
- **Integration with event.send:** The `eventName` from each `userAction` maps directly to
395
- `event.send`'s `name` parameter. The `attributes[]` tell you what to include in `event.send`'s
396
- `attributes` parameter.
397
-
398
- Notes:
399
- - `retailerId` is required per trigger (falls back to `FLUENT_RETAILER_ID`)
400
- - `module`, `flexType`, `status` are optional filters
401
- - Response includes `userActions` with `eventName`, `context`, and `attributes`
402
-
403
- ### Workflow Analysis Flow
404
-
405
- For end-to-end workflow understanding:
406
- 1. Download workflow JSON (via Fluent CLI or `workflow_download`)
407
- 2. `plugin.list` — look up rules referenced in rulesets to understand what each does
408
- 3. `workflow.transitions` — query user actions for each entity state to see what UI buttons appear
409
-
410
- ## Response Optimization
411
-
412
- High-volume tools support response shaping to reduce token consumption:
413
-
414
- ### event.list — Field Projection
415
-
416
- Pass `fields` (array of strings) to return only selected fields per event. Reduces token usage by 7-8x for typical queries.
417
-
418
- ```json
419
- {
420
- "context.entityRef": "ORDER_REF",
421
- "context.entityType": "ORDER",
422
- "count": 50,
423
- "fields": ["id", "name", "eventStatus", "category", "generatedOn", "context.entityRef", "context.entityType"]
424
- }
425
- ```
426
-
427
- Common field sets by use case:
428
- - **Trace/debug:** `["id", "name", "eventStatus", "category", "context.entityRef", "context.entityType", "generatedOn", "source", "context.sourceEvents"]`
429
- - **E2E status check:** `["id", "name", "eventStatus", "context.entityRef"]`
430
- - **Exception analysis:** `["id", "name", "eventStatus", "category", "attributes", "context.entityRef", "generatedOn"]`
431
-
432
- Omit `fields` for full event data (when you need attributes, source, timing, etc.).
433
-
434
- ### plugin.list Compact Mode
435
-
436
- Pass `compact: true` to return only `ruleInfo` (name, description, entity types) per rule, stripping `parameters` and `eventAttributes`. Reduces token usage by 40-60x for unfiltered queries.
437
-
438
- ```json
439
- { "compact": true }
440
- { "name": "SendEvent", "compact": true }
441
- ```
442
-
443
- Use full mode (default) when you need rule parameters or event attribute contracts.
444
-
445
- ## Pagination Pattern
446
-
447
- Fluent uses Relay-style connections. Cursors live on each **edge**, not on pageInfo:
448
-
449
- ```graphql
450
- {
451
- orders(first: 50, after: $cursor) {
452
- edges {
453
- cursor
454
- node { id ref status }
455
- }
456
- pageInfo { hasNextPage }
457
- }
458
- }
459
- ```
460
-
461
- Take cursor from the LAST edge, pass as `after` in next call.
1
+ ---
2
+ name: fluent-mcp-tools
3
+ description: Fluent Commerce MCP tools reference. Use when working with the Fluent MCP extension server for event dispatch, event flow forensics, GraphQL operations, batch ingestion, or webhook validation. Triggers on "mcp tools", "send fluent event", "event flow inspect", "trace event payloads", "fluent graphql", "batch ingestion".
4
+ user-invocable: true
5
+ allowed-tools: Bash, Read, Write, Edit, Glob, Grep
6
+ argument-hint: <operation> [entity-type] [entity-ref]
7
+ ---
8
+
9
+ # Fluent MCP Tools
10
+
11
+ Quick reference for Fluent Commerce MCP extension server tools.
12
+
13
+ ## When to Use
14
+
15
+ - Sending events to Fluent Commerce (order lifecycle, fulfilment transitions)
16
+ - Retrieving UI/user-action transitions from workflow trigger contexts
17
+ - Running GraphQL queries or mutations
18
+ - Bulk data operations via batch ingestion
19
+ - Validating inbound webhook payloads
20
+ - Creating, updating, and retrieving entities (Order, Fulfilment, Location, etc.)
21
+ - Deploying, diffing, and simulating workflows
22
+ - Managing settings (upsert, bulk upsert)
23
+ - Discovering and validating environment configuration
24
+ - Asserting entity state in E2E test sequences
25
+ - Monitoring event processing health via Prometheus metrics
26
+
27
+ This skill is the canonical MCP tool contract reference. Other skills should link here for payload syntax and limits instead of redefining tool schemas.
28
+
29
+ **Tool count: 36** — Diagnostics (3), Events (5), GraphQL (4), Batch (5), Orchestration (2), Metrics (5), Entity (3), Workflow (3), Settings (2), Environment (2), Test (1), Webhook (1).
30
+
31
+ ## Diagnostics
32
+
33
+ ### `config.validate`
34
+
35
+ No parameters. Validates auth/base URL/retailer configuration and reports readiness for API tools. Run this first.
36
+
37
+ ### `health.ping`
38
+
39
+ No parameters. Quick diagnostics: confirms SDK adapter connection and config readiness when calls fail.
40
+
41
+ ### `connection.test`
42
+
43
+ No parameters. Comprehensive connectivity test authenticates, executes a `me` query, and returns:
44
+ - **User:** id, username, email, type, status, roles, permissions
45
+ - **Retailer:** id, ref, tradingName, primaryEmail
46
+ - **Location:** id, ref, name, type
47
+
48
+ More thorough than `health.ping` verifies the GraphQL endpoint end-to-end. Use when first connecting, debugging auth issues, or verifying retailer/location context.
49
+
50
+ ## Event API Semantics
51
+
52
+ For event data model, types, categories, statuses, execution model, event contracts, and query patterns see `/fluent-event-api`. This skill focuses on MCP tool syntax and payload contracts only.
53
+
54
+ ## Event Operations
55
+
56
+ ### Recommended Flow
57
+
58
+ 1. `config.validate` - Verify connection
59
+ 2. `event.build` - Preview payload
60
+ 3. `event.send` (dryRun: true) - Validate without sending
61
+ 4. `event.send` (dryRun: false) - Actually send
62
+ 5. `event.list` / `event.get` - Verify delivery
63
+ 6. `event.flowInspect` - One-call runtime forensics for root entity
64
+
65
+ ### Common Events
66
+
67
+ | Event | Entity Type | Description |
68
+ |-------|-------------|-------------|
69
+ | `ConfirmValidation` | ORDER | Confirm order passed validation |
70
+ | `ConfirmAllocation` | FULFILMENT | Confirm stock allocation |
71
+ | `CreateInvoice` | FULFILMENT | Invoice created |
72
+ | `ConfirmPick` | FULFILMENT | Items picked (attrs: pickedAt, pickedItems) |
73
+ | `ConfirmShipment` | FULFILMENT | Shipment dispatched (attrs: trackingNumber, carrierRef) |
74
+ | `ConfirmDelivery` | FULFILMENT | Delivery completed (attrs: deliveredAt) |
75
+ | `CancelOrder` | ORDER | Cancel an order |
76
+
77
+ ### Runtime Forensics (`event.flowInspect`)
78
+
79
+ Use `event.flowInspect` when you need the full runtime evidence bundle in one call for any entity type.
80
+
81
+ > **MANDATORY: Always use compact mode first.** Call with default parameters (no `compact: false`). The ~2-3k token compact summary is sufficient for 90% of use cases. Only add targeted detail flags (`includeRuleDetails`, `includeCustomLogs`, `includeSnapshots`, `includeCrossEntity`) one at a time when compact findings reveal specific issues. Setting `compact: false` returns ~24-30k tokens and WILL fill context use only as a last resort after identifying exactly what raw data you need.
82
+
83
+ **Compact mode (default `compact: true`):** Returns a pre-analyzed summary (~2-3k tokens) with an `analysis` section containing anomaly findings, status flow, failed webhook endpoints, and slowest rulesets. Audit arrays are stripped to essentials.
84
+
85
+ Collects ORCHESTRATION events (plus ORCHESTRATION_AUDIT when `includeAudit=true`, and SCHEDULED when `includeScheduled=true`) for a root entity, then extracts:
86
+
87
+ **Always included (both modes):**
88
+ - **Orchestration timeline**status/entity type counts, top event names
89
+ - **Auto-recommendations**contextual findings based on status counts, webhook failures, exceptions
90
+ - **Totals** — raw event counts for all categories
91
+
92
+ **Compact mode additions (`compact: true`):**
93
+ - `analysis.statusFlow` — ordered unique statuses seen (e.g., `["CREATED", "BOOKED", "SHIPPED"]`)
94
+ - `analysis.findings[]` — anomaly detection: NO_MATCH (CRITICAL), FAILED (HIGH), webhook errors (HIGH), exceptions (HIGH), PENDING (MEDIUM), slow rulesets (MEDIUM)
95
+ - `analysis.failedWebhookEndpoints` — URLs that returned >= 400
96
+ - `analysis.slowestRulesets` — top 3 slowest
97
+ - `analysis.timespan` — first/last event timestamps with durationMs
98
+ - `audit.webhookActions` — **only failures** (responseCode >= 400)
99
+ - `audit.mutationActions` — **top 5 by queryName** (name + count only, no payloads)
100
+ - `audit.sendEventActions` — count + scheduledCount only
101
+ - `diagnostics.inspectedEvents` — summary (id, name, status, closeMatchCount)
102
+
103
+ **Full mode additions (`compact: false`):**
104
+ - **Mutation payloads** full GraphQL mutations with `input`, `response`, `durationMs`
105
+ - **Webhook diagnostics** — all webhooks with `Request Endpoint`, `Response code`, `Response Body`
106
+ - **Scheduled dispatches** future-dated SendEvent evidence with full event payload
107
+ - **Ruleset durations** all rulesets ranked by processing time
108
+ - **Cross-entity events** full events array per child entity type
109
+
110
+ **Default-on flags:**
111
+ - `compact: true` pre-analyzed summary response
112
+ - `includeAudit: true` parse ORCHESTRATION_AUDIT action evidence
113
+ - `includeExceptions: true` rule exceptions with class, message, ruleset context
114
+ - `includeNoMatchDetails: true` — enhanced NO_MATCH diagnostics from ruleSet audit events
115
+ - `includeEventDetails: true` — compact orchestration events in response (full mode only)
116
+ - `includeScheduled: true` — separate SCHEDULED event fetch
117
+
118
+ **Opt-in flags (default false):**
119
+ - `includeRuleDetails: true` per-rule execution trace (full mode only)
120
+ - `includeCustomLogs: true` custom plugin log messages (full mode only)
121
+ - `includeSnapshots: true` entity state snapshots (full mode only)
122
+ - `includeCrossEntity: true` fetches child entity events
123
+
124
+ **Drilldown control:**
125
+ - `inspectStatuses: ["NO_MATCH", "PENDING", "FAILED"]` auto-fetches `event.get` for these statuses
126
+ - `maxDrilldowns: 50` cap on individual event.get calls
127
+ - `actionSampleLimit: 100` max rows per extraction section
128
+
129
+ **Response sections (compact mode):**
130
+
131
+ | Section | Key Fields | Condition |
132
+ |---------|------------|-----------|
133
+ | `totals` | orchestrationCount, auditCount, all category counts | Always |
134
+ | `analysis` | statusFlow, entityTypes, timespan, failedWebhookEndpoints, slowestRulesets, findings[] | Always (compact only) |
135
+ | `orchestration` | statusCounts, entityTypeCounts, topNames (top 10) | Always |
136
+ | `audit.webhookActions` | Only failures (responseCode >= 400) | When includeAudit and failures exist |
137
+ | `audit.mutationActions` | Top 5 queryName + count | When includeAudit and mutations exist |
138
+ | `audit.sendEventActions` | { count, scheduledCount } | When includeAudit |
139
+ | `audit.exceptions` | id, ruleset, rule, exceptionClass, message | When includeExceptions |
140
+ | `diagnostics.inspectedEvents` | eventId, name, eventStatus, closeMatchCount | When inspectStatuses has entries |
141
+
142
+ **Response sections (full mode, compact: false):**
143
+
144
+ | Section | Key Fields | Condition |
145
+ |---------|------------|-----------|
146
+ | `totals` | orchestrationCount, auditCount, all category counts | Always |
147
+ | `orchestration` | statusCounts, entityTypeCounts, topNames (top 30), events? | Always |
148
+ | `scheduled` | SCHEDULED events with compact view | When includeScheduled and events exist |
149
+ | `audit.mutationActions` | queryName, queryType, input, response, durationMs | When includeAudit |
150
+ | `audit.webhookActions` | endpoint, responseCode, responseBody | When includeAudit |
151
+ | `audit.sendEventActions` | eventName, futureDated, scheduledOn, event payload | When includeAudit |
152
+ | `audit.rulesetDurations` | name, durationMs (sorted slowest first) | When includeAudit |
153
+ | `audit.exceptions` | id, ruleset, rule, exceptionClass, message | When includeExceptions |
154
+ | `audit.snapshots` | status, items, attributes, customer, toAddress, deliveryType | When includeSnapshots |
155
+ | `audit.customLogs` | source, logs[] (from LogCollection) | When includeCustomLogs |
156
+ | `audit.ruleEvents` | name, ruleSet, props, durationMs | When includeRuleDetails |
157
+ | `diagnostics.inspectedEvents` | closeMatches, entityStatus, message, full event | When inspectStatuses has entries |
158
+ | `diagnostics.noMatchAuditDetails` | rulesetName, entityStatus, message, closeMatches | When includeNoMatchDetails |
159
+ | `crossEntity` | entityType, orchestrationCount, statusCounts, events | When includeCrossEntity |
160
+
161
+ Example (compact — the default, recommended first call):
162
+
163
+ ```json
164
+ {
165
+ "rootEntityRef": "E2E_MULTI_202602221343",
166
+ "rootEntityType": "ORDER"
167
+ }
168
+ ```
169
+
170
+ Example (entity-agnostic by ref only):
171
+
172
+ ```json
173
+ {
174
+ "rootEntityRef": "STORE-001",
175
+ "includeScheduled": false
176
+ }
177
+ ```
178
+
179
+ Example (deep analysis with all sections):
180
+
181
+ ```json
182
+ {
183
+ "rootEntityRef": "ORD-001",
184
+ "rootEntityType": "ORDER",
185
+ "includeRuleDetails": true,
186
+ "includeCustomLogs": true,
187
+ "includeSnapshots": true,
188
+ "includeCrossEntity": true
189
+ }
190
+ ```
191
+
192
+ Example (lightweight minimal output):
193
+
194
+ ```json
195
+ {
196
+ "rootEntityRef": "ORD-001",
197
+ "rootEntityType": "ORDER",
198
+ "includeEventDetails": false,
199
+ "includeScheduled": false,
200
+ "includeExceptions": false,
201
+ "includeNoMatchDetails": false,
202
+ "maxDrilldowns": 0
203
+ }
204
+ ```
205
+
206
+ ## GraphQL Operations
207
+
208
+ ### Single Query
209
+ Use `graphql.query` for one-off queries with manual pagination.
210
+
211
+ ### Auto-Paginated Query
212
+ Use `graphql.queryAll` when you need ALL records. Automatically follows cursors.
213
+
214
+ ### Batch Mutations
215
+ Use `graphql.batchMutate` for bulk updates (up to 50 mutations per request).
216
+
217
+ ### Schema Discovery
218
+ Use `graphql.introspect` to discover mutations, input types, and field requirements:
219
+ - `listMutations: true` - Get all mutation names
220
+ - `mutation: 'updateOrder'` - Inspect specific mutation
221
+ - `type: 'UpdateOrderInput'` - See input type fields
222
+
223
+ ## Batch Ingestion
224
+
225
+ ### Flow
226
+ 1. `batch.create` - Create job (name, entityType, action)
227
+ 2. `batch.send` - Send records (jobId, payload)
228
+ 3. `batch.status` - Poll until terminal state
229
+ 4. `batch.batchStatus` - Check a specific batch inside a job (jobId + batchId). Use for troubleshooting partial failures within multi-batch jobs.
230
+ 5. `batch.results` - Get per-record outcomes
231
+
232
+ ## Event Analytics
233
+
234
+ ### Metrics Tools
235
+
236
+ #### Health Check (Single Call)
237
+
238
+ Use `metrics.healthCheck` for a one-call health assessment. Runs multiple Prometheus queries locally, applies anomaly thresholds, and returns findings + recommendations. Falls back to Event API if Prometheus is unavailable.
239
+
240
+ ```json
241
+ { "window": "1h", "includeTopEvents": true }
242
+ ```
243
+
244
+ For custom PromQL queries, use `metrics.query`. For pre-aggregated Event API rankings, use `metrics.topEvents`.
245
+
246
+ #### SLO Report (Managed Services)
247
+
248
+ Use `metrics.sloReport` when you need an operational KPI snapshot in one call:
249
+ - failure/no-match/pending rates
250
+ - p95 runtime + p95 inflight latency
251
+ - threshold findings + recommendations
252
+ - optional top failing events
253
+
254
+ ```json
255
+ {
256
+ "window": "1h",
257
+ "includeTopFailingEvents": true,
258
+ "topN": 10
259
+ }
260
+ ```
261
+
262
+ `metrics.sloReport` is preferred for release checks and incident triage handoffs where you need explicit SLI fields, not just raw PromQL output.
263
+
264
+ #### Label Discovery (Metric -> Labels)
265
+
266
+ Use `metrics.labelCatalog` before writing grouped PromQL to discover valid labels for a metric:
267
+ - samples live series via `last_over_time(metric[window])`
268
+ - extracts label keys + cardinality + sample values
269
+ - merges known Fluent label hints for common metrics
270
+
271
+ ```json
272
+ {
273
+ "metric": "core_event_received_total",
274
+ "window": "1h",
275
+ "maxValuesPerLabel": 10
276
+ }
277
+ ```
278
+
279
+ Recommended workflow:
280
+ 1. `metrics.labelCatalog` (discover labels)
281
+ 2. `metrics.query` (write correct `sum by (...)` / `histogram_quantile(...)`)
282
+ 3. `metrics.sloReport` (operational KPI snapshot)
283
+
284
+ #### Prometheus Metrics
285
+ Use `metrics.query` to execute PromQL queries via the Fluent GraphQL `metricInstant` / `metricRange` proxy:
286
+ - **Instant**: Evaluate at a single point in time — `{ query: "sum(rubix_event_runtime_seconds_count)", type: "instant" }`
287
+ - **Range**: Evaluate over a time window — `{ query: "...", type: "range", start: "ISO", end: "ISO", step: "1h" }`
288
+
289
+ The MCP tool routes PromQL through the GraphQL API (not raw Prometheus REST endpoints, which are not exposed by the platform). The `time`, `start`, and `end` parameters accept ISO-8601 timestamps (mapped to GraphQL `DateTime` type).
290
+
291
+ Access is permission-gated. If metrics calls fail for auth/authorization, verify the user/token has `METRICS_VIEW`.
292
+
293
+ #### Counter Delta Pattern (`last_over_time`)
294
+
295
+ For accurate daily/hourly counter deltas over wider windows, use:
296
+
297
+ ```promql
298
+ (last_over_time(metric[window]) - metric offset <period>)
299
+ or
300
+ last_over_time(metric[window])
301
+ ```
302
+
303
+ Use this when offset samples can be missing (scrape gaps, resets). For short-window trend estimates, `increase()`/`rate()` is usually sufficient.
304
+
305
+ #### Label Hygiene (Critical)
306
+
307
+ Do not assume labels are shared across all metrics. Common mappings:
308
+
309
+ | Metric | Key Labels |
310
+ |---|---|
311
+ | `core_event_received_total` | `account_id`, `retailer_id`, `event_name`, `entity_type`, `source` |
312
+ | `rubix_event_runtime_seconds_count` | `account_id`, `retailer_id`, `event_name`, `entity_type`, `source`, `status` |
313
+ | `rubix_event_inflight_latency_seconds_count` | `account_id`, `retailer_id`, `event_name`, `entity_type`, `source` |
314
+ | `rubix_event_runtime_seconds_bucket` | `account_id`, `retailer_id`, `event_name`, `entity_type`, `source`, `status`, `le` |
315
+
316
+ Example pitfall: `status` is **not** a label on `core_event_received_total`; including it in `sum by (...)` will produce misleading/null label outputs.
317
+
318
+ #### Event Volume Analytics
319
+ Use `metrics.topEvents` for aggregate event analytics within a time window:
320
+ - Paginates through `event.list` results, groups by (name + entityType + status)
321
+ - Returns top-N rankings, failure rates, and status breakdown
322
+ - Supports `eventStatus` filter for server-side pre-filtering (e.g., `"FAILED"`, `"NO_MATCH"`)
323
+ - Example: `{ from: "2026-02-22T07:00:00Z", topN: 20 }`
324
+ - Example (failures only): `{ from: "2026-02-22T07:00:00Z", eventStatus: "FAILED", topN: 10 }`
325
+
326
+ For event model/filter semantics → `/fluent-event-api`.
327
+ For diagnostic decision trees → `/fluent-trace`.
328
+
329
+ ### Event Analysis via Filters
330
+ Use `event.list` with targeted filters (`eventStatus`, `category`, `eventType`, `from`/`to`) to find patterns. Combine with `graphql.query` to correlate entity state with event history.
331
+
332
+ ### Status/Category Alias Normalization
333
+
334
+ When translating user input into `event.list` filters, normalize common aliases:
335
+
336
+ | User/doc term | Canonical filter value |
337
+ |---|---|
338
+ | `ERROR` | `FAILED` |
339
+ | `PROCESSING` | `PENDING` (or `SCHEDULED` depending on lifecycle stage) |
340
+ | `ORDER_WORKFLOW` | `ORDER WORKFLOW` |
341
+
342
+ Prefer canonical values in requests; keep aliases only for interpretation.
343
+
344
+ ## JOB/BATCH Entities vs Batch Ingestion
345
+
346
+ The MCP `batch.*` tools and JOB/BATCH workflow entities are **different concepts** that share terminology:
347
+
348
+ | Concept | What It Is | MCP Tools | Event API |
349
+ |---------|-----------|-----------|-----------|
350
+ | **Batch Ingestion** | Data loading mechanism (bulk create/update entities) | `batch.create`, `batch.send`, `batch.status`, `batch.results` | Not event-driven; uses dedicated ingestion API |
351
+ | **JOB/BATCH Entities** | Workflow-driven processing entities (orchestrated execution) | Query via `graphql.query`, trace via `event.list` | `entityType=JOB` or `entityType=BATCH`; linked by `rootEntityType=JOB` |
352
+
353
+ ### Diagnosing JOB/BATCH Workflow Issues
354
+
355
+ JOB and BATCH are orchestratable entities with their own workflows. To trace them:
356
+
357
+ ```
358
+ event.list({ "context.entityType": "JOB", "context.entityRef": "<JOB_REF>", "count": 100 })
359
+ event.list({ "context.entityType": "BATCH", "context.rootEntityRef": "<JOB_REF>", "count": 100 })
360
+ ```
361
+
362
+ BATCH entities link to their parent JOB via `rootEntityType=JOB` / `rootEntityRef`. The `BATCH_COMPLETE` event signals batch processing completion.
363
+
364
+ For event model semantics and query patterns → `/fluent-event-api`.
365
+ For diagnostic decision trees → `/fluent-trace`.
366
+
367
+ ## Orchestration
368
+
369
+ ### Rule Registry
370
+
371
+ Use `plugin.list` to fetch all registered orchestration rules (standard + custom) with metadata from `GET /orchestration/rest/v1/plugin`. Returns rule name, description, accepted entity types, produced events, and parameters.
372
+
373
+ - List all rules: `{}` (no params)
374
+ - Filter by name: `{ "name": "SendEvent" }` (case-insensitive substring match)
375
+
376
+ ### Workflow Transitions
377
+
378
+ Use `workflow.transitions` to discover available user actions at any entity state
379
+ (backed by `POST /api/v4.1/transition`).
380
+
381
+ **When to use:**
382
+ - Discover what events can be fired at a given status without reading workflow JSON
383
+ - Build dynamic E2E test sequences that adapt to workflow changes
384
+ - Validate that expected user actions exist after deployment
385
+ - Get required attributes for each action (avoids missing-attribute errors on `event.send`)
386
+
387
+ **Example — ORDER at a specific status:**
388
+
389
+ ```json
390
+ {
391
+ "triggers": [
392
+ {
393
+ "type": "ORDER",
394
+ "subtype": "HD",
395
+ "status": "CREATED",
396
+ "retailerId": "5",
397
+ "flexType": "ORDER::HD"
398
+ }
399
+ ]
400
+ }
401
+ ```
402
+
403
+ **Example Module-scoped trigger:**
404
+
405
+ ```json
406
+ {
407
+ "triggers": [
408
+ {
409
+ "type": "MANIFEST",
410
+ "subtype": "DEFAULT",
411
+ "status": "PENDING",
412
+ "module": "servicepoint",
413
+ "flexType": "CARRIER::DEFAULT",
414
+ "retailerId": "2"
415
+ }
416
+ ]
417
+ }
418
+ ```
419
+
420
+ **Integration with event.send:** The `eventName` from each `userAction` maps directly to
421
+ `event.send`'s `name` parameter. The `attributes[]` tell you what to include in `event.send`'s
422
+ `attributes` parameter.
423
+
424
+ Notes:
425
+ - `retailerId` is required per trigger (falls back to `FLUENT_RETAILER_ID`)
426
+ - `module`, `flexType`, `status` are optional filters
427
+ - Response includes `userActions` with `eventName`, `context`, and `attributes`
428
+
429
+ ### Strict User Action Contract (Anti-Hallucination)
430
+
431
+ Use these guardrails whenever interpreting `workflow.transitions`:
432
+ 1. Treat `userActions[].eventName` as the only valid event to send (never infer from labels).
433
+ 2. Treat `userActions[].attributes` as the runtime contract for payload shape (do not invent keys).
434
+ 3. If an expected action is missing, retry with `module: "all"` before concluding configuration is broken.
435
+ 4. If it appears under `module: "all"` but not under a target module, fix `context[].modules` and `fc.mystique.apps`.
436
+ 5. Validate trigger scope alignment: `type`, `subtype`, and `flexType` must match the workflow branch.
437
+ 6. Do not invent undocumented user-action schema fields; keep to `eventName`, `context`, `attributes`.
438
+
439
+ For canonical schema authoring and diagnostics, cross-check `/fluent-workflow-builder` and `/fluent-transition-api`.
440
+
441
+ ### Workflow Analysis Flow
442
+
443
+ For end-to-end workflow understanding:
444
+ 1. Download workflow JSON (via Fluent CLI or `workflow_download`)
445
+ 2. `plugin.list` — look up rules referenced in rulesets to understand what each does
446
+ 3. `workflow.transitions` — query user actions for each entity state to see what UI buttons appear
447
+
448
+ ## Agentic Operations
449
+
450
+ Tools for agent-driven workflows: type-safe entity CRUD, workflow deployment, settings management, environment introspection, and state assertions.
451
+
452
+ ### Entity Lifecycle
453
+
454
+ #### `entity.create`
455
+
456
+ Type-safe entity creation with built-in validation and gotcha knowledge.
457
+
458
+ | Parameter | Type | Required | Default | Description |
459
+ |-----------|------|----------|---------|-------------|
460
+ | `entityType` | string | yes | — | Entity type. Supported: ORDER, FULFILMENT, FULFILMENT_CHOICE, LOCATION, PRODUCT, INVENTORY_POSITION, INVENTORY_QUANTITY, NETWORK, VIRTUAL_CATALOGUE, WAVE, ARTICLE, CUSTOMER |
461
+ | `data` | object | yes | | Entity creation input fields (matches GraphQL create input type) |
462
+ | `returnFields` | string[] | no | type defaults | Fields to return after creation |
463
+ | `dryRun` | boolean | no | false | If true, build and validate mutation without executing |
464
+
465
+ **Key behaviors:**
466
+ - Validates required fields BEFORE sending (e.g., Location needs `openingSchedule`)
467
+ - Encodes compound key rules (ProductKey needs `ref` + `catalogue.ref`)
468
+ - Auto-resolves `retailerId` from config for retailer-scoped entities
469
+ - Returns the executed mutation string for audit trail
470
+
471
+ **Gotchas encoded:**
472
+ - No create inputs have a `status` field (auto-set to CREATED)
473
+ - Customer has NO `ref` field — `username` is the identifier
474
+ - Network uses `name` not `ref` in create; `retailers` is a plural array
475
+ - Location requires `openingSchedule` (even for 24/7, use `allHours: true`)
476
+ - Product `gtin` has 20-char max
477
+ - Settings `context` is plain String, `contextId` is separate Int
478
+
479
+ ```json
480
+ {
481
+ "entityType": "ORDER",
482
+ "data": {
483
+ "ref": "TEST-ORDER-001",
484
+ "type": "HD",
485
+ "retailer": { "id": 5 }
486
+ },
487
+ "dryRun": true
488
+ }
489
+ ```
490
+
491
+ #### `entity.update`
492
+
493
+ Status-aware entity updates with optional transition validation.
494
+
495
+ | Parameter | Type | Required | Default | Description |
496
+ |-----------|------|----------|---------|-------------|
497
+ | `entityType` | string | yes | — | Entity type |
498
+ | `id` | string | yes | — | Entity ID |
499
+ | `fields` | object | yes | — | Fields to update |
500
+ | `returnFields` | string[] | no | type defaults | Fields to return after update |
501
+ | `validateTransition` | boolean | no | false | If true and status is changing, validates via `workflow.transitions` first |
502
+
503
+ ```json
504
+ {
505
+ "entityType": "ORDER",
506
+ "id": "36",
507
+ "fields": { "status": "BOOKED" },
508
+ "validateTransition": true
509
+ }
510
+ ```
511
+
512
+ #### `entity.get`
513
+
514
+ Unified entity lookup by ID or ref with optional edge inclusion.
515
+
516
+ | Parameter | Type | Required | Default | Description |
517
+ |-----------|------|----------|---------|-------------|
518
+ | `entityType` | string | yes | — | Entity type |
519
+ | `id` | string | no | — | Entity ID (preferred lookup) |
520
+ | `ref` | string | no | — | Entity ref (fallback; not available for CUSTOMER) |
521
+ | `fields` | string[] | no | type defaults | Fields to return |
522
+ | `includeEdges` | string[] | no | — | Related entity edges to include (e.g., `fulfilments`, `items`, `attributes`) |
523
+
524
+ Either `id` or `ref` must be provided.
525
+
526
+ ```json
527
+ {
528
+ "entityType": "ORDER",
529
+ "ref": "HD-001",
530
+ "includeEdges": ["fulfilments", "items"]
531
+ }
532
+ ```
533
+
534
+ ### Workflow Management
535
+
536
+ #### `workflow.upload`
537
+
538
+ Deploy a workflow JSON definition to the Fluent environment via REST API.
539
+
540
+ | Parameter | Type | Required | Default | Description |
541
+ |-----------|------|----------|---------|-------------|
542
+ | `workflow` | string \| object | yes | — | Workflow JSON (as object or JSON string) |
543
+ | `retailerId` | string | no | from config | Target retailer ID |
544
+ | `validate` | boolean | no | true | Validate structure before uploading |
545
+ | `dryRun` | boolean | no | false | Validate only, do not deploy |
546
+
547
+ **Validation checks:** `name` present, at least one status defined, all rulesets have name/triggers/rules.
548
+
549
+ > For production deployments, prefer `fluent module install` via CLI which bundles workflows with settings, rules, and data in a versioned module. Use this tool for interactive editing, hotfixes, or when CLI is unavailable.
550
+
551
+ #### `workflow.diff`
552
+
553
+ Compare two workflow JSON definitions. Pure local computation — no API calls.
554
+
555
+ | Parameter | Type | Required | Default | Description |
556
+ |-----------|------|----------|---------|-------------|
557
+ | `base` | string \| object | yes | — | Base workflow (before) |
558
+ | `target` | string \| object | yes | — | Target workflow (after) |
559
+ | `format` | `"summary"` \| `"detailed"` \| `"mermaid"` | no | `"summary"` | Output format |
560
+
561
+ **Risk assessment:** Removing rulesets = HIGH, adding = LOW, modifying props = MEDIUM.
562
+
563
+ Formats:
564
+ - `summary` — change counts and risk level
565
+ - `detailed` — per-ruleset change breakdown
566
+ - `mermaid` — `stateDiagram-v2` with color-coded added/removed/modified states
567
+
568
+ #### `workflow.simulate`
569
+
570
+ Static prediction of workflow event outcomes. Pure local computation — no API calls.
571
+
572
+ | Parameter | Type | Required | Default | Description |
573
+ |-----------|------|----------|---------|-------------|
574
+ | `workflow` | string \| object | yes | — | Workflow JSON |
575
+ | `currentStatus` | string | yes | — | Current entity status to simulate from |
576
+ | `eventName` | string | no | — | Event name filter (if omitted, returns all matching rulesets) |
577
+ | `entityType` | string | no | — | Entity type filter |
578
+ | `entitySubtype` | string | no | — | Entity subtype filter |
579
+
580
+ **What it does:**
581
+ - Finds rulesets whose triggers match `currentStatus` (+ optional `eventName`)
582
+ - Extracts SetState rules → predicted next status
583
+ - Extracts SendEvent rules → predicted follow-on events
584
+ - Extracts SendWebhook rules → webhook side effects
585
+ - Identifies custom rules that cannot be statically predicted
586
+
587
+ **Important limitations (always disclosed in response):**
588
+ - STATIC ONLY: Cannot evaluate runtime conditions, entity attributes, or settings values
589
+ - CUSTOM RULES OPAQUE: Java plugin rules may conditionally execute
590
+ - NO CROSS-ENTITY: Does not follow SendEvent chains into child entity workflows
591
+ - Use `workflow.transitions` for AUTHORITATIVE live validation
592
+
593
+ ```json
594
+ {
595
+ "workflow": { "name": "ORDER::HD", "rulesets": [...] },
596
+ "currentStatus": "CREATED",
597
+ "eventName": "ConfirmValidation"
598
+ }
599
+ ```
600
+
601
+ ### Settings Management
602
+
603
+ #### `setting.upsert`
604
+
605
+ Create or update a Fluent Commerce setting. Upsert semantics — queries by name + context + contextId first, creates if missing, updates if exists.
606
+
607
+ | Parameter | Type | Required | Default | Description |
608
+ |-----------|------|----------|---------|-------------|
609
+ | `name` | string | yes | — | Setting key/name |
610
+ | `value` | string | yes | — | Setting value (for small values). Mutually exclusive with `lobValue` |
611
+ | `lobValue` | string | no | — | Large object value (for JSON payloads > 4KB) |
612
+ | `context` | string | yes | — | Scope: `RETAILER`, `ACCOUNT`, `LOCATION`, `NETWORK`, `AGENT`, `CUSTOMER` |
613
+ | `contextId` | integer | no | from config | Context ID (e.g., retailer ID). Falls back to `FLUENT_RETAILER_ID` for RETAILER context |
614
+
615
+ **Key gotchas:**
616
+ - `context` is a plain String (`"RETAILER"`), NOT an object
617
+ - `contextId` is a separate Int field
618
+ - For large JSON values (>4KB), use `lobValue` instead of `value`
619
+ - Returns `created: true/false` and `previousValue` for audit trail
620
+
621
+ ```json
622
+ {
623
+ "name": "WEBHOOK_ORDER_URL",
624
+ "value": "https://example.com/webhook",
625
+ "context": "RETAILER"
626
+ }
627
+ ```
628
+
629
+ #### `setting.bulkUpsert`
630
+
631
+ Batch create or update multiple settings in one call.
632
+
633
+ | Parameter | Type | Required | Default | Description |
634
+ |-----------|------|----------|---------|-------------|
635
+ | `settings` | array | yes | — | Array of setting objects (min 1, max 50). Each has: `name`, `value`, `context`, optional `lobValue`, `contextId` |
636
+
637
+ Processes sequentially with individual error handling. Returns `created`, `updated`, `failed` counts plus per-setting results.
638
+
639
+ ```json
640
+ {
641
+ "settings": [
642
+ { "name": "WEBHOOK_ORDER_URL", "value": "https://...", "context": "RETAILER" },
643
+ { "name": "WEBHOOK_FULFILMENT_URL", "value": "https://...", "context": "RETAILER" }
644
+ ]
645
+ }
646
+ ```
647
+
648
+ ### Environment Introspection
649
+
650
+ #### `environment.discover`
651
+
652
+ Full environment snapshot in one call.
653
+
654
+ | Parameter | Type | Required | Default | Description |
655
+ |-----------|------|----------|---------|-------------|
656
+ | `include` | string[] | no | `["retailer", "locations", "networks", "catalogues"]` | Sections to include. Valid: `retailer`, `locations`, `networks`, `catalogues`, `workflows`, `settings`, `modules`, `users` |
657
+
658
+ Returns everything an agent needs: retailer details, locations with type/status, networks with associated locations, catalogues (inventory + product + virtual), deployed workflows, settings, modules, and authenticated user info.
659
+
660
+ **Limitations:**
661
+ - Locations and settings return first 100 items only (use `graphql.queryAll` for complete list)
662
+ - Workflows section uses transition API probe — use `fluent workflow list` via CLI for definitive workflow listing
663
+
664
+ ```json
665
+ {
666
+ "include": ["retailer", "locations", "networks", "catalogues", "settings", "workflows"]
667
+ }
668
+ ```
669
+
670
+ #### `environment.validate`
671
+
672
+ Pre-flight environment validation before E2E tests or deployments.
673
+
674
+ | Parameter | Type | Required | Default | Description |
675
+ |-----------|------|----------|---------|-------------|
676
+ | `checks` | string[] | no | `["auth", "retailer", "locations"]` | Checks to run. Valid: `auth`, `retailer`, `locations`, `inventory`, `workflows`, `settings`, `modules` |
677
+
678
+ Returns pass/fail per check with severity (`info`, `warning`, `error`) and actionable messages.
679
+
680
+ **Checks performed:**
681
+ - `auth` — token valid, permissions sufficient
682
+ - `retailer` — exists, active
683
+ - `locations` — at least one warehouse/store exists
684
+ - `inventory` — at least one product with stock > 0
685
+ - `workflows` — key workflows deployed (ORDER, FULFILMENT)
686
+ - `settings` — settings exist in environment
687
+ - `modules` — modules deployed (via plugin registry)
688
+
689
+ ```json
690
+ {
691
+ "checks": ["auth", "retailer", "locations", "inventory", "workflows"]
692
+ }
693
+ ```
694
+
695
+ ### Testing
696
+
697
+ #### `test.assert`
698
+
699
+ Assert entity state matches expectations with optional polling. Deep assertion on entity fields, attributes, and edge counts/statuses.
700
+
701
+ | Parameter | Type | Required | Default | Description |
702
+ |-----------|------|----------|---------|-------------|
703
+ | `entityType` | string | yes | — | Entity type (ORDER, FULFILMENT, etc.) |
704
+ | `id` | string | no | — | Entity ID (preferred) |
705
+ | `ref` | string | no | — | Entity ref (fallback) |
706
+ | `assertions` | object | yes | — | Assertion conditions (see below) |
707
+ | `poll` | boolean | no | false | Enable polling mode (retry until pass or timeout) |
708
+ | `timeoutMs` | integer | no | 60000 | Polling timeout in ms (min 1000, max 300000) |
709
+ | `intervalMs` | integer | no | 5000 | Polling interval in ms (min 1000, max 30000) |
710
+
711
+ **Assertion fields:**
712
+ - `status` — exact match on entity status
713
+ - `type` — exact match on entity type
714
+ - `subtype` — exact match on entity subtype
715
+ - `attributes` — key-value pairs that must be present
716
+ - `edges` — per-edge assertions with `minCount`, `maxCount`, `status`
717
+
718
+ **Polling mode:** Set `poll: true` to retry until assertions pass or timeout. Useful after sending events when state changes are async.
719
+
720
+ ```json
721
+ {
722
+ "entityType": "ORDER",
723
+ "ref": "HD-001",
724
+ "assertions": {
725
+ "status": "BOOKED",
726
+ "edges": {
727
+ "fulfilments": { "minCount": 1, "status": "CREATED" }
728
+ }
729
+ },
730
+ "poll": true,
731
+ "timeoutMs": 30000
732
+ }
733
+ ```
734
+
735
+ ## Webhook Validation
736
+
737
+ ### `webhook.validate`
738
+
739
+ Validate a Fluent Commerce webhook payload and optionally verify its signature.
740
+
741
+ | Parameter | Type | Required | Default | Description |
742
+ |-----------|------|----------|---------|-------------|
743
+ | `payload` | object | yes | — | Webhook payload. Must include `name`, `id`, `retailerId` for basic validation |
744
+ | `rawBody` | string | no | — | Exact raw HTTP request body for signature verification (avoids false negatives from JSON re-serialization) |
745
+ | `signature` | string | no | — | X-Fluent-Signature header value (base64). Required for signature validation |
746
+ | `publicKey` | string | no | — | Fluent public key (PEM format). Required when `signature` is provided |
747
+ | `algorithm` | `"SHA512withRSA"` \| `"MD5withRSA"` | no | `"SHA512withRSA"` | Signature algorithm |
748
+
749
+ **Two modes:**
750
+ 1. **Basic validation** (no signature): Checks required fields present
751
+ 2. **Signature validation**: Verifies X-Fluent-Signature against the body using the public key
752
+
753
+ ```json
754
+ {
755
+ "payload": { "name": "OrderCreated", "id": "123", "retailerId": "1" },
756
+ "signature": "<base64-sig>",
757
+ "publicKey": "<PEM-key>"
758
+ }
759
+ ```
760
+
761
+ ## Response Optimization
762
+
763
+ High-volume tools support response shaping to reduce token consumption:
764
+
765
+ ### event.list — Field Projection
766
+
767
+ Pass `fields` (array of strings) to return only selected fields per event. Reduces token usage by 7-8x for typical queries.
768
+
769
+ ```json
770
+ {
771
+ "context.entityRef": "ORDER_REF",
772
+ "context.entityType": "ORDER",
773
+ "count": 50,
774
+ "fields": ["id", "name", "eventStatus", "category", "generatedOn", "context.entityRef", "context.entityType"]
775
+ }
776
+ ```
777
+
778
+ Common field sets by use case:
779
+ - **Trace/debug:** `["id", "name", "eventStatus", "category", "context.entityRef", "context.entityType", "generatedOn", "source", "context.sourceEvents"]`
780
+ - **E2E status check:** `["id", "name", "eventStatus", "context.entityRef"]`
781
+ - **Exception analysis:** `["id", "name", "eventStatus", "category", "attributes", "context.entityRef", "generatedOn"]`
782
+
783
+ Omit `fields` for full event data (when you need attributes, source, timing, etc.).
784
+
785
+ ### plugin.list — Compact Mode
786
+
787
+ Pass `compact: true` to return only `ruleInfo` (name, description, entity types) per rule, stripping `parameters` and `eventAttributes`. Reduces token usage by 40-60x for unfiltered queries.
788
+
789
+ ```json
790
+ { "compact": true }
791
+ { "name": "SendEvent", "compact": true }
792
+ ```
793
+
794
+ Use full mode (default) when you need rule parameters or event attribute contracts.
795
+
796
+ ## Pagination Pattern
797
+
798
+ Fluent uses Relay-style connections. Cursors live on each **edge**, not on pageInfo:
799
+
800
+ ```graphql
801
+ {
802
+ orders(first: 50, after: $cursor) {
803
+ edges {
804
+ cursor
805
+ node { id ref status }
806
+ }
807
+ pageInfo { hasNextPage }
808
+ }
809
+ }
810
+ ```
811
+
812
+ Take cursor from the LAST edge, pass as `after` in next call.