@fluentcommerce/fluent-mcp-extn 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -11
- package/dist/entity-registry.js +1 -0
- package/dist/fluent-client.js +30 -0
- package/dist/settings-tools.js +285 -4
- package/dist/tools.js +48 -7
- package/dist/workflow-tools.js +286 -0
- package/docs/E2E_TESTING.md +12 -12
- package/docs/RUNBOOK.md +5 -2
- package/docs/TOOL_REFERENCE.md +116 -3
- package/package.json +1 -1
package/docs/TOOL_REFERENCE.md
CHANGED
|
@@ -462,6 +462,7 @@ Calls `POST /api/v4.1/transition` to discover what events can be fired, what att
|
|
|
462
462
|
- **Required**: `triggers` (array), each trigger requires `retailerId`
|
|
463
463
|
- **Optional per trigger**: `type`, `subtype`, `status`, `module`, `flexType`, `flexVersion`, `name`
|
|
464
464
|
- **Retailer behavior**: `retailerId` is required per trigger. Falls back to `FLUENT_RETAILER_ID` when omitted.
|
|
465
|
+
- **flexType auto-derive**: When `flexType` is not provided but `type` and `subtype` are, the tool auto-derives `flexType` as `{type}::{subtype}` (e.g., `CREDIT_MEMO::APPEASEMENT`). This avoids the silent empty-response problem where the Transition API returns `{"response":[]}` when `flexType` is missing.
|
|
465
466
|
|
|
466
467
|
### Use cases
|
|
467
468
|
|
|
@@ -1309,6 +1310,62 @@ Response:
|
|
|
1309
1310
|
|
|
1310
1311
|
---
|
|
1311
1312
|
|
|
1313
|
+
## `workflow.get`
|
|
1314
|
+
|
|
1315
|
+
Fetch a specific workflow definition by entity type and subtype via REST API.
|
|
1316
|
+
|
|
1317
|
+
Uses `GET /api/v4.1/workflow/{retailerId}/{entityType}::{entitySubtype}/` — works even when the list endpoint returns 401 (permission-restricted accounts).
|
|
1318
|
+
|
|
1319
|
+
- **Required**:
|
|
1320
|
+
- `entityType`: workflow entity type (e.g., `ORDER`, `FULFILMENT`, `INVENTORY_CATALOGUE`)
|
|
1321
|
+
- `entitySubtype`: workflow entity subtype (e.g., `HD`, `DEFAULT`, `MASTER`)
|
|
1322
|
+
- **Optional**:
|
|
1323
|
+
- `retailerId`: target retailer ID (falls back to `FLUENT_RETAILER_ID`)
|
|
1324
|
+
- `version`: specific workflow version to fetch (omit for latest)
|
|
1325
|
+
- `outputFile`: file path to save workflow JSON. When set, writes full workflow to file and returns only summary (name, version, status/ruleset/rule counts) — keeps large workflow JSON out of the LLM context. Parent directories are created automatically.
|
|
1326
|
+
|
|
1327
|
+
**Response** includes a summary (status count, ruleset count, total rules) plus the full workflow JSON (unless `outputFile` is set).
|
|
1328
|
+
|
|
1329
|
+
**Known entity types:** ORDER, FULFILMENT, FULFILMENT_CHOICE, ARTICLE, RETURN_ORDER, WAVE, CONSIGNMENT, INVENTORY_CATALOGUE, INVENTORY_POSITION, VIRTUAL_CATALOGUE, LOCATION, PRODUCT, CUSTOMER, CARRIER, NETWORK, CREDIT_MEMO.
|
|
1330
|
+
|
|
1331
|
+
**Example:**
|
|
1332
|
+
|
|
1333
|
+
```json
|
|
1334
|
+
{
|
|
1335
|
+
"entityType": "INVENTORY_CATALOGUE",
|
|
1336
|
+
"entitySubtype": "DEFAULT",
|
|
1337
|
+
"retailerId": "34"
|
|
1338
|
+
}
|
|
1339
|
+
```
|
|
1340
|
+
|
|
1341
|
+
**Note:** Fluent returns HTTP 200 with an empty body for nonexistent workflows — the handler checks for meaningful content (presence of `name` field) and returns a clear "not found" message.
|
|
1342
|
+
|
|
1343
|
+
---
|
|
1344
|
+
|
|
1345
|
+
## `workflow.list`
|
|
1346
|
+
|
|
1347
|
+
List all workflows for a retailer via REST API.
|
|
1348
|
+
|
|
1349
|
+
Uses `GET /api/v4.1/workflow?retailerId={id}&count=200`. Response is deduplicated to show only the latest version of each workflow. Reads from **live server**, NOT the workflowlog cache.
|
|
1350
|
+
|
|
1351
|
+
- **Optional**:
|
|
1352
|
+
- `retailerId`: target retailer ID (falls back to `FLUENT_RETAILER_ID`)
|
|
1353
|
+
- `outputDir`: directory path to download ALL workflows (latest version each) as individual JSON files. Each file is named `<TYPE>-<SUBTYPE>.json`. Returns only summary metadata when set — full JSON stays on disk. Parent directories are created automatically.
|
|
1354
|
+
|
|
1355
|
+
**Response** includes per-workflow summary (name, version, status count, ruleset count) and totals.
|
|
1356
|
+
|
|
1357
|
+
**Example:**
|
|
1358
|
+
|
|
1359
|
+
```json
|
|
1360
|
+
{
|
|
1361
|
+
"retailerId": "35"
|
|
1362
|
+
}
|
|
1363
|
+
```
|
|
1364
|
+
|
|
1365
|
+
**Note:** Some accounts restrict this endpoint (401 "Incorrect retailer"). In that case, use `workflow.get` with a specific entityType + entitySubtype instead.
|
|
1366
|
+
|
|
1367
|
+
---
|
|
1368
|
+
|
|
1312
1369
|
## `workflow.upload`
|
|
1313
1370
|
|
|
1314
1371
|
Deploy a workflow JSON definition to the Fluent environment.
|
|
@@ -1491,6 +1548,57 @@ Response:
|
|
|
1491
1548
|
|
|
1492
1549
|
---
|
|
1493
1550
|
|
|
1551
|
+
## `setting.get`
|
|
1552
|
+
|
|
1553
|
+
Fetch one or more Fluent Commerce settings by name (supports `%` wildcards).
|
|
1554
|
+
|
|
1555
|
+
Uses the GraphQL `settings(name:)` query. Returns metadata inline (name, context, contextId, valueType). For large settings (manifests, JSON > 4KB), use `outputFile` to save content to a local file and keep it out of the LLM context.
|
|
1556
|
+
|
|
1557
|
+
- **Required**:
|
|
1558
|
+
- `name`: setting name or pattern. Supports `%` wildcards (e.g., `fc.mystique.manifest.%` for all manifest settings)
|
|
1559
|
+
- **Optional**:
|
|
1560
|
+
- `context`: filter by context — `ACCOUNT`, `RETAILER`, etc.
|
|
1561
|
+
- `contextId`: context ID. Falls back to `FLUENT_RETAILER_ID` for `RETAILER` context, `0` for `ACCOUNT`.
|
|
1562
|
+
- `outputFile`: file path to save the setting value/lobValue. When provided, writes content to file and returns only metadata (name, context, valueType, size) — keeps large manifests out of the LLM context. Parent directories are created automatically.
|
|
1563
|
+
- `first`: max results (default: 10, max: 100)
|
|
1564
|
+
|
|
1565
|
+
**Behavior with `outputFile`:**
|
|
1566
|
+
|
|
1567
|
+
- **Single match** + `outputFile` → writes lobValue (or value) to the file, returns metadata + file path + byte size (NOT the content)
|
|
1568
|
+
- **Multiple matches** + `outputFile` → writes each setting to a separate file in the directory (named `<setting-name>.json`), returns per-file metadata
|
|
1569
|
+
- **No `outputFile`** → returns full setting data inline (may be large for manifests)
|
|
1570
|
+
- JSON content is automatically pretty-printed when saved to file
|
|
1571
|
+
|
|
1572
|
+
**Example** — fetch a specific manifest setting to disk:
|
|
1573
|
+
|
|
1574
|
+
```json
|
|
1575
|
+
{
|
|
1576
|
+
"name": "fc.mystique.manifest.oms",
|
|
1577
|
+
"context": "ACCOUNT",
|
|
1578
|
+
"outputFile": "./accounts/<PROFILE>/manifests/backups/fc.mystique.manifest.oms.json"
|
|
1579
|
+
}
|
|
1580
|
+
```
|
|
1581
|
+
|
|
1582
|
+
**Example** — list all manifest settings (wildcard):
|
|
1583
|
+
|
|
1584
|
+
```json
|
|
1585
|
+
{
|
|
1586
|
+
"name": "fc.mystique.manifest.%",
|
|
1587
|
+
"context": "ACCOUNT"
|
|
1588
|
+
}
|
|
1589
|
+
```
|
|
1590
|
+
|
|
1591
|
+
**Example** — download all manifests to directory:
|
|
1592
|
+
|
|
1593
|
+
```json
|
|
1594
|
+
{
|
|
1595
|
+
"name": "fc.mystique.manifest.%",
|
|
1596
|
+
"outputFile": "./accounts/<PROFILE>/manifests/backups/"
|
|
1597
|
+
}
|
|
1598
|
+
```
|
|
1599
|
+
|
|
1600
|
+
---
|
|
1601
|
+
|
|
1494
1602
|
## `setting.upsert`
|
|
1495
1603
|
|
|
1496
1604
|
Create or update a Fluent Commerce setting with upsert semantics.
|
|
@@ -1504,12 +1612,14 @@ Queries existing settings by `name` + `context` + `contextId` first. Creates if
|
|
|
1504
1612
|
- **Optional**:
|
|
1505
1613
|
- `lobValue`: large object value for JSON payloads > 4KB (mutually exclusive with `value`)
|
|
1506
1614
|
- `contextId`: context ID (e.g., retailer ID). Defaults to `FLUENT_RETAILER_ID` for `RETAILER` context.
|
|
1615
|
+
- `valueType`: explicit value type — `"STRING"`, `"LOB"`, or `"JSON"`. **Use `"JSON"` for Mystique manifest settings** (`fc.mystique.*`). Defaults to `"LOB"` when `lobValue` is provided, `"STRING"` when `value` is provided.
|
|
1507
1616
|
|
|
1508
1617
|
**Key gotchas:**
|
|
1509
1618
|
|
|
1510
1619
|
- `context` is a plain String (`"RETAILER"`), NOT an object
|
|
1511
1620
|
- `contextId` is a separate Int field
|
|
1512
1621
|
- For large JSON values (> 4KB), use `lobValue` instead of `value`
|
|
1622
|
+
- **For Mystique manifest settings, set `valueType: "JSON"`** — without it, defaults to `"LOB"` which breaks manifest parsing. The tool emits a `warning` field in the response when a `fc.mystique.manifest.*` name is used without `valueType: "JSON"`.
|
|
1513
1623
|
- Returns `created: true/false` for audit trail
|
|
1514
1624
|
|
|
1515
1625
|
**Example** — create a webhook URL setting:
|
|
@@ -1560,7 +1670,7 @@ Batch create or update multiple settings in one call.
|
|
|
1560
1670
|
Processes up to 50 settings sequentially with individual error handling. Each setting is an independent upsert — failures on one setting don't block others.
|
|
1561
1671
|
|
|
1562
1672
|
- **Required**:
|
|
1563
|
-
- `settings`: array of setting objects (min 1, max 50), each with `name`, `value`, `context`, and optional `lobValue` and `
|
|
1673
|
+
- `settings`: array of setting objects (min 1, max 50), each with `name`, `value`, `context`, and optional `lobValue`, `contextId`, and `valueType` (`"STRING"`, `"LOB"`, or `"JSON"`)
|
|
1564
1674
|
|
|
1565
1675
|
**Example** — bulk create 3 settings:
|
|
1566
1676
|
|
|
@@ -1763,11 +1873,11 @@ Response (fail after timeout):
|
|
|
1763
1873
|
|
|
1764
1874
|
| Category | Tools | Retry behavior |
|
|
1765
1875
|
|------|----------|-------------|
|
|
1766
|
-
| Read operations | `event.get`, `event.list`, `event.flowInspect`, `metrics.query`, `metrics.healthCheck`, `metrics.sloReport`, `metrics.labelCatalog`, `metrics.topEvents`, `workflow.transitions`, `graphql.query` (query), `graphql.queryAll`, `batch.status`, `batch.batchStatus`, `batch.results`, `graphql.introspect`, `connection.test`, `entity.get`, `environment.discover`, `environment.validate`, `test.assert`, `plugin.list` | retry + backoff |
|
|
1876
|
+
| Read operations | `event.get`, `event.list`, `event.flowInspect`, `metrics.query`, `metrics.healthCheck`, `metrics.sloReport`, `metrics.labelCatalog`, `metrics.topEvents`, `workflow.transitions`, `workflow.get`, `workflow.list`, `graphql.query` (query), `graphql.queryAll`, `batch.status`, `batch.batchStatus`, `batch.results`, `graphql.introspect`, `connection.test`, `entity.get`, `setting.get`, `environment.discover`, `environment.validate`, `test.assert`, `plugin.list` | retry + backoff |
|
|
1767
1877
|
| Write operations | `event.send`, `batch.create`, `batch.send`, `graphql.query` (mutation), `graphql.batchMutate`, `entity.create`, `entity.update`, `workflow.upload`, `setting.upsert`, `setting.bulkUpsert` | timeout-only (no automatic retry) |
|
|
1768
1878
|
| Local validation / no API | `config.validate`, `health.ping`, `event.build`, `webhook.validate`, `workflow.diff`, `workflow.simulate` | not applicable |
|
|
1769
1879
|
|
|
1770
|
-
## Tool inventory summary (
|
|
1880
|
+
## Tool inventory summary (39 tools)
|
|
1771
1881
|
|
|
1772
1882
|
| Tool | Category | Requires SDK | Retry | Description |
|
|
1773
1883
|
|------|----------|:------------:|:-----:|-------------|
|
|
@@ -1799,9 +1909,12 @@ Response (fail after timeout):
|
|
|
1799
1909
|
| `entity.create` | Entity | Yes | No | Type-safe entity creation with field validation and gotcha knowledge (12 entity types) |
|
|
1800
1910
|
| `entity.update` | Entity | Yes | No | Status-aware entity updates with optional transition validation |
|
|
1801
1911
|
| `entity.get` | Entity | Yes | Yes | Unified entity lookup by ID or ref with optional edge inclusion |
|
|
1912
|
+
| `workflow.get` | Workflow Mgmt | Yes | Yes | Fetch specific workflow by entityType + entitySubtype via REST API |
|
|
1913
|
+
| `workflow.list` | Workflow Mgmt | Yes | Yes | List all workflows for a retailer (deduplicated to latest versions) |
|
|
1802
1914
|
| `workflow.upload` | Workflow Mgmt | Yes | No | Deploy workflow JSON via REST API with structure validation |
|
|
1803
1915
|
| `workflow.diff` | Workflow Mgmt | No | — | Compare two workflows — rulesets, statuses, risk assessment, mermaid output |
|
|
1804
1916
|
| `workflow.simulate` | Workflow Mgmt | No | — | Static prediction of event outcomes from workflow JSON |
|
|
1917
|
+
| `setting.get` | Settings | Yes | Yes | Fetch settings by name (wildcards supported), optionally save to local file |
|
|
1805
1918
|
| `setting.upsert` | Settings | Yes | No | Create or update a setting with upsert semantics |
|
|
1806
1919
|
| `setting.bulkUpsert` | Settings | Yes | No | Batch create/update up to 50 settings with per-setting error handling |
|
|
1807
1920
|
| `environment.discover` | Environment | Yes | Yes | Full environment snapshot — retailer, locations, networks, catalogues, settings, modules |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentcommerce/fluent-mcp-extn",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "MCP (Model Context Protocol) extension server for Fluent Commerce. Exposes event dispatch, transition actions, GraphQL execution, Prometheus metrics, batch ingestion, and webhook validation as MCP tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|