@fluentcommerce/ai-skills 0.1.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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +622 -0
  3. package/bin/cli.mjs +1973 -0
  4. package/content/cli/agents/fluent-cli/agent.json +149 -0
  5. package/content/cli/agents/fluent-cli.md +132 -0
  6. package/content/cli/skills/fluent-bootstrap/SKILL.md +181 -0
  7. package/content/cli/skills/fluent-cli-index/SKILL.md +63 -0
  8. package/content/cli/skills/fluent-cli-mcp-cicd/SKILL.md +77 -0
  9. package/content/cli/skills/fluent-cli-reference/SKILL.md +1031 -0
  10. package/content/cli/skills/fluent-cli-retailer/SKILL.md +85 -0
  11. package/content/cli/skills/fluent-cli-settings/SKILL.md +106 -0
  12. package/content/cli/skills/fluent-connect/SKILL.md +886 -0
  13. package/content/cli/skills/fluent-module-deploy/SKILL.md +349 -0
  14. package/content/cli/skills/fluent-profile/SKILL.md +180 -0
  15. package/content/cli/skills/fluent-workflow/SKILL.md +310 -0
  16. package/content/dev/agents/fluent-dev/agent.json +88 -0
  17. package/content/dev/agents/fluent-dev.md +525 -0
  18. package/content/dev/reference-modules/catalog.json +4754 -0
  19. package/content/dev/skills/fluent-build/SKILL.md +192 -0
  20. package/content/dev/skills/fluent-connection-analysis/SKILL.md +386 -0
  21. package/content/dev/skills/fluent-custom-code/SKILL.md +895 -0
  22. package/content/dev/skills/fluent-data-module-scaffold/SKILL.md +714 -0
  23. package/content/dev/skills/fluent-e2e-test/SKILL.md +394 -0
  24. package/content/dev/skills/fluent-event-api/SKILL.md +945 -0
  25. package/content/dev/skills/fluent-feature-explain/SKILL.md +603 -0
  26. package/content/dev/skills/fluent-feature-plan/PLAN_TEMPLATE.md +695 -0
  27. package/content/dev/skills/fluent-feature-plan/SKILL.md +227 -0
  28. package/content/dev/skills/fluent-job-batch/SKILL.md +138 -0
  29. package/content/dev/skills/fluent-mermaid-validate/SKILL.md +86 -0
  30. package/content/dev/skills/fluent-module-scaffold/SKILL.md +1928 -0
  31. package/content/dev/skills/fluent-module-validate/SKILL.md +775 -0
  32. package/content/dev/skills/fluent-pre-deploy-check/SKILL.md +1108 -0
  33. package/content/dev/skills/fluent-retailer-config/SKILL.md +1111 -0
  34. package/content/dev/skills/fluent-rule-scaffold/SKILL.md +385 -0
  35. package/content/dev/skills/fluent-scope-decompose/SKILL.md +1021 -0
  36. package/content/dev/skills/fluent-session-audit-export/SKILL.md +632 -0
  37. package/content/dev/skills/fluent-session-summary/SKILL.md +195 -0
  38. package/content/dev/skills/fluent-settings/SKILL.md +1058 -0
  39. package/content/dev/skills/fluent-source-onboard/SKILL.md +632 -0
  40. package/content/dev/skills/fluent-system-monitoring/SKILL.md +767 -0
  41. package/content/dev/skills/fluent-test-data/SKILL.md +513 -0
  42. package/content/dev/skills/fluent-trace/SKILL.md +1143 -0
  43. package/content/dev/skills/fluent-transition-api/SKILL.md +346 -0
  44. package/content/dev/skills/fluent-version-manage/SKILL.md +744 -0
  45. package/content/dev/skills/fluent-workflow-analyzer/SKILL.md +959 -0
  46. package/content/dev/skills/fluent-workflow-builder/SKILL.md +319 -0
  47. package/content/dev/skills/fluent-workflow-deploy/SKILL.md +267 -0
  48. package/content/mcp-extn/agents/fluent-mcp.md +69 -0
  49. package/content/mcp-extn/skills/fluent-mcp-tools/SKILL.md +461 -0
  50. package/content/mcp-official/agents/fluent-mcp-core.md +91 -0
  51. package/content/mcp-official/skills/fluent-mcp-core/SKILL.md +94 -0
  52. package/content/rfl/agents/fluent-rfl.md +56 -0
  53. package/content/rfl/skills/fluent-rfl-assess/SKILL.md +172 -0
  54. package/docs/CAPABILITY_MAP.md +77 -0
  55. package/docs/CLI_COVERAGE.md +47 -0
  56. package/docs/DEV_WORKFLOW.md +802 -0
  57. package/docs/FLOW_RUN.md +142 -0
  58. package/docs/USE_CASES.md +404 -0
  59. package/metadata.json +156 -0
  60. package/package.json +51 -0
