@ductape/mcp 0.2.25 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +55 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -780,11 +780,19 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
|
|
|
780
780
|
databases.migration.rollback [migrations, count?]
|
|
781
781
|
databases.migration.history []
|
|
782
782
|
databases.migration.status [migrations]
|
|
783
|
-
databases.action.create [{ product
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
783
|
+
databases.action.create [{ tag: "product:database:action", name, tableName, operation: "query"|"insert"|"update"|"delete"|"upsert"|"aggregate"|"rawSql", template: { where?, select?, limit?, offset?, orderBy?, records?, query?, params?, ... }, description?, filterTemplate? }]
|
|
784
|
+
← ADMINISTRATIVE (access key required). FORBIDDEN via ductape_execute (publishable key) —
|
|
785
|
+
use ductape_cli("db actions create -f action.json") instead. tag MUST be fully qualified
|
|
786
|
+
"product_tag:database_tag:action_tag" — a 2-part "database:action" shorthand only resolves
|
|
787
|
+
inside a long-lived process that already has that product's builder cached, never in a
|
|
788
|
+
fresh CLI/MCP call. This is pure metadata registration; it never connects to the live
|
|
789
|
+
database, so it does NOT require the database to be reachable at call time.
|
|
790
|
+
databases.action.update [{ tag, name?, description?, template?, filterTemplate? }]
|
|
791
|
+
← ADMINISTRATIVE. Use ductape_cli("db actions update --tag <tag> -f patch.json").
|
|
792
|
+
databases.action.fetch [action_tag] ← read-only, safe via ductape_execute
|
|
793
|
+
databases.action.fetchAll [database_tag] ← read-only, safe via ductape_execute.
|
|
794
|
+
NOTE: the method is fetchAll — "action.list" is not a callable method on this sub-object.
|
|
795
|
+
databases.action.delete [action_tag] ← ADMINISTRATIVE. Use ductape_cli("db actions delete <tag>").
|
|
788
796
|
databases.action.dispatch [{ product, env, database, action, input, schedule? }] ← CALL ductape_generate_payload FIRST (operation_family="database", method="dispatch", targets={database: "db_tag", table: "table_name"}) — requires redisUrl in ductape initialization
|
|
789
797
|
databases.dispatch [{ product, env, database, action, input, schedule? }] ← CALL ductape_generate_payload FIRST (operation_family="database", method="dispatch", targets={database: "db_tag", table: "table_name"}) — requires redisUrl in ductape initialization
|
|
790
798
|
databases.beginTransaction [{ product, env, database, isolationLevel?: "READ_COMMITTED"|"REPEATABLE_READ"|"SERIALIZABLE" }]
|
|
@@ -2399,10 +2407,30 @@ DUCTAPE DATABASE PERFORMANCE GUIDANCE
|
|
|
2399
2407
|
actions: `
|
|
2400
2408
|
DUCTAPE DATABASE ACTIONS
|
|
2401
2409
|
|
|
2402
|
-
A database action is a saved query or mutation (
|
|
2403
|
-
on
|
|
2404
|
-
|
|
2405
|
-
|
|
2410
|
+
A database action is a saved, parameterized query or mutation template (with {{placeholder}}
|
|
2411
|
+
fields) stored on a database component and executed by tag at runtime. This is what
|
|
2412
|
+
ctx.database.query/insert/update/delete inside a Feature step actually calls via its
|
|
2413
|
+
\`event\` field — Features do NOT accept the top-level {table, where} shape that
|
|
2414
|
+
sdk.databases.query/insert/update use outside of a Feature.
|
|
2415
|
+
|
|
2416
|
+
Create/update/delete are ADMINISTRATIVE (access key) — FORBIDDEN through ductape_execute
|
|
2417
|
+
(publishable key). Use ductape_cli, same as every other admin resource:
|
|
2418
|
+
ductape_cli("db actions create -f action.json")
|
|
2419
|
+
File: { tag: "product:database:action", name, tableName,
|
|
2420
|
+
operation: "query"|"insert"|"update"|"delete"|"upsert"|"aggregate"|"rawSql",
|
|
2421
|
+
template: { where?, select?, limit?, offset?, orderBy?, records?, query?, params? },
|
|
2422
|
+
description?, filterTemplate? }
|
|
2423
|
+
tag MUST be fully qualified "product_tag:database_tag:action_tag" — the SDK's 2-part
|
|
2424
|
+
"database:action" shorthand only works inside one already-warm process, never a fresh CLI call.
|
|
2425
|
+
This is pure metadata registration — it does not connect to the live database, so the
|
|
2426
|
+
database does not need to be reachable at creation time.
|
|
2427
|
+
ductape_cli("db actions update --tag <tag> -f patch.json")
|
|
2428
|
+
ductape_cli("db actions delete <tag>")
|
|
2429
|
+
|
|
2430
|
+
List/fetch are read-only and safe via ductape_execute:
|
|
2431
|
+
ductape_execute("databases.action.fetchAll", ["product_tag:database_tag"])
|
|
2432
|
+
NOTE: the method is fetchAll — "action.list" is not a callable method on this sub-object.
|
|
2433
|
+
ductape_execute("databases.action.fetch", ["product_tag:database_tag:action_tag"])
|
|
2406
2434
|
|
|
2407
2435
|
Dispatch an action at runtime:
|
|
2408
2436
|
→ CALL ductape_generate_payload FIRST to get the canonical input shape.
|
|
@@ -2414,13 +2442,6 @@ Dispatch an action at runtime:
|
|
|
2414
2442
|
input: { status: "active" },
|
|
2415
2443
|
}])
|
|
2416
2444
|
|
|
2417
|
-
List actions for a database:
|
|
2418
|
-
ductape_execute("databases.action.list", ["database_tag"])
|
|
2419
|
-
|
|
2420
|
-
Fetch:
|
|
2421
|
-
ductape_execute("databases.action.fetch", ["action_tag"])
|
|
2422
|
-
Update/delete are administrative and must be performed in Workbench.
|
|
2423
|
-
|
|
2424
2445
|
Actions are the preferred way to encapsulate complex or reused queries — they can be
|
|
2425
2446
|
scheduled, dispatched with retries, and audited via logs.
|
|
2426
2447
|
`.trim(),
|
|
@@ -6146,24 +6167,33 @@ async function main() {
|
|
|
6146
6167
|
' - Atlas (MongoDB Atlas) import flow — service identifier is "atlas-cluster" (required, not optional):\n' +
|
|
6147
6168
|
' IMPORTANT: dbName is mandatory for every MongoDB env — see "MONGODB CLOUD CONNECTION RULE" in the\n' +
|
|
6148
6169
|
' databases module above. The SDK enforces this at create time; omitting it throws a validation error.\n' +
|
|
6170
|
+
' An existing Atlas cluster is NEVER a blocker. Atlas has no concept of provisioning a new cluster\n' +
|
|
6171
|
+
' per database — a MongoDB "database" is just a named namespace inside a cluster, created on first\n' +
|
|
6172
|
+
' write. Any number of database components may point at the SAME cluster (same cloud connection,\n' +
|
|
6173
|
+
' same resource/cluster name) as long as each uses a DIFFERENT dbName. Needing a new database on a\n' +
|
|
6174
|
+
' cluster that already has one imported is the normal path, not a conflict — do not stop or ask\n' +
|
|
6175
|
+
' the user to provision a new cluster; just import again with a different dbName.\n' +
|
|
6149
6176
|
' Step 1 — discover the cluster name:\n' +
|
|
6150
6177
|
' ductape_cli("cloud resources list -f /tmp/atlas-list.json --json")\n' +
|
|
6151
6178
|
' File: {"cloud": "<atlas-connection-tag>", "service": "atlas-cluster"}\n' +
|
|
6152
6179
|
' Returns a list of clusters; note the "name" field (this is your resource identifier).\n' +
|
|
6153
|
-
' Step 2 —
|
|
6180
|
+
' Step 2 — decide new database vs. repoint an existing one:\n' +
|
|
6154
6181
|
' ductape_cli("resources databases list <product_tag> --json")\n' +
|
|
6155
|
-
'
|
|
6156
|
-
'
|
|
6157
|
-
'
|
|
6158
|
-
'
|
|
6182
|
+
' Only skip importing when you want an EXISTING component (same product, env, and dbName) to\n' +
|
|
6183
|
+
' keep pointing at the same database — that is a repoint, not a new database, and should go\n' +
|
|
6184
|
+
' through ductape_cli resource update (or Workbench) instead of a fresh import.\n' +
|
|
6185
|
+
' Otherwise — including "same cluster, different database" — proceed to Step 3 with a new\n' +
|
|
6186
|
+
' component tag and a dbName distinct from every other component already on that cluster.\n' +
|
|
6187
|
+
' Step 3 — import (one entry per new database; reusing a cluster across components is expected):\n' +
|
|
6159
6188
|
' Use import-persist-all with one entry per product env. Required fields per entry:\n' +
|
|
6160
6189
|
' cloud (connection tag), service: "atlas-cluster", type: "databases",\n' +
|
|
6161
6190
|
' product, component (new tag), env, resource (cluster name from Step 1),\n' +
|
|
6162
|
-
' dbName (the MongoDB database name to connect to —
|
|
6163
|
-
' Example
|
|
6164
|
-
'
|
|
6191
|
+
' dbName (the MongoDB database name to connect to — must be unique per cluster, not per workspace).\n' +
|
|
6192
|
+
' Example — a second database ("billing-db") added to the same cluster as an existing "core-db":\n' +
|
|
6193
|
+
' [{"cloud":"atlas-tag","service":"atlas-cluster","type":"databases",\n' +
|
|
6194
|
+
' "product":"my-product","component":"billing-db","env":"snd","resource":"Cluster0","dbName":"billing_snd"},\n' +
|
|
6165
6195
|
' {"cloud":"atlas-tag","service":"atlas-cluster","type":"databases",\n' +
|
|
6166
|
-
' "product":"my-product","component":"
|
|
6196
|
+
' "product":"my-product","component":"billing-db","env":"prd","resource":"Cluster0","dbName":"billing_prd"}]\n' +
|
|
6167
6197
|
' - Message broker / event broker import:\n' +
|
|
6168
6198
|
' CLI accepts these aliases for the messageBrokers module: events, event, broker, brokers, message-brokers.\n' +
|
|
6169
6199
|
' List existing brokers: ductape_cli("resources events list --json")\n' +
|