@enfyra/mcp-server 0.1.22 → 0.1.24
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/lib/mcp-examples.js +10 -7
- package/dist/lib/mcp-examples.js.map +1 -1
- package/dist/lib/mcp-instructions.d.ts +0 -5
- package/dist/lib/mcp-instructions.js +14 -16
- package/dist/lib/mcp-instructions.js.map +1 -1
- package/dist/lib/required-knowledge.js +3 -0
- package/dist/lib/required-knowledge.js.map +1 -1
- package/dist/lib/table-tools.js +99 -21
- package/dist/lib/table-tools.js.map +1 -1
- package/dist/lib/tool-routing.js +1 -1
- package/dist/lib/tool-routing.js.map +1 -1
- package/dist/mcp-server-entry.js +10 -10
- package/dist/mcp-server-entry.js.map +1 -1
- package/package.json +1 -1
package/dist/lib/mcp-examples.js
CHANGED
|
@@ -618,6 +618,8 @@ create_records({
|
|
|
618
618
|
notes: [
|
|
619
619
|
'All mutation tools are plural envelopes. Pass native arrays, with one item in the array for a single mutation.',
|
|
620
620
|
'create_tables creates tables/columns first, then creates requested relations after all batch tables exist, so target table ordering is handled by the tool.',
|
|
621
|
+
'Do not declare id, _id, createdAt, or updatedAt columns; Enfyra manages them automatically.',
|
|
622
|
+
'When a unique/index group uses relation propertyName values, declare those relations in the same table item or add the constraint later with update_tables after the relations exist.',
|
|
621
623
|
'Use live column types from get_schema_design_context. Prefer float for decimal-like money/ratings unless live metadata explicitly supports decimal.',
|
|
622
624
|
'Do not create lookupId, owner_id, actorId, or recordIds scalar fields for normalized relationships. Use relations and write relation propertyName values.',
|
|
623
625
|
'A unique pair such as record+actor already creates the indexed unique lookup; keep those fields out of indexes.',
|
|
@@ -704,7 +706,7 @@ delete_columns({
|
|
|
704
706
|
code: `query_table({
|
|
705
707
|
tableName: "enfyra_user",
|
|
706
708
|
fields: ["id", "email"],
|
|
707
|
-
filter:
|
|
709
|
+
filter: { email: { _contains: "@example.com" } },
|
|
708
710
|
limit: 10
|
|
709
711
|
})`,
|
|
710
712
|
notes: [
|
|
@@ -752,10 +754,10 @@ GET /enfyra/post?filter={"<primaryKeyFromMetadata>":{"_eq":123}}&limit=1`,
|
|
|
752
754
|
fields: ["id"],
|
|
753
755
|
limit: 1,
|
|
754
756
|
meta: "filterCount",
|
|
755
|
-
filter:
|
|
757
|
+
filter: {
|
|
756
758
|
member: { id: { _eq: "<currentUserId>" } },
|
|
757
759
|
isRead: { _eq: false }
|
|
758
|
-
}
|
|
760
|
+
}
|
|
759
761
|
})`,
|
|
760
762
|
notes: [
|
|
761
763
|
'Use meta=totalCount with no filter and meta=filterCount with a filter.',
|
|
@@ -794,7 +796,7 @@ GET /enfyra/post?filter={"<primaryKeyFromMetadata>":{"_eq":123}}&limit=1`,
|
|
|
794
796
|
query_table({
|
|
795
797
|
tableName: "post",
|
|
796
798
|
fields: ["id", "-author.avatar"],
|
|
797
|
-
deep:
|
|
799
|
+
deep: {
|
|
798
800
|
comments: {
|
|
799
801
|
fields: "-compiledCode,-author.avatar",
|
|
800
802
|
limit: 10,
|
|
@@ -802,7 +804,7 @@ query_table({
|
|
|
802
804
|
author: { fields: "-avatar" }
|
|
803
805
|
}
|
|
804
806
|
}
|
|
805
|
-
}
|
|
807
|
+
}
|
|
806
808
|
})`,
|
|
807
809
|
notes: [
|
|
808
810
|
'Use fields=-compiledCode when reading script-backed records; sourceCode is the editable contract and compiledCode is generated by the server.',
|
|
@@ -816,7 +818,7 @@ query_table({
|
|
|
816
818
|
code: `query_table({
|
|
817
819
|
tableName: "order",
|
|
818
820
|
fields: ["id", "total"],
|
|
819
|
-
deep:
|
|
821
|
+
deep: {
|
|
820
822
|
items: {
|
|
821
823
|
fields: "id,quantity,product",
|
|
822
824
|
sort: "-createdAt",
|
|
@@ -825,7 +827,7 @@ query_table({
|
|
|
825
827
|
product: { fields: "id,name,price" }
|
|
826
828
|
}
|
|
827
829
|
}
|
|
828
|
-
}
|
|
830
|
+
}
|
|
829
831
|
})`,
|
|
830
832
|
notes: [
|
|
831
833
|
'Use deep when relation loading needs query options such as filter, sort, limit, page, or nested deep.',
|
|
@@ -836,6 +838,7 @@ query_table({
|
|
|
836
838
|
'Use query_table deep for normal MCP reads; use test_rest_endpoint only when you need a custom raw URL or route behavior test.',
|
|
837
839
|
'deep keys must be relation property names.',
|
|
838
840
|
'Allowed deep options are fields, filter, sort, limit, page, and deep.',
|
|
841
|
+
'Use fields, never _fields, inside deep relation options.',
|
|
839
842
|
'Do not invent deep keys like members unless members is a relation on that table.',
|
|
840
843
|
],
|
|
841
844
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-examples.js","sourceRoot":"","sources":["../../src/lib/mcp-examples.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,gNAAgN;IAChN,mLAAmL;IACnL,oJAAoJ;IACpJ,uOAAuO;IACvO,iPAAiP;CAClP,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,cAAc,EAAE;QACd,KAAK,EAAE,+CAA+C;QACtD,OAAO,EAAE,uNAAuN;QAChO,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,wCAAwC;gBAC9C,IAAI,EAAE;;;;;;;;;;;;GAYX;gBACK,KAAK,EAAE;oBACL,oFAAoF;oBACpF,wEAAwE;oBACxE,2DAA2D;iBAC5D;aACF;YACD;gBACE,IAAI,EAAE,sCAAsC;gBAC5C,IAAI,EAAE;;;;;;;;;;;;;;;0BAeY;gBAClB,KAAK,EAAE;oBACL,mCAAmC;oBACnC,2JAA2J;iBAC5J;aACF;YACD;gBACE,IAAI,EAAE,0CAA0C;gBAChD,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BZ;gBACM,KAAK,EAAE;oBACL,0FAA0F;oBAC1F,iFAAiF;oBACjF,8HAA8H;oBAC9H,kDAAkD;iBACnD;aACF;YACD;gBACE,IAAI,EAAE,uCAAuC;gBAC7C,IAAI,EAAE;;;;;;;;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are sent to the host model on connect.
|
|
3
|
-
* Keep this small: route the model to the right discovery/example tools and
|
|
4
|
-
* keep only contracts that must be known before any tool call.
|
|
5
|
-
*/
|
|
6
1
|
/** GraphQL SDL + HTTP endpoint are under the same base as REST. */
|
|
7
2
|
export declare function buildGraphqlUrls(apiBaseUrl: any): {
|
|
8
3
|
graphqlHttpUrl: string;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP server instructions are sent to the host model on connect.
|
|
3
|
-
* Keep this small: route the model to the right discovery/example tools and
|
|
4
|
-
* keep only contracts that must be known before any tool call.
|
|
5
|
-
*/
|
|
6
1
|
/** GraphQL SDL + HTTP endpoint are under the same base as REST. */
|
|
7
2
|
export function buildGraphqlUrls(apiBaseUrl) {
|
|
8
3
|
const base = String(apiBaseUrl || '').replace(/\/$/, '');
|
|
@@ -25,13 +20,13 @@ export function buildMcpServerInstructions(apiBaseUrl) {
|
|
|
25
20
|
'- When the task intent is clear but the right tool path is not, call `discover_enfyra_workflows` with the intent, risk, and optional surface. Use `detail: "plan"` before writes and follow `primaryPath` in order; do not choose from the flat tool list first.',
|
|
26
21
|
'- Discover before deciding. For architecture/capability questions call `discover_enfyra_system`; for DB/pk/runtime/cache context call `discover_runtime_context`; for filters/deep/sort/relation query shape call `discover_query_capabilities`. Run broad discovery tools sequentially, not in parallel.',
|
|
27
22
|
'- Inspect narrowly. Use `inspect_table`, `inspect_route`, `inspect_feature`, and DB-backed runtime zone tools for the table/route/feature/surface being changed instead of loading broad metadata.',
|
|
28
|
-
'- For DB-backed
|
|
23
|
+
'- For DB-backed artifacts, use `search_runtime_zone`: search first, then inspect with `nextInspect.input`.',
|
|
29
24
|
'- Load examples only when needed. Use `get_enfyra_examples` by category. Before extension UI, call `get_extension_theme_contract`; call `get_theme_class_reference` for exact eapp/Nuxt UI theme classes.',
|
|
30
25
|
'- For server scripts, call `discover_script_contexts` before writing or reviewing handler/hook/flow/websocket/GraphQL logic.',
|
|
31
|
-
'- Before mutating metadata
|
|
32
|
-
'- With non-root API tokens, call `get_permission_profile` before
|
|
26
|
+
'- Before mutating metadata/schema/routes/permissions/menus/packages/cache/code/extensions, call `get_enfyra_required_knowledge`; pass `globalRulesAckKey`, plus `dynamicCodeAckKey` or `extensionAckKey` where required.',
|
|
27
|
+
'- With non-root API tokens, call `get_permission_profile` before admin helper tools or 403 debugging.',
|
|
33
28
|
'- Prefer the most specific business operation tool over raw metadata CRUD. `discover_enfyra_workflows` provides the current operation-tool map and negative-routing avoidTools.',
|
|
34
|
-
'- Before saving standalone dynamic script code, call `validate_dynamic_script` unless the
|
|
29
|
+
'- Before saving standalone dynamic script code, call `validate_dynamic_script` or `/admin/script/validate` unless the write tool validates. For extensions, prefer atomic save tools; use `validate_extension_code` only for validation-only checks.',
|
|
35
30
|
'- Extension SFCs must use auto-injected components directly in templates, such as `<UButton>`, and must not call `resolveComponent()` for Nuxt UI/eApp components.',
|
|
36
31
|
'- For existing script-backed records, use `trace_metadata_usage` then `get_script_source`; edit with `patch_script_source` or `update_script_source` so source is hash-checked and validated.',
|
|
37
32
|
'- Validate behavior with `test_rest_endpoint`, `run_admin_test`, `test_flow_step`, or the route-specific tool before claiming a dynamic feature works.',
|
|
@@ -41,23 +36,26 @@ export function buildMcpServerInstructions(apiBaseUrl) {
|
|
|
41
36
|
'- `query_table`, `get_all_routes`, and `get_all_tables` require explicit intent: pass `limit` for bounded reads or `all: true` for a complete list. Do not invent arbitrary limits such as 30 or 50.',
|
|
42
37
|
'- Read tools are minimal by default. Pass explicit `fields`; use metadata inspection before guessing field/relation names. Field exclusion mode exists: `fields=-compiledCode`, and `fields=id,-compiledCode` still means all readable fields except `compiledCode`.',
|
|
43
38
|
'- Mutations return ids/status by default. Re-read with explicit `fields` only when saved shape matters.',
|
|
44
|
-
'- Mutation tools are plural-only. Pass native JSON arrays, using one-item arrays for single writes; tools preflight arrays and run sequentially.
|
|
39
|
+
'- Mutation tools are plural-only. Pass native JSON arrays, using one-item arrays for single writes; tools preflight arrays and run sequentially.',
|
|
40
|
+
'- For schema creation, do not declare `id`, `_id`, `createdAt`, or `updatedAt`; Enfyra manages them. `create_tables` strips them and reports `skippedAutoColumns`; `create_columns` rejects them.',
|
|
41
|
+
'- Relation-based indexes/uniques must reference relation `propertyName` values that exist on the same table. Put the owning relations in the same `create_tables` item for one-pass creation, or add relation-based uniques later with `update_tables` after relations exist.',
|
|
45
42
|
'- Dynamic repository reads use `filter`, not `where`: `@REPOS.table.find({ filter: {...} })`, `@REPOS.secure.table.find({ filter: {...} })`, `#table.find({ filter: {...} })`, and `exists(filter)`.',
|
|
46
|
-
'-
|
|
43
|
+
'- Use secure `@REPOS.main`/`@REPOS.secure.<table>` for user-facing data. Trusted `@REPOS.<table>` can see hidden fields; never return raw trusted rows.',
|
|
47
44
|
'- Secure repository choice is not a substitute for authorization. Handlers and hooks still need route access, owner/tenant filters, and explicit checks before returning or mutating records.',
|
|
48
45
|
'- Filters, sort helpers, counts, and aggregates over unpublished fields/private relations are sensitive data surfaces; do not expose them in user-facing endpoints.',
|
|
49
46
|
'- Use `enfyra_user` as the user table. Model record links as real relations using relation `propertyName` values, not physical FK fields like `userId`, `conversationId`, `senderId`, or `memberId` in generated DB code.',
|
|
50
47
|
'- Before schema/app generation, call `get_schema_design_context`; use live types and plural schema tools, not SQL guesses.',
|
|
51
|
-
'- Relation design
|
|
48
|
+
'- Relation design stays minimal: create owning relations first; add `inversePropertyName` only for a concrete response/UI/deep/aggregate/traversal need.',
|
|
52
49
|
'- Do not call internal/no-route system tables such as `enfyra_column` or `enfyra_session` through generic CRUD. Use table/column/relation tools and route-backed tables discovered from metadata.',
|
|
53
50
|
'- Custom API paths use `api_endpoint_workflow` when a handler is needed and the model should follow returned nextSteps. Use lower-level `create_route` without `mainTableId` only when intentionally creating a route shell; `create_tables` is only for new persisted data.',
|
|
54
51
|
'- For canonical table reads and RLS, preserve client-controlled query shape: do not override `@QUERY.fields`, `@QUERY.deep`, `@QUERY.sort`, `@QUERY.limit`, `@QUERY.page`, `@QUERY.meta`, `@QUERY.aggregate`, or `debugMode`. Merge only security filters into `@QUERY.filter`.',
|
|
55
|
-
'-
|
|
52
|
+
'- `query_table` accepts native object `filter`, `deep`, and `aggregate`; do not wrap them in `JSON.stringify` unless a legacy client forces strings. Deep relation options are `fields`, `filter`, `sort`, `limit`, `page`, and `deep`; never use `_fields`.',
|
|
53
|
+
'- If REST exposes `isPublished=false` fields via fields/deep, treat it as a core issue; confirm with `test_rest_endpoint` and do not hide it in frontend code.',
|
|
56
54
|
'- Script source is `sourceCode`; `compiledCode` is generated and may differ textually because macros expand. Do not warn about source/compiled mismatch unless validation or runtime behavior proves the compiled artifact is stale.',
|
|
57
55
|
'- For intentional user/domain errors in scripts use `@THROW400`-style helpers or `$ctx.$throw[...]`, not `throw new Error(...)`.',
|
|
58
56
|
'- Destructive operations are preview-first. Do not pass `confirm=true` until the user explicitly approves.',
|
|
59
57
|
'- Treat permission and security as the first design step for any route, handler, flow, extension, or data surface: decide public/private methods, authenticated route access, owner/tenant scope, and field exposure before writing feature logic.',
|
|
60
|
-
'-
|
|
58
|
+
'- Admin UI `usePermissions()` and backend RoleGuard use route permissions; use `audit_route_access`/`ensure_route_access`.',
|
|
61
59
|
'- Route permissions only let authenticated users reach the route after RoleGuard; handlers, hooks, or RLS must still enforce record ownership and tenant/project scope.',
|
|
62
60
|
'- Operator posture: act from these contracts plus live metadata. Do not turn expected implementation details into speculative warnings; ask only for new product/design decisions or genuine ambiguity.',
|
|
63
61
|
'',
|
|
@@ -67,12 +65,12 @@ export function buildMcpServerInstructions(apiBaseUrl) {
|
|
|
67
65
|
'- Socket.IO browser clients connect to the gateway namespace, e.g. `io("/chat", { path: "/socket.io", withCredentials: true })`, while the app proxies `/socket.io/**` to Enfyra `/ws/socket.io/**`.',
|
|
68
66
|
'',
|
|
69
67
|
'### Dynamic Script Surface',
|
|
70
|
-
'- Prefer macros
|
|
68
|
+
'- Prefer macros such as `@BODY`, `@QUERY`, `@USER`, `@REQ`, `@RES`, `@REPOS`, `@CACHE`, `@FETCH`, `@UPLOADED_FILE`, `@SOCKET`, `@ENV`, `@PKGS`, `@API`, `@THROW*`, `@FLOW*`, and `#table_name`. Call `discover_script_contexts` for exact per-surface availability.',
|
|
71
69
|
'- `@SOCKET.roomSize(room)` is available in the server socket helper. Bound websocket contexts also have `reply`, `join`, `leave`, `disconnect`, `emitToCurrentRoom`, and `broadcastToRoom`; HTTP/flow contexts only have global emit helpers plus `roomSize`.',
|
|
72
70
|
'',
|
|
73
71
|
'### Direct HTTP Mapping',
|
|
74
72
|
'- Route-backed table CRUD is REST: `GET /<table>?...`, `POST /<table>`, `PATCH /<table>/<id>`, `DELETE /<table>/<id>`. There is no `GET /<table>/<id>`; use a filtered list with `limit=1` or `find_one_record`.',
|
|
75
|
-
'- REST
|
|
73
|
+
'- REST lifecycle uses `enfyra_route.isEnabled`; use `enable_route`/`disable_route`. Public access uses `publicMethods`; otherwise use Bearer auth plus route permissions. GraphQL table data requires Bearer auth.',
|
|
76
74
|
'- Admin app page/menu paths such as `/cloud/projects/:id` are UI routes, not Enfyra API endpoints unless an enabled `enfyra_route.path` with the same path exists. Use `test_rest_endpoint` only for paths that are actual API routes under `ENFYRA_API_URL`; verify page extensions through the app URL/browser or by reading the extension/menu metadata.',
|
|
77
75
|
'',
|
|
78
76
|
'When the user asks for details, fetch only the relevant live context or example category instead of relying on broad memorized rules.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-instructions.js","sourceRoot":"","sources":["../../src/lib/mcp-instructions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mcp-instructions.js","sourceRoot":"","sources":["../../src/lib/mcp-instructions.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAAC,UAAU;IACzC,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE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ACrQ,+PAA+P;QAC/P,EAAE;QACF,yBAAyB;QACzB,kNAAkN;QAClN,oNAAoN;QACpN,6VAA6V;QAC7V,EAAE;QACF,uIAAuI;KACxI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -102,11 +102,14 @@ export function buildRequiredKnowledgePayload() {
|
|
|
102
102
|
'Then call get_enfyra_examples with category=schema-relations only for reasoning patterns, not for domain-specific table names.',
|
|
103
103
|
'Use plural mutation tools for writes: create_tables/update_tables/delete_tables, create_columns/update_columns/delete_columns, create_relations/delete_relations, and create_records/update_records/delete_records. Pass native JSON arrays; use one item in the array for a single mutation.',
|
|
104
104
|
'Create entity tables with scalar columns first, then add relations once target tables exist. create_tables defers relation creation until all tables in the same batch exist.',
|
|
105
|
+
'Do not declare id, _id, createdAt, or updatedAt columns; Enfyra manages them automatically.',
|
|
106
|
+
'For one-pass relation-based unique/index constraints, declare the owning relations in the same create_tables item as the constraints. If relations already exist or will be created separately, add those constraints afterward with update_tables.',
|
|
105
107
|
'Use live Enfyra column types, not SQL dialect names. Common safe choices: varchar for short text, text/richtext for long prose, float for price/amount/rating/decimal-like values, int/bigint for counts, boolean, date/datetime/timestamp, enum, simple-json for structured objects/arrays when listed by live metadata, and code for source fields.',
|
|
106
108
|
'Do not use json/jsonb/longtext/decimal unless the live enfyra_column.type enum lists them. The MCP schema tools normalize common aliases where possible and return schemaNormalization.',
|
|
107
109
|
'Use Enfyra relations instead of scalar FK/id columns for normalized links. Do not create fields such as userId, course_id, categoryIds, authorId, or JSON arrays of related ids unless the user explicitly asks for denormalized snapshots.',
|
|
108
110
|
'When inserting/updating records with relations, use relation propertyName values in the body, not hidden physical FK columns. Inspect the table to learn propertyName values.',
|
|
109
111
|
'For record writes, always use create_records/update_records/delete_records with native array inputs; these tools validate every item against live metadata before posting/patching/deleting sequentially.',
|
|
112
|
+
'For reads, query_table accepts native object filter/deep/aggregate values. Inside deep, use fields/filter/sort/limit/page/deep; never use _fields.',
|
|
110
113
|
'For table schema, a field that appears in any uniques group must not appear in indexes.',
|
|
111
114
|
'A unique constraint already creates the indexed unique lookup for its fields.',
|
|
112
115
|
'Use uniques for data integrity and indexes only for non-unique query-performance fields that are not already unique.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"required-knowledge.js","sourceRoot":"","sources":["../../src/lib/required-knowledge.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,oFAAoF,CAAC;AACzH,MAAM,CAAC,MAAM,8BAA8B,GAAG,2DAA2D,CAAC;AAC1G,MAAM,CAAC,MAAM,2BAA2B,GAAG,4DAA4D,CAAC;AAExG,MAAM,0BAA0B,GAAG,yCAAyC,CAAC;AAE7E,MAAM,UAAU,mBAAmB,CAAC,CAAC;IACnC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sKAAsK,CAAC,CAAC;AACrM,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,CAAC;IAC5C,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4KAA4K,CAAC,CAAC;AAC3M,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,CAAC;IAC1C,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mKAAmK,CAAC,CAAC;AAClM,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAG;IACtC,IAAI,GAAG,KAAK,oBAAoB,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,0KAA0K,CAAC,CAAC;IAC9L,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAAS,EAAE,GAAG;IACnD,IAAI,SAAS;QAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,GAAG;IAC/C,IAAI,GAAG,KAAK,8BAA8B,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,wLAAwL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;YACD;gBACE,EAAE,EAAE,6BAA6B;gBACjC,KAAK,EAAE;oBACL,6FAA6F;oBAC7F,6FAA6F;oBAC7F,qKAAqK;oBACrK,mKAAmK;iBACpK;aACF;YACD;gBACE,EAAE,EAAE,sBAAsB;gBAC1B,KAAK,EAAE;oBACL,6DAA6D;oBAC7D,mIAAmI;oBACnI,yCAAyC;oBACzC,8GAA8G;iBAC/G;aACF;SACF;QACD,UAAU,EAAE;YACV;gBACE,EAAE,EAAE,sBAAsB;gBAC1B,KAAK,EAAE;oBACL,qGAAqG;oBACrG,+FAA+F;oBAC/F,kGAAkG;oBAClG,2HAA2H;oBAC3H,0HAA0H;oBAC1H,6HAA6H;oBAC7H,yGAAyG;iBAC1G;aACF;YACD;gBACE,EAAE,EAAE,0BAA0B;gBAC9B,KAAK,EAAE;oBACL,yHAAyH;oBACzH,wFAAwF;oBACxF,oHAAoH;oBACpH,2HAA2H;oBAC3H,wHAAwH;iBACzH;aACF;YACD;gBACE,EAAE,EAAE,4BAA4B;gBAChC,KAAK,EAAE;oBACL,qGAAqG;oBACrG,kNAAkN;oBAClN,qFAAqF;oBACrF,uGAAuG;oBACvG,yGAAyG;oBACzG,4LAA4L;oBAC5L,8NAA8N;iBAC/N;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/lib/table-tools.js
CHANGED
|
@@ -6,7 +6,7 @@ import { fetchAPI } from './fetch.js';
|
|
|
6
6
|
import { jsonContent } from './response-format.js';
|
|
7
7
|
import { assertGlobalRulesAck, globalRulesAckParam } from './required-knowledge.js';
|
|
8
8
|
function bulkObjectArrayParam(z, label) {
|
|
9
|
-
return z.
|
|
9
|
+
return z.array(z.record(z.any())).describe(`${label} as a native JSON array of objects. Pass one object in the array for a single mutation.`);
|
|
10
10
|
}
|
|
11
11
|
let schemaQueue = Promise.resolve();
|
|
12
12
|
function withSchemaQueue(operation) {
|
|
@@ -44,6 +44,7 @@ const FALLBACK_COLUMN_TYPES = [
|
|
|
44
44
|
'richtext',
|
|
45
45
|
'float',
|
|
46
46
|
];
|
|
47
|
+
const AUTO_MANAGED_COLUMN_NAMES = new Set(['id', '_id', 'createdAt', 'updatedAt']);
|
|
47
48
|
const COLUMN_TYPE_ALIAS_HINTS = [
|
|
48
49
|
'Use varchar for short strings; text or richtext for long prose.',
|
|
49
50
|
'Use float for prices, money, percentages, ratings, and decimal-like numbers unless the live instance explicitly lists decimal.',
|
|
@@ -174,6 +175,58 @@ function normalizeConstraintGroupsValue(name, value) {
|
|
|
174
175
|
}
|
|
175
176
|
return normalizeConstraintGroups(name, parsed);
|
|
176
177
|
}
|
|
178
|
+
function stripAutoManagedColumns(columns) {
|
|
179
|
+
const skippedAutoColumns = [];
|
|
180
|
+
const filtered = columns.filter((column) => {
|
|
181
|
+
const name = String(column?.name ?? '');
|
|
182
|
+
if (!AUTO_MANAGED_COLUMN_NAMES.has(name))
|
|
183
|
+
return true;
|
|
184
|
+
skippedAutoColumns.push({
|
|
185
|
+
name,
|
|
186
|
+
reason: 'Enfyra manages id/createdAt/updatedAt automatically during table creation.',
|
|
187
|
+
});
|
|
188
|
+
return false;
|
|
189
|
+
});
|
|
190
|
+
return { columns: filtered, skippedAutoColumns };
|
|
191
|
+
}
|
|
192
|
+
function assertColumnNameCanBeCreated(name, context) {
|
|
193
|
+
const columnName = String(name ?? '');
|
|
194
|
+
if (AUTO_MANAGED_COLUMN_NAMES.has(columnName)) {
|
|
195
|
+
throw new Error(`${context} "${columnName}" is auto-managed by Enfyra. Do not create id, _id, createdAt, or updatedAt columns manually.`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function assertNoDuplicateFieldNames(fieldNames, context) {
|
|
199
|
+
const seen = new Set();
|
|
200
|
+
const duplicates = new Set();
|
|
201
|
+
for (const name of fieldNames.filter(Boolean)) {
|
|
202
|
+
if (seen.has(name))
|
|
203
|
+
duplicates.add(name);
|
|
204
|
+
seen.add(name);
|
|
205
|
+
}
|
|
206
|
+
if (duplicates.size > 0) {
|
|
207
|
+
throw new Error(`${context} has duplicate field name(s): ${[...duplicates].join(', ')}. Column names and relation propertyName values share one namespace.`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function preflightCreateTableDefinitions(items) {
|
|
211
|
+
items.forEach((item, index) => {
|
|
212
|
+
const columns = Array.isArray(item.columns) ? item.columns : parseJsonArrayParam(`items[${index}].columns`, item.columns || '[]');
|
|
213
|
+
const relations = Array.isArray(item.relations) ? item.relations : parseJsonArrayParam(`items[${index}].relations`, item.relations || '[]');
|
|
214
|
+
const { columns: userColumns } = stripAutoManagedColumns(columns);
|
|
215
|
+
const columnNames = userColumns.map((column) => String(column?.name ?? '')).filter(Boolean);
|
|
216
|
+
const relationNames = relations.map((relation) => String(relation?.propertyName ?? '')).filter(Boolean);
|
|
217
|
+
assertNoDuplicateFieldNames([...columnNames, ...relationNames], `create_tables items[${index}] (${item.name || '<unnamed>'})`);
|
|
218
|
+
const logicalFields = new Set([...AUTO_MANAGED_COLUMN_NAMES, ...columnNames, ...relationNames]);
|
|
219
|
+
const indexes = normalizeConstraintGroupsValue(`items[${index}].indexes`, item.indexes ?? []);
|
|
220
|
+
const uniques = normalizeConstraintGroupsValue(`items[${index}].uniques`, item.uniques ?? []);
|
|
221
|
+
const unknownConstraintFields = [...indexes, ...uniques]
|
|
222
|
+
.flat()
|
|
223
|
+
.filter((field) => !logicalFields.has(field));
|
|
224
|
+
if (unknownConstraintFields.length > 0) {
|
|
225
|
+
throw new Error(`create_tables items[${index}] (${item.name || '<unnamed>'}) has indexes/uniques referencing undeclared field(s): ${[...new Set(unknownConstraintFields)].join(', ')}. ` +
|
|
226
|
+
'Declare each field as a column or relation propertyName in the same table item. For relation-based unique pairs added after create, first create the relations, then call update_tables with the unique group.');
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
177
230
|
function splitRelationConstraintGroups(groups, relationNames) {
|
|
178
231
|
const immediate = [];
|
|
179
232
|
const deferred = [];
|
|
@@ -303,6 +356,11 @@ function parseColumnTypeOptions(options) {
|
|
|
303
356
|
.map((item) => item.trim().replace(/^"|"$/g, ''))
|
|
304
357
|
.filter(Boolean);
|
|
305
358
|
}
|
|
359
|
+
function normalizeColumnOptionsValue(options) {
|
|
360
|
+
if (options === undefined)
|
|
361
|
+
return undefined;
|
|
362
|
+
return typeof options === 'string' ? JSON.parse(options) : options;
|
|
363
|
+
}
|
|
306
364
|
export function getSupportedColumnTypesFromMetadata(metadata) {
|
|
307
365
|
const columnTable = normalizeTablesFromMetadata(metadata).find((table) => table?.name === 'enfyra_column');
|
|
308
366
|
const typeColumn = columnTable?.columns?.find((column) => column?.name === 'type');
|
|
@@ -452,7 +510,7 @@ export function buildColumnDefinition({ name, type, supportedTypes, isNullable,
|
|
|
452
510
|
if (description !== undefined)
|
|
453
511
|
column.description = description;
|
|
454
512
|
if (options !== undefined)
|
|
455
|
-
column.options =
|
|
513
|
+
column.options = normalizeColumnOptionsValue(options);
|
|
456
514
|
return column;
|
|
457
515
|
}
|
|
458
516
|
/**
|
|
@@ -472,6 +530,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
472
530
|
}
|
|
473
531
|
const supportedTypes = getSupportedColumnTypesFromMetadata(metadata);
|
|
474
532
|
const normalized = normalizeColumnTypeForLiveMetadata(args.type, supportedTypes);
|
|
533
|
+
assertColumnNameCanBeCreated(args.name, 'create_columns');
|
|
475
534
|
const existingColumns = getPatchableColumns(tableData.columns);
|
|
476
535
|
const beforeIds = existingColumns.map((column) => String(getId(column)));
|
|
477
536
|
const newCol = buildColumnDefinition({ ...args, supportedTypes });
|
|
@@ -494,10 +553,14 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
494
553
|
assertGlobalRulesAck(args.globalRulesAckKey);
|
|
495
554
|
return withSchemaQueue(async () => {
|
|
496
555
|
assertNoForbiddenRelationKeys(args);
|
|
497
|
-
const { sourceTableId, targetTableId, type, propertyName, inversePropertyName, mappedBy, isNullable, onDelete, description } = args;
|
|
556
|
+
const { sourceTableId, targetTableId, targetTable, type, propertyName, inversePropertyName, mappedBy, isNullable, onDelete, description } = args;
|
|
557
|
+
const targetRef = targetTableId ?? targetTable;
|
|
558
|
+
if (targetRef === undefined || targetRef === null || targetRef === '') {
|
|
559
|
+
throw new Error('create_relations requires targetTableId or targetTable. Pass an existing table id, name, or alias.');
|
|
560
|
+
}
|
|
498
561
|
const metadata = await fetchAPI(ENFYRA_API_URL, '/metadata');
|
|
499
562
|
const resolvedSourceTableId = resolveTableIdentifierFromMetadata(metadata, sourceTableId, 'sourceTableId');
|
|
500
|
-
const resolvedTargetTableId = resolveTableIdentifierFromMetadata(metadata,
|
|
563
|
+
const resolvedTargetTableId = resolveTableIdentifierFromMetadata(metadata, targetRef, 'targetTableId');
|
|
501
564
|
const tableData = await fetchTableWithDetails(ENFYRA_API_URL, resolvedSourceTableId);
|
|
502
565
|
if (!tableData) {
|
|
503
566
|
throw new Error(`Table ${sourceTableId} not found.`);
|
|
@@ -611,7 +674,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
611
674
|
}
|
|
612
675
|
const columnCreateSchema = {
|
|
613
676
|
tableId: z.string().describe('Table definition ID (from get_all_tables or create_tables).'),
|
|
614
|
-
name: z.string().describe('Column name (e.g., "title", "webhook_secret"). Lowercase with underscores.'),
|
|
677
|
+
name: z.string().describe('Column name (e.g., "title", "webhook_secret"). Lowercase with underscores. Do not create id, _id, createdAt, or updatedAt; Enfyra manages them automatically.'),
|
|
615
678
|
type: z.string().describe('Column type from the live enfyra_column.type enum. Common valid types are int, varchar, text, boolean, uuid, ObjectId, bigint, date, datetime, timestamp, enum, simple-json, code, array-select, richtext, and float. The tool normalizes common aliases before sending: decimal/numeric/money/number -> float when decimal is not live-supported, longtext -> text, json/jsonb/object/array -> simple-json when live-supported, string -> varchar. Prefer relations instead of *_id columns.'),
|
|
616
679
|
isNullable: z.boolean().optional().default(true).describe('Set to false if column cannot be null.'),
|
|
617
680
|
isUnique: z.boolean().optional().default(false).describe('Set to true for unique constraint.'),
|
|
@@ -623,12 +686,13 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
623
686
|
isSystem: z.boolean().optional().describe('Set true only for system-managed columns. Avoid for normal app fields.'),
|
|
624
687
|
defaultValue: z.string().optional().describe('Default value as JSON string or backend-supported literal.'),
|
|
625
688
|
description: z.string().optional().describe('Column description.'),
|
|
626
|
-
options: z.string().optional().describe('Column options as JSON string
|
|
689
|
+
options: z.union([z.array(z.string()), z.string()]).optional().describe('Column options as a native array such as ["draft","published"] or a JSON string for older clients.'),
|
|
627
690
|
globalRulesAckKey: globalRulesAckParam(z),
|
|
628
691
|
};
|
|
629
692
|
const relationCreateSchema = {
|
|
630
693
|
sourceTableId: z.string().describe('Source table id, exact table name, or alias. For many-to-one, this is the table that owns the relation property.'),
|
|
631
|
-
targetTableId: z.string().describe('Target table id, exact table name, or alias. MCP resolves names/aliases to ids before mutation.'),
|
|
694
|
+
targetTableId: z.string().optional().describe('Target table id, exact table name, or alias. MCP resolves names/aliases to ids before mutation. Optional when targetTable is provided.'),
|
|
695
|
+
targetTable: z.string().optional().describe('Alias for targetTableId when naturally using a target table name/alias such as enfyra_user. Optional when targetTableId is provided.'),
|
|
632
696
|
type: z.enum(['many-to-one', 'one-to-many', 'one-to-one', 'many-to-many']).describe('Relation type.'),
|
|
633
697
|
propertyName: z.string().describe('Property name on source table (e.g., "customer", "items").'),
|
|
634
698
|
inversePropertyName: z.string().optional().describe('Property name on target table for bidirectional relation (e.g., "orders"). Omit unless a concrete response, UI, deep query, aggregate sort/count, or parent-to-child traversal will use the reverse field. Do not add inverses merely because a parent table exists.'),
|
|
@@ -667,9 +731,14 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
667
731
|
const userColumns = arrayValue('columns', args.columns);
|
|
668
732
|
const metadata = await fetchAPI(ENFYRA_API_URL, '/metadata');
|
|
669
733
|
const supportedTypes = getSupportedColumnTypesFromMetadata(metadata);
|
|
670
|
-
const { columns:
|
|
734
|
+
const { columns: userColumnsWithoutAuto, skippedAutoColumns } = stripAutoManagedColumns(userColumns);
|
|
735
|
+
const { columns: normalizedUserColumns, normalizations } = normalizeColumnsForLiveMetadata(userColumnsWithoutAuto, supportedTypes);
|
|
671
736
|
const deferredRelations = arrayValue('relations', args.relations).map(normalizeRelationForTablePatch);
|
|
672
737
|
const relationNames = new Set(deferredRelations.map((relation) => relation.propertyName).filter(Boolean));
|
|
738
|
+
assertNoDuplicateFieldNames([
|
|
739
|
+
...normalizedUserColumns.map((column) => String(column.name || '')).filter(Boolean),
|
|
740
|
+
...deferredRelations.map((relation) => String(relation.propertyName || '')).filter(Boolean),
|
|
741
|
+
], `create_tables item "${args.name}"`);
|
|
673
742
|
const indexes = normalizeConstraintGroupsValue('indexes', args.indexes ?? []);
|
|
674
743
|
const uniques = normalizeConstraintGroupsValue('uniques', args.uniques ?? []);
|
|
675
744
|
assertIndexesDoNotReferenceUniqueFields(indexes, uniques);
|
|
@@ -707,6 +776,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
707
776
|
deferredConstraintCount: splitIndexes.deferred.length + splitUniques.deferred.length,
|
|
708
777
|
},
|
|
709
778
|
schemaNormalization: normalizations,
|
|
779
|
+
skippedAutoColumns,
|
|
710
780
|
schema: {
|
|
711
781
|
intended: {
|
|
712
782
|
tableName: args.name,
|
|
@@ -847,7 +917,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
847
917
|
if (description !== undefined)
|
|
848
918
|
rest.description = description;
|
|
849
919
|
if (options !== undefined)
|
|
850
|
-
rest.options =
|
|
920
|
+
rest.options = normalizeColumnOptionsValue(options);
|
|
851
921
|
}
|
|
852
922
|
return rest;
|
|
853
923
|
});
|
|
@@ -935,7 +1005,9 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
935
1005
|
cascadeFields: ['columns', 'relations'],
|
|
936
1006
|
constraintFields: ['indexes', 'uniques'],
|
|
937
1007
|
notAcceptedAtCreate: ['alias', 'graphqlEnabled'],
|
|
1008
|
+
autoManagedColumns: ['id', 'createdAt', 'updatedAt'],
|
|
938
1009
|
idColumn: 'create_tables auto-includes an int id primary key; do not include your own id unless the user asks for custom primary-key behavior.',
|
|
1010
|
+
reservedColumnRule: 'Do not declare id, _id, createdAt, or updatedAt in create_tables/create_columns. create_tables strips them before save and reports skippedAutoColumns; create_columns rejects them.',
|
|
939
1011
|
},
|
|
940
1012
|
columnDefinitionInput: {
|
|
941
1013
|
allowedFields: ['name', 'type', 'isNullable', 'isUnique', 'isPublished', 'isUpdatable', 'isEncrypted', 'defaultValue', 'description', 'options'],
|
|
@@ -955,7 +1027,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
955
1027
|
aliasNormalization: 'Schema tools normalize common aliases where possible and return schemaNormalization, but models should choose from liveTypes directly.',
|
|
956
1028
|
},
|
|
957
1029
|
relationDefinitionInput: {
|
|
958
|
-
allowedFields: ['targetTable', 'type', 'propertyName', 'inversePropertyName', 'mappedBy', 'isNullable', 'onDelete', 'description'],
|
|
1030
|
+
allowedFields: ['targetTableId', 'targetTable', 'type', 'propertyName', 'inversePropertyName', 'mappedBy', 'isNullable', 'onDelete', 'description'],
|
|
959
1031
|
relationTypes: relationTypes.length ? relationTypes : ['many-to-one', 'one-to-many', 'one-to-one', 'many-to-many'],
|
|
960
1032
|
onDeleteOptions: onDeleteOptions.length ? onDeleteOptions : ['CASCADE', 'SET NULL', 'RESTRICT'],
|
|
961
1033
|
forbiddenPhysicalFields: FORBIDDEN_RELATION_KEYS,
|
|
@@ -965,14 +1037,17 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
965
1037
|
indexes: 'JSON array of non-unique logical field groups, e.g. [["status","createdAt"]]. Relation propertyName values are allowed.',
|
|
966
1038
|
uniques: 'JSON array of unique logical field groups, e.g. [["record","actor"]].',
|
|
967
1039
|
uniqueIndexRule: 'Any field in uniques must not appear in indexes because unique constraints already create indexed lookups.',
|
|
1040
|
+
createTablesPreflight: 'create_tables rejects constraints that reference fields not declared as scalar columns, auto-managed columns, or relation propertyName values in that same table item before it creates anything.',
|
|
1041
|
+
relationBasedUniques: 'For one-pass schema creation, put the owning relations in the same create_tables item as the relation-based unique group. If relations already exist, add relation-based uniques later with update_tables.',
|
|
968
1042
|
},
|
|
969
1043
|
recommendedSequence: [
|
|
970
1044
|
'1. Name domain entities and decide which existing tables are reused, especially enfyra_user for users/owners/actors.',
|
|
971
1045
|
'2. Create independent lookup/base tables first with scalar columns only.',
|
|
972
1046
|
'3. Create dependent tables with scalar columns and relations whose target tables already exist.',
|
|
973
1047
|
'4. Use create_relations after both tables exist when a relation could not be included during table creation.',
|
|
974
|
-
'5.
|
|
975
|
-
'6.
|
|
1048
|
+
'5. Add relation-based unique groups in the same create_tables item when the relations are declared there, or via update_tables after relations exist.',
|
|
1049
|
+
'6. Insert records using column names and relation propertyName values, never hidden FK columns.',
|
|
1050
|
+
'7. Re-inspect each table with inspect_table before writing records or adding query examples.',
|
|
976
1051
|
],
|
|
977
1052
|
liveMetadataAttributes: {
|
|
978
1053
|
enfyra_table: tableAttributes,
|
|
@@ -983,9 +1058,11 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
983
1058
|
});
|
|
984
1059
|
// ─── TABLE MUTATIONS ───
|
|
985
1060
|
server.tool('create_tables', [
|
|
986
|
-
'Create one or more table definitions. Always pass items as a native JSON array; for one table, pass one item.
|
|
1061
|
+
'Create one or more table definitions. Always pass items as a native JSON array; for one table, pass one item.',
|
|
987
1062
|
'The tool creates tables sequentially, creates columns with each table, then creates all requested relations after every table in the batch exists. This avoids relation target races for weak agents.',
|
|
988
1063
|
'Each item supports { name, description?, isSingleRecord?, columns?, relations?, indexes?, uniques? }. columns/relations/indexes/uniques may be arrays inside the item.',
|
|
1064
|
+
'Do not include id, _id, createdAt, or updatedAt in columns; Enfyra manages them and create_tables strips them before save.',
|
|
1065
|
+
'Every field named in indexes/uniques must be a scalar column, auto-managed column, or relation propertyName in the same table item; otherwise the tool rejects the whole batch before creating tables.',
|
|
989
1066
|
'Use get_schema_design_context first for live column types and relation rules. Do not include physical FK fields.',
|
|
990
1067
|
].join(' '), {
|
|
991
1068
|
items: bulkObjectArrayParam(z, 'Table definitions').optional().describe('Native JSON array of table definitions. Pass one object in the array for a single table.'),
|
|
@@ -998,6 +1075,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
998
1075
|
throw new Error('Pass either items or tables to create_tables, not both.');
|
|
999
1076
|
const parsedItems = parseBulkItemsParam('items', items ?? tables);
|
|
1000
1077
|
assertBulkLimit('create_tables', parsedItems, maxItems);
|
|
1078
|
+
preflightCreateTableDefinitions(parsedItems);
|
|
1001
1079
|
const created = [];
|
|
1002
1080
|
const deferredRelations = [];
|
|
1003
1081
|
const deferredConstraints = [];
|
|
@@ -1056,7 +1134,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
1056
1134
|
appliedDeferredConstraints,
|
|
1057
1135
|
});
|
|
1058
1136
|
});
|
|
1059
|
-
server.tool('update_tables', 'Update one or more table definitions. Always pass items as a native JSON array; for one table, pass one item. Items run sequentially through the schema queue.
|
|
1137
|
+
server.tool('update_tables', 'Update one or more table definitions. Always pass items as a native JSON array; for one table, pass one item. Items run sequentially through the schema queue.', {
|
|
1060
1138
|
items: bulkObjectArrayParam(z, 'Table update items').describe('Native JSON array of table update items: [{ tableId, name?, alias?, description?, isSingleRecord?, graphqlEnabled?, indexes?, uniques? }]. indexes/uniques may be arrays.'),
|
|
1061
1139
|
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100.'),
|
|
1062
1140
|
globalRulesAckKey: globalRulesAckParam(z),
|
|
@@ -1073,7 +1151,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
1073
1151
|
}
|
|
1074
1152
|
return jsonContent({ action: 'tables_updated', requested: parsedItems.length, updatedCount: updated.length, sequential: true, updated });
|
|
1075
1153
|
});
|
|
1076
|
-
server.tool('delete_tables', 'Delete one or more table definitions. Always pass items as a native JSON array; for one table, pass one item. confirm=false previews every target; confirm=true deletes sequentially.
|
|
1154
|
+
server.tool('delete_tables', 'Delete one or more table definitions. Always pass items as a native JSON array; for one table, pass one item. confirm=false previews every target; confirm=true deletes sequentially.', {
|
|
1077
1155
|
items: bulkObjectArrayParam(z, 'Table delete items').describe('Native JSON array of delete items: [{ tableId }].'),
|
|
1078
1156
|
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100.'),
|
|
1079
1157
|
confirm: z.boolean().optional().default(false).describe('Required true to apply destructive deletes. Omit/false returns previews only.'),
|
|
@@ -1100,7 +1178,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
1100
1178
|
});
|
|
1101
1179
|
});
|
|
1102
1180
|
// ─── COLUMN MUTATIONS ───
|
|
1103
|
-
server.tool('create_columns', 'Create one or more columns. Always pass items as a native JSON array; for one column, pass one item. Items run sequentially through the schema queue.
|
|
1181
|
+
server.tool('create_columns', 'Create one or more columns. Always pass items as a native JSON array; for one column, pass one item. Items run sequentially through the schema queue.', {
|
|
1104
1182
|
items: bulkObjectArrayParam(z, 'Column definitions').optional().describe('Native JSON array of column definitions. Each item uses create_columns fields: { tableId, name, type, isNullable?, isUnique?, isPublished?, isUpdatable?, isEncrypted?, isPrimary?, isGenerated?, isSystem?, defaultValue?, description?, options? }.'),
|
|
1105
1183
|
columns: bulkObjectArrayParam(z, 'Column definitions').optional().describe('Alias for items when the caller naturally names the batch columns. Pass either items or columns, not both.'),
|
|
1106
1184
|
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100.'),
|
|
@@ -1118,7 +1196,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
1118
1196
|
}
|
|
1119
1197
|
return jsonContent({ action: 'columns_created', requested: parsedItems.length, createdCount: created.length, sequential: true, created });
|
|
1120
1198
|
});
|
|
1121
|
-
server.tool('update_columns', 'Update one or more columns. Always pass items as a native JSON array; for one column, pass one item. Items run sequentially through the schema queue.
|
|
1199
|
+
server.tool('update_columns', 'Update one or more columns. Always pass items as a native JSON array; for one column, pass one item. Items run sequentially through the schema queue.', {
|
|
1122
1200
|
items: bulkObjectArrayParam(z, 'Column update items').describe('Native JSON array of column update items: [{ tableId, columnId, name?, type?, isNullable?, isPublished?, isUpdatable?, defaultValue?, description?, options? }].'),
|
|
1123
1201
|
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100.'),
|
|
1124
1202
|
globalRulesAckKey: globalRulesAckParam(z),
|
|
@@ -1137,7 +1215,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
1137
1215
|
}
|
|
1138
1216
|
return jsonContent({ action: 'columns_updated', requested: parsedItems.length, updatedCount: updated.length, sequential: true, updated });
|
|
1139
1217
|
});
|
|
1140
|
-
server.tool('delete_columns', 'Delete one or more columns. Always pass items as a native JSON array; for one column, pass one item. confirm=false previews every target; confirm=true deletes sequentially.
|
|
1218
|
+
server.tool('delete_columns', 'Delete one or more columns. Always pass items as a native JSON array; for one column, pass one item. confirm=false previews every target; confirm=true deletes sequentially.', {
|
|
1141
1219
|
items: bulkObjectArrayParam(z, 'Column delete items').describe('Native JSON array of delete items: [{ tableId, columnId }].'),
|
|
1142
1220
|
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100.'),
|
|
1143
1221
|
confirm: z.boolean().optional().default(false).describe('Required true to apply destructive deletes. Omit/false returns previews only.'),
|
|
@@ -1166,8 +1244,8 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
1166
1244
|
});
|
|
1167
1245
|
});
|
|
1168
1246
|
// ─── RELATION MUTATIONS ───
|
|
1169
|
-
server.tool('create_relations', 'Create one or more relations. Always pass items as a native JSON array; for one relation, pass one item. Items run sequentially through the schema queue and table names/aliases are resolved internally.
|
|
1170
|
-
items: bulkObjectArrayParam(z, 'Relation definitions').optional().describe('Native JSON array of relation definitions. Each item uses { sourceTableId, targetTableId, type, propertyName, inversePropertyName?, mappedBy?, isNullable?, onDelete?, description? }. Do not send physical FK fields.'),
|
|
1247
|
+
server.tool('create_relations', 'Create one or more relations. Always pass items as a native JSON array; for one relation, pass one item. Items run sequentially through the schema queue and table names/aliases are resolved internally.', {
|
|
1248
|
+
items: bulkObjectArrayParam(z, 'Relation definitions').optional().describe('Native JSON array of relation definitions. Each item uses { sourceTableId, targetTableId or targetTable, type, propertyName, inversePropertyName?, mappedBy?, isNullable?, onDelete?, description? }. Do not send physical FK fields.'),
|
|
1171
1249
|
relations: bulkObjectArrayParam(z, 'Relation definitions').optional().describe('Alias for items when the caller naturally names the batch relations. Pass either items or relations, not both.'),
|
|
1172
1250
|
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100.'),
|
|
1173
1251
|
globalRulesAckKey: globalRulesAckParam(z),
|
|
@@ -1184,7 +1262,7 @@ export function registerTableTools(server, ENFYRA_API_URL) {
|
|
|
1184
1262
|
}
|
|
1185
1263
|
return jsonContent({ action: 'relations_created', requested: parsedItems.length, createdCount: created.length, sequential: true, created });
|
|
1186
1264
|
});
|
|
1187
|
-
server.tool('delete_relations', 'Delete one or more relations. Always pass items as a native JSON array; for one relation, pass one item. confirm=false previews every target; confirm=true deletes sequentially.
|
|
1265
|
+
server.tool('delete_relations', 'Delete one or more relations. Always pass items as a native JSON array; for one relation, pass one item. confirm=false previews every target; confirm=true deletes sequentially.', {
|
|
1188
1266
|
items: bulkObjectArrayParam(z, 'Relation delete items').describe('Native JSON array of delete items: [{ tableId, relationId }].'),
|
|
1189
1267
|
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100.'),
|
|
1190
1268
|
confirm: z.boolean().optional().default(false).describe('Required true to apply destructive deletes. Omit/false returns previews only.'),
|