@@ -0,0 +1,461 @@
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.
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: fluent-mcp-core
3
+ description: Official Fluent Commerce CLI MCP server agent. Provides GraphQL query building, schema validation, workflow listing/downloading, and health diagnostics via the built-in MCP server. Triggers on "fluent mcp core", "mcp server", "graphql build", "workflow list".
4
+ tools: Bash, Read, Write, Edit, Glob, Grep
5
+ model: inherit
6
+ skills: fluent-mcp-core
7
+ ---
8
+
9
+ # Fluent MCP Core Agent
10
+
11
+ You are a specialist for the official Fluent Commerce CLI MCP server. This is the built-in MCP server shipped with the Fluent CLI, started via `fluent mcp server --stdio`.
12
+
13
+ ## Setup
14
+
15
+ The server is configured in `.mcp.json` at the project root:
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "fluent-mcp": {
21
+ "command": "fluent",
22
+ "args": ["mcp", "server", "--stdio"],
23
+ "env": {
24
+ "FLUENT_PROFILE": "<profile-name>"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ Requires an active Fluent CLI profile (`fluent profile active`).
32
+
33
+ ## Available Tools
34
+
35
+ | Tool | Purpose |
36
+ |------|---------|
37
+ | `health.ping` | Confirm SDK adapter connection and config readiness |
38
+ | `graphql.execute` | Execute a GraphQL query or mutation against the Fluent endpoint |
39
+ | `graphql.listRoots` | List all query and mutation root fields from the schema |
40
+ | `graphql.validate` | Validate a GraphQL document against the cached schema |
41
+ | `graphql.generateFull` | Generate a maximal-selection query for a root field (depth-limited) |
42
+ | `graphql.buildQuery` | Generate a query/mutation string from field selections and args |
43
+ | `workflow.list` | List all workflows for a retailer (names, versions, types) |
44
+ | `workflow.download` | Download a specific workflow definition (complete JSON) |
45
+
46
+ ## Key Behaviors
47
+
48
+ 1. **Check health first**: Run `health.ping` to verify the server is connected
49
+ 2. **Use `graphql.buildQuery`** to construct queries from field selections
50
+ 3. **Use `graphql.validate`** to check queries before execution
51
+ 4. **Use `graphql.generateFull`** to explore types at configurable depth
52
+ 5. **Prefer `graphql.listRoots`** to discover available queries and mutations
53
+
54
+ ## Workflow Operations
55
+
56
+ ```
57
+ workflow.list(profile: "YOUR_PROFILE", retailer: "YOUR_RETAILER_REF")
58
+ workflow.download(profile: "YOUR_PROFILE", retailer: "YOUR_RETAILER_REF", workflow: "ORDER::MULTI")
59
+ ```
60
+
61
+ ## GraphQL Operations
62
+
63
+ ```
64
+ graphql.listRoots()
65
+ graphql.buildQuery(rootField: "orders", fields: ["id", "ref", "status", "type"])
66
+ graphql.validate(query: "{ orders(first: 10) { edges { node { id ref } } } }")
67
+ graphql.execute(query: "{ orders(first: 10) { edges { node { id ref status } } } }")
68
+ ```
69
+
70
+ ## Differences from MCP Extension
71
+
72
+ | Feature | MCP Core | MCP Extension |
73
+ |---------|----------|---------------|
74
+ | Server | Built-in CLI (`fluent mcp server`) | Custom (`fluent-mcp-extn`) |
75
+ | Auth | CLI profile | Profile / OAuth / Token Command / Static Token |
76
+ | Events | Not supported | Full event API |
77
+ | Batch ingestion | Not supported | Full batch API |
78
+ | Webhooks | Not supported | Webhook validation |
79
+ | Auto-pagination | Not supported | `graphql.queryAll` |
80
+ | Batch mutations | Not supported | `graphql.batchMutate` (up to 50) |
81
+ | Schema tools | `generateFull`, `listRoots`, `validate`, `buildQuery` | `graphql.introspect` |
82
+ | Workflows | `workflow.list`, `workflow.download` | Not supported |
83
+
84
+ ## Event Operations
85
+
86
+ Event dispatch and querying are handled by the **MCP Extension server** (`fluent-mcp-extn`), not this official CLI MCP server.
87
+
88
+ For event operations, redirect to:
89
+ - Event dispatch and queries → `/fluent-mcp-tools`
90
+ - Event model and semantics → `/fluent-event-api`
91
+ - Event debugging → `/fluent-trace`
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: fluent-mcp-core
3
+ description: Official Fluent Commerce CLI MCP server setup and operations. Configure the built-in MCP server, run health checks, build/validate GraphQL queries, and manage workflows. Triggers on "mcp core setup", "fluent mcp server", "graphql validate", "workflow download".
4
+ user-invocable: true
5
+ allowed-tools: Bash, Read, Write, Edit, Glob, Grep
6
+ argument-hint: <operation> [--profile name] [--retailer ref]
7
+ ---
8
+
9
+ # Fluent MCP Core
10
+
11
+ Setup and operations guide for the official Fluent Commerce CLI MCP server.
12
+
13
+ ## When to Use
14
+
15
+ - Setting up the built-in MCP server for a project
16
+ - Building and validating GraphQL queries against the schema
17
+ - Listing or downloading workflow definitions
18
+ - Diagnosing MCP server connectivity issues
19
+
20
+ ## Setup
21
+
22
+ ### 1. Ensure CLI Profile Exists
23
+
24
+ ```bash
25
+ fluent profile active
26
+ fluent profile list
27
+ ```
28
+
29
+ ### 2. Configure `.mcp.json`
30
+
31
+ Add to your project root:
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "fluent-mcp": {
37
+ "command": "fluent",
38
+ "args": ["mcp", "server", "--stdio"],
39
+ "env": {
40
+ "FLUENT_PROFILE": "YOUR_PROFILE"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### 3. Verify Connection
48
+
49
+ Use `health.ping` tool to confirm the server is connected and the profile is valid.
50
+
51
+ ## Operations
52
+
53
+ ### Health Check
54
+
55
+ Run `health.ping` to confirm config readiness and SDK adapter status.
56
+
57
+ ### GraphQL
58
+
59
+ | Operation | Tool | Description |
60
+ |-----------|------|-------------|
61
+ | Discover fields | `graphql.listRoots` | List all query/mutation root fields |
62
+ | Explore type | `graphql.generateFull` | Generate maximal query for a root field |
63
+ | Build query | `graphql.buildQuery` | Create query from field selections |
64
+ | Validate | `graphql.validate` | Check query against schema |
65
+ | Execute | `graphql.execute` | Run query/mutation |
66
+
67
+ ### Workflows
68
+
69
+ | Operation | Tool | Description |
70
+ |-----------|------|-------------|
71
+ | List | `workflow.list` | All workflows for a retailer |
72
+ | Download | `workflow.download` | Full workflow JSON with rulesets |
73
+
74
+ ## Troubleshooting
75
+
76
+ | Symptom | Cause | Fix |
77
+ |---------|-------|-----|
78
+ | `health.ping` fails | No active profile | Run `fluent profile active` |
79
+ | Auth error | Expired token | Run `fluent auth login -p <PROFILE>` |
80
+ | Empty workflow list | Wrong retailer ref | Check `fluent retailer list -p <PROFILE>` |
81
+ | Server won't start | CLI not in PATH | `npm i -g @fluentcommerce/cli` |
82
+
83
+ ## MCP Core vs MCP Extension
84
+
85
+ Use **MCP Core** when you need:
86
+ - Query building and schema validation
87
+ - Workflow listing and downloading
88
+ - Simple GraphQL with CLI profile auth
89
+
90
+ Use **MCP Extension** (`mcp` group) when you need:
91
+ - Event dispatch (build, send, verify)
92
+ - Auto-paginated queries
93
+ - Batch mutations and data ingestion
94
+ - Webhook validation