@enfyra/mcp-server 0.1.69 → 0.1.71
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 +1 -1
- package/dist/lib/config-local-adapters.d.ts +18 -0
- package/dist/lib/config-local-adapters.js +271 -0
- package/dist/lib/config-local-adapters.js.map +1 -0
- package/dist/lib/config-local-contracts.d.ts +28 -0
- package/dist/lib/config-local-contracts.js +200 -0
- package/dist/lib/config-local-contracts.js.map +1 -0
- package/dist/lib/config-local-prompts.d.ts +10 -0
- package/dist/lib/config-local-prompts.js +185 -0
- package/dist/lib/config-local-prompts.js.map +1 -0
- package/dist/lib/config-local-types.d.ts +23 -0
- package/dist/lib/config-local-types.js +2 -0
- package/dist/lib/config-local-types.js.map +1 -0
- package/dist/lib/config-local.js +3 -649
- package/dist/lib/config-local.js.map +1 -1
- package/dist/lib/discovery-tools.d.ts +4 -0
- package/dist/lib/discovery-tools.js +546 -0
- package/dist/lib/discovery-tools.js.map +1 -0
- package/dist/lib/dynamic-repository-builder.d.ts +1 -1
- package/dist/lib/dynamic-script-context-contract.d.ts +100 -0
- package/dist/lib/dynamic-script-context-contract.js +163 -0
- package/dist/lib/dynamic-script-context-contract.js.map +1 -0
- package/dist/lib/enfyra-mcp-server.d.ts +3 -0
- package/dist/lib/enfyra-mcp-server.js +79 -0
- package/dist/lib/enfyra-mcp-server.js.map +1 -0
- package/dist/lib/enfyra-tool-logic.d.ts +7 -0
- package/dist/lib/enfyra-tool-logic.js +8 -0
- package/dist/lib/enfyra-tool-logic.js.map +1 -0
- package/dist/lib/enfyra-tool-types.d.ts +27 -0
- package/dist/lib/enfyra-tool-types.js +2 -0
- package/dist/lib/enfyra-tool-types.js.map +1 -0
- package/dist/lib/extension-api-builders.d.ts +17 -0
- package/dist/lib/extension-api-builders.js +235 -0
- package/dist/lib/extension-api-builders.js.map +1 -0
- package/dist/lib/extension-component-builders.d.ts +87 -0
- package/dist/lib/extension-component-builders.js +623 -0
- package/dist/lib/extension-component-builders.js.map +1 -0
- package/dist/lib/extension-contract-review.d.ts +26 -0
- package/dist/lib/extension-contract-review.js +187 -0
- package/dist/lib/extension-contract-review.js.map +1 -0
- package/dist/lib/extension-theme-contract.d.ts +63 -0
- package/dist/lib/extension-theme-contract.js +417 -0
- package/dist/lib/extension-theme-contract.js.map +1 -0
- package/dist/lib/identity-tools.d.ts +4 -0
- package/dist/lib/identity-tools.js +46 -0
- package/dist/lib/identity-tools.js.map +1 -0
- package/dist/lib/log-tools.d.ts +4 -0
- package/dist/lib/log-tools.js +65 -0
- package/dist/lib/log-tools.js.map +1 -0
- package/dist/lib/mcp-example-connect.d.ts +9 -0
- package/dist/lib/mcp-example-connect.js +442 -0
- package/dist/lib/mcp-example-connect.js.map +1 -0
- package/dist/lib/mcp-example-extensions.d.ts +9 -0
- package/dist/lib/mcp-example-extensions.js +729 -0
- package/dist/lib/mcp-example-extensions.js.map +1 -0
- package/dist/lib/mcp-example-files.d.ts +9 -0
- package/dist/lib/mcp-example-files.js +51 -0
- package/dist/lib/mcp-example-files.js.map +1 -0
- package/dist/lib/mcp-example-flows.d.ts +9 -0
- package/dist/lib/mcp-example-flows.js +76 -0
- package/dist/lib/mcp-example-flows.js.map +1 -0
- package/dist/lib/mcp-example-graphql.d.ts +9 -0
- package/dist/lib/mcp-example-graphql.js +57 -0
- package/dist/lib/mcp-example-graphql.js.map +1 -0
- package/dist/lib/mcp-example-handlers-hooks.d.ts +9 -0
- package/dist/lib/mcp-example-handlers-hooks.js +328 -0
- package/dist/lib/mcp-example-handlers-hooks.js.map +1 -0
- package/dist/lib/mcp-example-oauth-setup.d.ts +9 -0
- package/dist/lib/mcp-example-oauth-setup.js +41 -0
- package/dist/lib/mcp-example-oauth-setup.js.map +1 -0
- package/dist/lib/mcp-example-permissions-rls.d.ts +9 -0
- package/dist/lib/mcp-example-permissions-rls.js +210 -0
- package/dist/lib/mcp-example-permissions-rls.js.map +1 -0
- package/dist/lib/mcp-example-queries-deep.d.ts +9 -0
- package/dist/lib/mcp-example-queries-deep.js +220 -0
- package/dist/lib/mcp-example-queries-deep.js.map +1 -0
- package/dist/lib/mcp-example-schema-relations.d.ts +9 -0
- package/dist/lib/mcp-example-schema-relations.js +148 -0
- package/dist/lib/mcp-example-schema-relations.js.map +1 -0
- package/dist/lib/mcp-example-websocket.d.ts +9 -0
- package/dist/lib/mcp-example-websocket.js +103 -0
- package/dist/lib/mcp-example-websocket.js.map +1 -0
- package/dist/lib/mcp-examples.d.ts +5 -5
- package/dist/lib/mcp-examples.js +22 -2394
- package/dist/lib/mcp-examples.js.map +1 -1
- package/dist/lib/method-tools.d.ts +4 -0
- package/dist/lib/method-tools.js +217 -0
- package/dist/lib/method-tools.js.map +1 -0
- package/dist/lib/package-tools.d.ts +4 -0
- package/dist/lib/package-tools.js +98 -0
- package/dist/lib/package-tools.js.map +1 -0
- package/dist/lib/platform-data-operations.d.ts +24 -0
- package/dist/lib/platform-data-operations.js +71 -0
- package/dist/lib/platform-data-operations.js.map +1 -0
- package/dist/lib/platform-endpoint-workflow.d.ts +42 -0
- package/dist/lib/platform-endpoint-workflow.js +382 -0
- package/dist/lib/platform-endpoint-workflow.js.map +1 -0
- package/dist/lib/platform-extension-source.d.ts +487 -0
- package/dist/lib/platform-extension-source.js +524 -0
- package/dist/lib/platform-extension-source.js.map +1 -0
- package/dist/lib/platform-extension-tools.d.ts +1 -0
- package/dist/lib/platform-extension-tools.js +416 -0
- package/dist/lib/platform-extension-tools.js.map +1 -0
- package/dist/lib/platform-extension-ui.d.ts +4 -0
- package/dist/lib/platform-extension-ui.js +5 -0
- package/dist/lib/platform-extension-ui.js.map +1 -0
- package/dist/lib/platform-extension-workflow.d.ts +54 -0
- package/dist/lib/platform-extension-workflow.js +194 -0
- package/dist/lib/platform-extension-workflow.js.map +1 -0
- package/dist/lib/platform-flow-operations.d.ts +554 -0
- package/dist/lib/platform-flow-operations.js +317 -0
- package/dist/lib/platform-flow-operations.js.map +1 -0
- package/dist/lib/platform-flow-tools.d.ts +1 -0
- package/dist/lib/platform-flow-tools.js +248 -0
- package/dist/lib/platform-flow-tools.js.map +1 -0
- package/dist/lib/platform-operation-logic.d.ts +10 -0
- package/dist/lib/platform-operation-logic.js +11 -0
- package/dist/lib/platform-operation-logic.js.map +1 -0
- package/dist/lib/platform-operation-tools.d.ts +1 -324
- package/dist/lib/platform-operation-tools.js +13 -4620
- package/dist/lib/platform-operation-tools.js.map +1 -1
- package/dist/lib/platform-operation-types.d.ts +46 -0
- package/dist/lib/platform-operation-types.js +2 -0
- package/dist/lib/platform-operation-types.js.map +1 -0
- package/dist/lib/platform-policy-tools.d.ts +1 -0
- package/dist/lib/platform-policy-tools.js +248 -0
- package/dist/lib/platform-policy-tools.js.map +1 -0
- package/dist/lib/platform-resource-operations.d.ts +124 -0
- package/dist/lib/platform-resource-operations.js +109 -0
- package/dist/lib/platform-resource-operations.js.map +1 -0
- package/dist/lib/platform-resource-tools.d.ts +1 -0
- package/dist/lib/platform-resource-tools.js +70 -0
- package/dist/lib/platform-resource-tools.js.map +1 -0
- package/dist/lib/platform-route-operations.d.ts +222 -0
- package/dist/lib/platform-route-operations.js +290 -0
- package/dist/lib/platform-route-operations.js.map +1 -0
- package/dist/lib/platform-route-tools.d.ts +1 -0
- package/dist/lib/platform-route-tools.js +307 -0
- package/dist/lib/platform-route-tools.js.map +1 -0
- package/dist/lib/platform-shared-operations.d.ts +7 -0
- package/dist/lib/platform-shared-operations.js +4 -0
- package/dist/lib/platform-shared-operations.js.map +1 -0
- package/dist/lib/platform-websocket-tools.d.ts +1 -0
- package/dist/lib/platform-websocket-tools.js +70 -0
- package/dist/lib/platform-websocket-tools.js.map +1 -0
- package/dist/lib/record-tools.d.ts +4 -0
- package/dist/lib/record-tools.js +418 -0
- package/dist/lib/record-tools.js.map +1 -0
- package/dist/lib/required-knowledge.d.ts +1 -1
- package/dist/lib/required-knowledge.js +3 -2
- package/dist/lib/required-knowledge.js.map +1 -1
- package/dist/lib/route-access-tools.d.ts +4 -0
- package/dist/lib/route-access-tools.js +172 -0
- package/dist/lib/route-access-tools.js.map +1 -0
- package/dist/lib/route-definition-tools.d.ts +4 -0
- package/dist/lib/route-definition-tools.js +285 -0
- package/dist/lib/route-definition-tools.js.map +1 -0
- package/dist/lib/route-inspection-tools.d.ts +4 -0
- package/dist/lib/route-inspection-tools.js +319 -0
- package/dist/lib/route-inspection-tools.js.map +1 -0
- package/dist/lib/route-tools.d.ts +1 -0
- package/dist/lib/route-tools.js +9 -0
- package/dist/lib/route-tools.js.map +1 -0
- package/dist/lib/runtime-zone-registry.d.ts +27 -0
- package/dist/lib/runtime-zone-registry.js +81 -0
- package/dist/lib/runtime-zone-registry.js.map +1 -0
- package/dist/lib/runtime-zone-search.d.ts +303 -0
- package/dist/lib/runtime-zone-search.js +596 -0
- package/dist/lib/runtime-zone-search.js.map +1 -0
- package/dist/lib/runtime-zone-tools.d.ts +2 -307
- package/dist/lib/runtime-zone-tools.js +2 -674
- package/dist/lib/runtime-zone-tools.js.map +1 -1
- package/dist/lib/schema-column-tools.d.ts +3 -0
- package/dist/lib/schema-column-tools.js +80 -0
- package/dist/lib/schema-column-tools.js.map +1 -0
- package/dist/lib/schema-mutation-coordinator.d.ts +28 -0
- package/dist/lib/schema-mutation-coordinator.js +154 -0
- package/dist/lib/schema-mutation-coordinator.js.map +1 -0
- package/dist/lib/schema-relation-contracts.d.ts +39 -0
- package/dist/lib/schema-relation-contracts.js +160 -0
- package/dist/lib/schema-relation-contracts.js.map +1 -0
- package/dist/lib/schema-relation-tools.d.ts +3 -0
- package/dist/lib/schema-relation-tools.js +61 -0
- package/dist/lib/schema-relation-tools.js.map +1 -0
- package/dist/lib/schema-table-contracts.d.ts +28 -0
- package/dist/lib/schema-table-contracts.js +263 -0
- package/dist/lib/schema-table-contracts.js.map +1 -0
- package/dist/lib/schema-table-tools.d.ts +3 -0
- package/dist/lib/schema-table-tools.js +297 -0
- package/dist/lib/schema-table-tools.js.map +1 -0
- package/dist/lib/schema-tool-operations.d.ts +150 -0
- package/dist/lib/schema-tool-operations.js +468 -0
- package/dist/lib/schema-tool-operations.js.map +1 -0
- package/dist/lib/schema-tool-types.d.ts +38 -0
- package/dist/lib/schema-tool-types.js +2 -0
- package/dist/lib/schema-tool-types.js.map +1 -0
- package/dist/lib/schema-verification.d.ts +14 -0
- package/dist/lib/schema-verification.js +105 -0
- package/dist/lib/schema-verification.js.map +1 -0
- package/dist/lib/script-tools.d.ts +4 -0
- package/dist/lib/script-tools.js +127 -0
- package/dist/lib/script-tools.js.map +1 -0
- package/dist/lib/system-tools.d.ts +4 -0
- package/dist/lib/system-tools.js +41 -0
- package/dist/lib/system-tools.js.map +1 -0
- package/dist/lib/table-tool-logic.d.ts +5 -0
- package/dist/lib/table-tool-logic.js +6 -0
- package/dist/lib/table-tool-logic.js.map +1 -0
- package/dist/lib/table-tools.d.ts +1 -84
- package/dist/lib/table-tools.js +7 -1522
- package/dist/lib/table-tools.js.map +1 -1
- package/dist/lib/tool-catalog.d.ts +2 -1
- package/dist/lib/tool-catalog.js +23 -2
- package/dist/lib/tool-catalog.js.map +1 -1
- package/dist/lib/tool-metadata-operations.d.ts +27 -0
- package/dist/lib/tool-metadata-operations.js +93 -0
- package/dist/lib/tool-metadata-operations.js.map +1 -0
- package/dist/lib/tool-permission-profile.d.ts +37 -0
- package/dist/lib/tool-permission-profile.js +106 -0
- package/dist/lib/tool-permission-profile.js.map +1 -0
- package/dist/lib/tool-record-operations.d.ts +102 -0
- package/dist/lib/tool-record-operations.js +260 -0
- package/dist/lib/tool-record-operations.js.map +1 -0
- package/dist/lib/tool-route-inspection.d.ts +47 -0
- package/dist/lib/tool-route-inspection.js +168 -0
- package/dist/lib/tool-route-inspection.js.map +1 -0
- package/dist/lib/tool-routing.d.ts +3 -417
- package/dist/lib/tool-routing.js +3 -1038
- package/dist/lib/tool-routing.js.map +1 -1
- package/dist/lib/tool-runtime-config.d.ts +33 -0
- package/dist/lib/tool-runtime-config.js +237 -0
- package/dist/lib/tool-runtime-config.js.map +1 -0
- package/dist/lib/tool-script-operations.d.ts +34 -0
- package/dist/lib/tool-script-operations.js +153 -0
- package/dist/lib/tool-script-operations.js.map +1 -0
- package/dist/lib/workflow-definitions.d.ts +366 -0
- package/dist/lib/workflow-definitions.js +703 -0
- package/dist/lib/workflow-definitions.js.map +1 -0
- package/dist/lib/workflow-planner.d.ts +45 -0
- package/dist/lib/workflow-planner.js +338 -0
- package/dist/lib/workflow-planner.js.map +1 -0
- package/dist/lib/workflow-types.d.ts +39 -0
- package/dist/lib/workflow-types.js +2 -0
- package/dist/lib/workflow-types.js.map +1 -0
- package/dist/mcp-server-entry.d.ts +0 -3
- package/dist/mcp-server-entry.js +2 -3249
- package/dist/mcp-server-entry.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table & Column tools for Enfyra MCP Server
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { fetchMetadataContext, fetchTableCatalog, fetchTableMetadata, } from './metadata-client.js';
|
|
6
|
+
import { jsonContent } from './response-format.js';
|
|
7
|
+
import { assertGlobalRulesAck, globalRulesAckParam } from './required-knowledge.js';
|
|
8
|
+
import { FORBIDDEN_RELATION_KEYS, assertBulkLimit, bulkObjectArrayParam, computeBatchCleanupOrder, getId, getSupportedColumnTypesFromMetadata, metadataColumnNames, metadataColumnOptions, normalizeCreateTableDefinitions, normalizeRelationType, parseBulkItemsParam, preflightCreateTableDefinitions, withSchemaQueue, } from './table-tool-logic.js';
|
|
9
|
+
import { createSchemaToolOperations } from './schema-tool-operations.js';
|
|
10
|
+
export function registerSchemaTableTools(server, ENFYRA_API_URL, options = {}) {
|
|
11
|
+
const toolset = options.toolset || 'guided';
|
|
12
|
+
const apiBase = ENFYRA_API_URL.replace(/\/$/, '');
|
|
13
|
+
const { appendRelationToTable, applyDeferredConstraints, createOneTable, deleteOneTable, updateOneTable, } = createSchemaToolOperations(ENFYRA_API_URL, toolset);
|
|
14
|
+
// ─── READ ───
|
|
15
|
+
server.tool('get_all_tables', 'List table definitions from metadata. Complete lists must pass either limit or all=true. If search is provided without limit, the tool returns a bounded lookup window of 10 matches.', {
|
|
16
|
+
limit: z.number().int().positive().optional().describe('Maximum tables returned after search. Required unless all=true or search is provided.'),
|
|
17
|
+
all: z.boolean().optional().describe('Return all matched tables. Use this when a complete table list is required.'),
|
|
18
|
+
search: z.string().optional().describe('Optional table name, alias, or description substring filter.'),
|
|
19
|
+
}, async ({ limit, all, search }) => {
|
|
20
|
+
if (!all && limit === undefined && !search?.trim()) {
|
|
21
|
+
throw new Error('get_all_tables requires either limit or all=true. Do not invent arbitrary limits for complete table lists; use all=true.');
|
|
22
|
+
}
|
|
23
|
+
if (all && limit !== undefined) {
|
|
24
|
+
throw new Error('get_all_tables accepts either all=true or limit, not both.');
|
|
25
|
+
}
|
|
26
|
+
const catalog = await fetchTableCatalog(ENFYRA_API_URL);
|
|
27
|
+
const needle = search?.trim().toLowerCase();
|
|
28
|
+
const tables = catalog
|
|
29
|
+
.map((table) => ({
|
|
30
|
+
id: getId(table),
|
|
31
|
+
name: table.name ?? null,
|
|
32
|
+
alias: table.alias ?? null,
|
|
33
|
+
description: table.description ?? null,
|
|
34
|
+
isSingleRecord: table.isSingleRecord ?? null,
|
|
35
|
+
columnCount: null,
|
|
36
|
+
relationCount: null,
|
|
37
|
+
routeBacked: null,
|
|
38
|
+
}))
|
|
39
|
+
.filter((table) => {
|
|
40
|
+
if (!needle)
|
|
41
|
+
return true;
|
|
42
|
+
return [table.name, table.alias, table.description]
|
|
43
|
+
.some((value) => String(value || '').toLowerCase().includes(needle));
|
|
44
|
+
});
|
|
45
|
+
const effectiveLimit = all ? tables.length : (limit ?? 10);
|
|
46
|
+
const returnedTables = all ? tables : tables.slice(0, effectiveLimit);
|
|
47
|
+
return jsonContent({
|
|
48
|
+
action: 'get_all_tables',
|
|
49
|
+
totalTableCount: catalog.length,
|
|
50
|
+
matchedTableCount: tables.length,
|
|
51
|
+
returnedTableCount: returnedTables.length,
|
|
52
|
+
all: Boolean(all),
|
|
53
|
+
implicitSearchLimit: Boolean(!all && limit === undefined && search?.trim()),
|
|
54
|
+
hardCap: all ? null : effectiveLimit,
|
|
55
|
+
search: search || null,
|
|
56
|
+
tables: returnedTables,
|
|
57
|
+
detailHint: 'Use inspect_table with a table id/name for columns, relations, indexes, routes, permissions, and GraphQL state.',
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
server.tool('get_schema_design_context', [
|
|
61
|
+
'Step-zero schema design guide for Enfyra table creation.',
|
|
62
|
+
'Call this before creating a new app schema or multiple tables.',
|
|
63
|
+
'It returns live column types, supported metadata attributes, relation types, constraint shape, and the exact creation sequence so the model does not guess SQL types or physical FK fields.',
|
|
64
|
+
].join(' '), {}, async () => {
|
|
65
|
+
const [metadataContext, tableMetadata, columnMetadata, relationMetadata] = await Promise.all([
|
|
66
|
+
fetchMetadataContext(ENFYRA_API_URL),
|
|
67
|
+
fetchTableMetadata(ENFYRA_API_URL, 'enfyra_table'),
|
|
68
|
+
fetchTableMetadata(ENFYRA_API_URL, 'enfyra_column'),
|
|
69
|
+
fetchTableMetadata(ENFYRA_API_URL, 'enfyra_relation'),
|
|
70
|
+
]);
|
|
71
|
+
const liveColumnTypes = getSupportedColumnTypesFromMetadata(columnMetadata);
|
|
72
|
+
const relationTypes = metadataColumnOptions(relationMetadata, 'enfyra_relation', 'type');
|
|
73
|
+
const onDeleteOptions = metadataColumnOptions(relationMetadata, 'enfyra_relation', 'onDelete');
|
|
74
|
+
const tableAttributes = metadataColumnNames(tableMetadata, 'enfyra_table');
|
|
75
|
+
const columnAttributes = metadataColumnNames(columnMetadata, 'enfyra_column');
|
|
76
|
+
const relationAttributes = metadataColumnNames(relationMetadata, 'enfyra_relation');
|
|
77
|
+
const primaryColumnNames = [metadataContext.dbType === 'mongodb' ? '_id' : 'id'];
|
|
78
|
+
const primaryColumnTypes = [metadataContext.dbType === 'mongodb' ? 'ObjectId' : 'int'];
|
|
79
|
+
return jsonContent({
|
|
80
|
+
action: 'schema_design_context',
|
|
81
|
+
stepZero: 'Read this response before create_tables/create_columns/create_relations. Use these live attributes and types, not SQL dialect guesses.',
|
|
82
|
+
liveColumnTypes,
|
|
83
|
+
primaryKeyContext: {
|
|
84
|
+
observedPrimaryColumnNames: primaryColumnNames,
|
|
85
|
+
observedPrimaryColumnTypes: primaryColumnTypes,
|
|
86
|
+
createTableDefault: metadataContext.dbType === 'mongodb'
|
|
87
|
+
? 'create_tables auto-includes the Mongo _id/ObjectId primary key.'
|
|
88
|
+
: 'create_tables auto-includes the SQL id/int primary key.',
|
|
89
|
+
},
|
|
90
|
+
createTableInput: {
|
|
91
|
+
directFields: ['name', 'description', 'isSingleRecord'],
|
|
92
|
+
cascadeFields: ['columns', 'relations'],
|
|
93
|
+
constraintFields: ['indexes', 'uniques'],
|
|
94
|
+
notAcceptedAtCreate: ['alias', 'graphqlEnabled'],
|
|
95
|
+
autoManagedColumns: ['id', 'createdAt', 'updatedAt'],
|
|
96
|
+
idColumn: metadataContext.dbType === 'mongodb'
|
|
97
|
+
? 'create_tables auto-includes _id/ObjectId; do not include your own primary key.'
|
|
98
|
+
: 'create_tables auto-includes id/int; do not include your own primary key.',
|
|
99
|
+
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.',
|
|
100
|
+
},
|
|
101
|
+
columnDefinitionInput: {
|
|
102
|
+
allowedFields: ['name', 'type', 'isNullable', 'isUnique', 'isPublished', 'isUpdatable', 'isEncrypted', 'defaultValue', 'description', 'options'],
|
|
103
|
+
liveTypes: liveColumnTypes,
|
|
104
|
+
typeSelection: [
|
|
105
|
+
'varchar: short text, labels, slugs, status strings.',
|
|
106
|
+
'text/richtext: long prose.',
|
|
107
|
+
'float: prices, amounts, ratings, percentages, decimal-like numbers unless liveTypes contains decimal.',
|
|
108
|
+
'int/bigint: counts, ordering, integer quantities.',
|
|
109
|
+
'boolean: true/false flags.',
|
|
110
|
+
'date/datetime/timestamp: temporal fields.',
|
|
111
|
+
'enum: constrained option strings when options are provided.',
|
|
112
|
+
'simple-json: structured snapshots/arrays only when liveTypes contains simple-json.',
|
|
113
|
+
'code: source-code fields.',
|
|
114
|
+
],
|
|
115
|
+
forbiddenGuesses: ['json', 'jsonb', 'longtext', 'decimal'].filter((type) => !liveColumnTypes.includes(type)),
|
|
116
|
+
aliasNormalization: 'Schema tools normalize common aliases where possible and return schemaNormalization, but models should choose from liveTypes directly.',
|
|
117
|
+
namespaceRule: 'Column names and relation propertyName values share one table namespace. Do not define a scalar column and a relation with the same name in one table.',
|
|
118
|
+
},
|
|
119
|
+
relationDefinitionInput: {
|
|
120
|
+
allowedFields: ['targetTableId', 'targetTable', 'type', 'propertyName', 'inversePropertyName', 'mappedBy', 'isNullable', 'onDelete', 'description'],
|
|
121
|
+
relationTypes: relationTypes.length ? relationTypes : ['many-to-one', 'one-to-many', 'one-to-one', 'many-to-many'],
|
|
122
|
+
onDeleteOptions: onDeleteOptions.length ? onDeleteOptions : ['CASCADE', 'SET NULL', 'RESTRICT'],
|
|
123
|
+
forbiddenPhysicalFields: FORBIDDEN_RELATION_KEYS,
|
|
124
|
+
rule: 'Use relations for links between records. Do not create scalar FK columns such as userId, owner_id, categoryIds, or courseId unless the user explicitly wants denormalized snapshot data.',
|
|
125
|
+
namespaceRule: 'Relation propertyName must be unique among both relation names and scalar column names on the same table. If a relation is named owner, do not also create ownerId/owner as a scalar field.',
|
|
126
|
+
inverseDesignRule: 'If a parent detail/read must deep-load a child collection (for example application.reviewAssignments or assignment.scorecards), create the owning child many-to-one relation with inversePropertyName immediately. Without the inverse, parent-to-child deep reads will fail with unknown relation.',
|
|
127
|
+
},
|
|
128
|
+
constraints: {
|
|
129
|
+
indexes: 'JSON array of non-unique logical field groups, e.g. [["status","createdAt"]]. Relation propertyName values are allowed.',
|
|
130
|
+
uniques: 'JSON array of unique logical field groups, e.g. [["record","actor"]].',
|
|
131
|
+
uniqueIndexRule: 'Any field that appears in any uniques group, including composite unique groups such as ["event","attendee"], must not appear in indexes because unique constraints already create indexed lookups for their fields.',
|
|
132
|
+
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.',
|
|
133
|
+
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.',
|
|
134
|
+
},
|
|
135
|
+
recommendedSequence: [
|
|
136
|
+
'1. Name domain entities and decide which existing tables are reused, especially enfyra_user for users/owners/actors.',
|
|
137
|
+
'2. Create independent lookup/base tables first with scalar columns only.',
|
|
138
|
+
'3. Create dependent tables with scalar columns and relations whose target tables already exist.',
|
|
139
|
+
'4. Use create_relations after both tables exist when a relation could not be included during table creation.',
|
|
140
|
+
'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.',
|
|
141
|
+
'6. Before deep parent detail queries, confirm every child collection relation exists as an inversePropertyName on the owning child relation.',
|
|
142
|
+
'7. Insert records using column names and relation propertyName values, never hidden FK columns.',
|
|
143
|
+
'8. Re-inspect each table with inspect_table before writing records or adding query examples.',
|
|
144
|
+
],
|
|
145
|
+
liveMetadataAttributes: {
|
|
146
|
+
enfyra_table: tableAttributes,
|
|
147
|
+
enfyra_column: columnAttributes,
|
|
148
|
+
enfyra_relation: relationAttributes,
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
// ─── TABLE MUTATIONS ───
|
|
153
|
+
server.tool('create_tables', [
|
|
154
|
+
'Create one or more table definitions. Always pass items as a native JSON array; for one table, pass one item.',
|
|
155
|
+
'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.',
|
|
156
|
+
'Each item supports { name, description?, isSingleRecord?, columns?, relations?, indexes?, uniques? }. columns/relations/indexes/uniques may be arrays inside the item.',
|
|
157
|
+
'Do not include id, _id, createdAt, or updatedAt in columns; Enfyra manages them and create_tables strips them before save.',
|
|
158
|
+
'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.',
|
|
159
|
+
'Use get_schema_design_context first for live column types and relation rules. Do not include physical FK fields.',
|
|
160
|
+
'The response includes cleanupHints.recordCreateOrder; use it when seeding records so parent/target rows are created before child/source rows.',
|
|
161
|
+
'The response includes cleanupHints.recordDeleteOrder; use it when deleting seeded test records so child/source rows are removed before parent/target rows.',
|
|
162
|
+
].join(' '), {
|
|
163
|
+
items: bulkObjectArrayParam(z, 'Table definitions').optional().describe('Native JSON array of table definitions. Pass one object in the array for a single table.'),
|
|
164
|
+
tables: bulkObjectArrayParam(z, 'Table definitions').optional().describe('Alias for items when the caller naturally names the batch tables. Pass either items or tables, not both.'),
|
|
165
|
+
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100; operations still run sequentially.'),
|
|
166
|
+
globalRulesAckKey: globalRulesAckParam(z),
|
|
167
|
+
}, async ({ items, tables, maxItems, globalRulesAckKey }) => {
|
|
168
|
+
assertGlobalRulesAck(globalRulesAckKey);
|
|
169
|
+
if (items !== undefined && tables !== undefined)
|
|
170
|
+
throw new Error('Pass either items or tables to create_tables, not both.');
|
|
171
|
+
const parsedItems = normalizeCreateTableDefinitions(parseBulkItemsParam('items', items ?? tables));
|
|
172
|
+
assertBulkLimit('create_tables', parsedItems, maxItems);
|
|
173
|
+
preflightCreateTableDefinitions(parsedItems);
|
|
174
|
+
const recordDeleteOrder = computeBatchCleanupOrder(parsedItems);
|
|
175
|
+
const created = [];
|
|
176
|
+
const deferredRelations = [];
|
|
177
|
+
const deferredConstraints = [];
|
|
178
|
+
for (const [index, item] of parsedItems.entries()) {
|
|
179
|
+
const result = await withSchemaQueue(() => createOneTable(item));
|
|
180
|
+
created.push({ index, ...result, deferredRelations: undefined });
|
|
181
|
+
for (const relation of result.deferredRelations || []) {
|
|
182
|
+
deferredRelations.push({ index, sourceTableId: result.table.id || result.table.name, ...relation });
|
|
183
|
+
}
|
|
184
|
+
if ((result.deferredConstraints?.indexes || []).length || (result.deferredConstraints?.uniques || []).length) {
|
|
185
|
+
deferredConstraints.push({
|
|
186
|
+
index,
|
|
187
|
+
tableId: result.table.id || result.table.name,
|
|
188
|
+
...result.deferredConstraints,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const createdRelations = [];
|
|
193
|
+
deferredRelations.sort((left, right) => {
|
|
194
|
+
const leftPriority = normalizeRelationType(left.type) === 'one-to-many' ? 1 : 0;
|
|
195
|
+
const rightPriority = normalizeRelationType(right.type) === 'one-to-many' ? 1 : 0;
|
|
196
|
+
return leftPriority - rightPriority;
|
|
197
|
+
});
|
|
198
|
+
for (const relation of deferredRelations) {
|
|
199
|
+
const relationResult = await appendRelationToTable({
|
|
200
|
+
sourceTableId: relation.sourceTableId,
|
|
201
|
+
targetTableId: relation.targetTable,
|
|
202
|
+
type: relation.type,
|
|
203
|
+
propertyName: relation.propertyName,
|
|
204
|
+
inversePropertyName: relation.inversePropertyName,
|
|
205
|
+
mappedBy: relation.mappedBy,
|
|
206
|
+
isNullable: relation.isNullable,
|
|
207
|
+
onDelete: relation.onDelete,
|
|
208
|
+
description: relation.description,
|
|
209
|
+
globalRulesAckKey,
|
|
210
|
+
});
|
|
211
|
+
createdRelations.push({ index: relation.index, ...JSON.parse(relationResult.content[0].text) });
|
|
212
|
+
}
|
|
213
|
+
const appliedDeferredConstraints = [];
|
|
214
|
+
for (const constraints of deferredConstraints) {
|
|
215
|
+
const constraintResult = await withSchemaQueue(() => applyDeferredConstraints(constraints.tableId, {
|
|
216
|
+
indexes: constraints.indexes,
|
|
217
|
+
uniques: constraints.uniques,
|
|
218
|
+
}));
|
|
219
|
+
if (constraintResult)
|
|
220
|
+
appliedDeferredConstraints.push({ index: constraints.index, ...constraintResult });
|
|
221
|
+
}
|
|
222
|
+
return jsonContent({
|
|
223
|
+
action: 'tables_created',
|
|
224
|
+
requested: parsedItems.length,
|
|
225
|
+
createdCount: created.length,
|
|
226
|
+
deferredRelationCount: deferredRelations.length,
|
|
227
|
+
createdRelationCount: createdRelations.length,
|
|
228
|
+
deferredConstraintCount: deferredConstraints.length,
|
|
229
|
+
appliedDeferredConstraintCount: appliedDeferredConstraints.length,
|
|
230
|
+
sequential: true,
|
|
231
|
+
relationPhaseAfterTables: true,
|
|
232
|
+
constraintPhaseAfterRelations: true,
|
|
233
|
+
cleanupHints: {
|
|
234
|
+
recordCreateOrder: [...recordDeleteOrder].reverse(),
|
|
235
|
+
recordDeleteOrder,
|
|
236
|
+
tableDeleteOrder: recordDeleteOrder,
|
|
237
|
+
recordCreateRule: 'When seeding sample data, create records sequentially in recordCreateOrder; parent/target rows must exist before child/source rows reference them.',
|
|
238
|
+
recordRule: 'If you delete seeded records before deleting test tables, delete record batches sequentially in recordDeleteOrder; do not parallelize parent/child deletes.',
|
|
239
|
+
tableRule: 'For full test cleanup, prefer delete_tables with tableDeleteOrder after deleting custom routes/flows; table deletion removes the remaining table data.',
|
|
240
|
+
},
|
|
241
|
+
created: toolset === 'full' ? created : created.map(({ result, supportedColumnTypes, schema, ...item }) => ({
|
|
242
|
+
...item,
|
|
243
|
+
schema: {
|
|
244
|
+
intended: schema?.intended,
|
|
245
|
+
liveMetadataAvailable: schema?.liveMetadataAvailable,
|
|
246
|
+
liveMetadataError: schema?.liveMetadataError,
|
|
247
|
+
},
|
|
248
|
+
})),
|
|
249
|
+
createdRelations: toolset === 'full' ? createdRelations : createdRelations.map(({ result, responseFormat, ...item }) => item),
|
|
250
|
+
appliedDeferredConstraints: toolset === 'full' ? appliedDeferredConstraints : appliedDeferredConstraints.map(({ result, ...item }) => item),
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
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.', {
|
|
254
|
+
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.'),
|
|
255
|
+
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100.'),
|
|
256
|
+
globalRulesAckKey: globalRulesAckParam(z),
|
|
257
|
+
}, async ({ items, maxItems, globalRulesAckKey }) => {
|
|
258
|
+
assertGlobalRulesAck(globalRulesAckKey);
|
|
259
|
+
const parsedItems = parseBulkItemsParam('items', items);
|
|
260
|
+
assertBulkLimit('update_tables', parsedItems, maxItems);
|
|
261
|
+
const updated = [];
|
|
262
|
+
for (const [index, item] of parsedItems.entries()) {
|
|
263
|
+
if (!item.tableId)
|
|
264
|
+
throw new Error(`items[${index}].tableId is required.`);
|
|
265
|
+
const result = await withSchemaQueue(() => updateOneTable(item));
|
|
266
|
+
updated.push({ index, ...result });
|
|
267
|
+
}
|
|
268
|
+
return jsonContent({ action: 'tables_updated', requested: parsedItems.length, updatedCount: updated.length, sequential: true, updated });
|
|
269
|
+
});
|
|
270
|
+
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.', {
|
|
271
|
+
items: bulkObjectArrayParam(z, 'Table delete items').describe('Native JSON array of delete items: [{ tableId }] or [{ tableName }]. Names are resolved through live metadata before preview/delete.'),
|
|
272
|
+
maxItems: z.number().int().min(1).max(100).optional().default(100).describe('Safety cap for one schema batch. Default/max is 100.'),
|
|
273
|
+
confirm: z.boolean().optional().default(false).describe('Required true to apply destructive deletes. Omit/false returns previews only.'),
|
|
274
|
+
globalRulesAckKey: globalRulesAckParam(z).optional().describe('Required when confirm=true. Use globalRulesAckKey from get_enfyra_required_knowledge.'),
|
|
275
|
+
}, async ({ items, maxItems, confirm, globalRulesAckKey }) => {
|
|
276
|
+
const parsedItems = parseBulkItemsParam('items', items);
|
|
277
|
+
assertBulkLimit('delete_tables', parsedItems, maxItems);
|
|
278
|
+
if (confirm)
|
|
279
|
+
assertGlobalRulesAck(globalRulesAckKey);
|
|
280
|
+
const results = [];
|
|
281
|
+
for (const [index, item] of parsedItems.entries()) {
|
|
282
|
+
if (!item.tableId && !item.tableName)
|
|
283
|
+
throw new Error(`items[${index}] requires tableId or tableName.`);
|
|
284
|
+
const result = await withSchemaQueue(() => deleteOneTable({ tableId: item.tableId, tableName: item.tableName, confirm }));
|
|
285
|
+
results.push({ index, ...result });
|
|
286
|
+
}
|
|
287
|
+
return jsonContent({
|
|
288
|
+
action: confirm ? 'tables_deleted' : 'delete_tables_preview',
|
|
289
|
+
requested: parsedItems.length,
|
|
290
|
+
sequential: true,
|
|
291
|
+
destructive: true,
|
|
292
|
+
results,
|
|
293
|
+
next: confirm ? undefined : 'Call delete_tables again with the same items and confirm=true to delete sequentially.',
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=schema-table-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-table-tools.js","sourceRoot":"","sources":["../../src/lib/schema-table-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEpF,OAAO,EAEL,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,EACL,mCAAmC,EACnC,mBAAmB,EACnB,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,mBAAmB,EACnB,+BAA+B,EAC/B,eAAe,GAChB,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O;YAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QACrD,MAAM,OAAO,GAAgB,EAAE,CAAC;QAChC,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;YAClD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,kCAAkC,CAAC,CAAC;YACxG,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YAC1H,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,WAAW,CAAC;YACjB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,uBAAuB;YAC5D,SAAS,EAAE,WAAW,CAAC,MAAM;YAC7B,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,IAAI;YACjB,OAAO;YACP,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,uFAAuF;SACpH,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { AnyRecord, RelationPatch } from './table-tool-logic.js';
|
|
2
|
+
export declare function createSchemaToolOperations(ENFYRA_API_URL: any, toolset: any): {
|
|
3
|
+
appendColumnToTable: (args: any) => Promise<import("./types.js").ToolResult>;
|
|
4
|
+
appendRelationToTable: (args: any) => Promise<import("./types.js").ToolResult>;
|
|
5
|
+
applyDeferredConstraints: (tableId: any, deferredConstraints: any) => Promise<{
|
|
6
|
+
action: string;
|
|
7
|
+
tableId: any;
|
|
8
|
+
tableName: any;
|
|
9
|
+
requested: {
|
|
10
|
+
indexes: any;
|
|
11
|
+
uniques: any;
|
|
12
|
+
};
|
|
13
|
+
applied: {
|
|
14
|
+
indexes: any[][];
|
|
15
|
+
uniques: any[][];
|
|
16
|
+
};
|
|
17
|
+
prunedExistingIndexes: import("./schema-tool-types.js").ConstraintGroup[];
|
|
18
|
+
result: any;
|
|
19
|
+
}>;
|
|
20
|
+
arrayValue: (name: any, value: any) => any[];
|
|
21
|
+
createOneTable: (args: any) => Promise<{
|
|
22
|
+
action: string;
|
|
23
|
+
table: {
|
|
24
|
+
id: any;
|
|
25
|
+
name: any;
|
|
26
|
+
routePath: string;
|
|
27
|
+
};
|
|
28
|
+
summary: {
|
|
29
|
+
columnCount: number;
|
|
30
|
+
createdColumnCount: number;
|
|
31
|
+
deferredRelationCount: number;
|
|
32
|
+
indexGroupCount: number;
|
|
33
|
+
uniqueGroupCount: number;
|
|
34
|
+
deferredConstraintCount: number;
|
|
35
|
+
};
|
|
36
|
+
schemaNormalization: ({
|
|
37
|
+
column: string;
|
|
38
|
+
from: string;
|
|
39
|
+
to: string;
|
|
40
|
+
} | {
|
|
41
|
+
field: string;
|
|
42
|
+
from: any;
|
|
43
|
+
to: any;
|
|
44
|
+
reason: string;
|
|
45
|
+
})[];
|
|
46
|
+
skippedAutoColumns: {
|
|
47
|
+
name: string;
|
|
48
|
+
reason: string;
|
|
49
|
+
}[];
|
|
50
|
+
schema: {
|
|
51
|
+
intended: {
|
|
52
|
+
tableName: any;
|
|
53
|
+
primaryKey: string;
|
|
54
|
+
fields: any[];
|
|
55
|
+
columns: any[];
|
|
56
|
+
relations: string[];
|
|
57
|
+
};
|
|
58
|
+
live: {
|
|
59
|
+
tableName: any;
|
|
60
|
+
primaryKey: any;
|
|
61
|
+
fields: any[];
|
|
62
|
+
columns: any;
|
|
63
|
+
relations: any;
|
|
64
|
+
};
|
|
65
|
+
liveMetadataAvailable: boolean;
|
|
66
|
+
liveMetadataError: any;
|
|
67
|
+
};
|
|
68
|
+
supportedColumnTypes: string[];
|
|
69
|
+
rest: {
|
|
70
|
+
base: any;
|
|
71
|
+
routePath: string;
|
|
72
|
+
operations: string[];
|
|
73
|
+
noGetById: boolean;
|
|
74
|
+
};
|
|
75
|
+
deferredRelations: RelationPatch[];
|
|
76
|
+
deferredConstraints: {
|
|
77
|
+
indexes: import("./schema-tool-types.js").ConstraintGroup[];
|
|
78
|
+
uniques: import("./schema-tool-types.js").ConstraintGroup[];
|
|
79
|
+
};
|
|
80
|
+
result: any;
|
|
81
|
+
}>;
|
|
82
|
+
deleteOneTable: ({ tableId, tableName, confirm }: {
|
|
83
|
+
tableId: any;
|
|
84
|
+
tableName: any;
|
|
85
|
+
confirm: any;
|
|
86
|
+
}) => Promise<{
|
|
87
|
+
action: string;
|
|
88
|
+
tableId: any;
|
|
89
|
+
tableName: any;
|
|
90
|
+
columnCount: any;
|
|
91
|
+
relationCount: any;
|
|
92
|
+
destructive: boolean;
|
|
93
|
+
result?: undefined;
|
|
94
|
+
} | {
|
|
95
|
+
action: string;
|
|
96
|
+
tableId: any;
|
|
97
|
+
tableName: any;
|
|
98
|
+
result: any;
|
|
99
|
+
columnCount?: undefined;
|
|
100
|
+
relationCount?: undefined;
|
|
101
|
+
destructive?: undefined;
|
|
102
|
+
}>;
|
|
103
|
+
removeColumnFromTable: ({ tableId, columnId, confirm, globalRulesAckKey }: {
|
|
104
|
+
tableId: any;
|
|
105
|
+
columnId: any;
|
|
106
|
+
confirm: any;
|
|
107
|
+
globalRulesAckKey: any;
|
|
108
|
+
}) => Promise<import("./types.js").ToolResult | {
|
|
109
|
+
content: {
|
|
110
|
+
type: string;
|
|
111
|
+
text: string;
|
|
112
|
+
}[];
|
|
113
|
+
}>;
|
|
114
|
+
removeRelationFromTable: ({ tableId, relationId, confirm, globalRulesAckKey }: {
|
|
115
|
+
tableId: any;
|
|
116
|
+
relationId: any;
|
|
117
|
+
confirm: any;
|
|
118
|
+
globalRulesAckKey: any;
|
|
119
|
+
}) => Promise<import("./types.js").ToolResult | {
|
|
120
|
+
content: {
|
|
121
|
+
type: string;
|
|
122
|
+
text: string;
|
|
123
|
+
}[];
|
|
124
|
+
}>;
|
|
125
|
+
updateOneColumn: ({ tableId, columnId, name, type, isNullable, isPublished, isUpdatable, defaultValue, description, options, allowContractBroadening }: {
|
|
126
|
+
tableId: any;
|
|
127
|
+
columnId: any;
|
|
128
|
+
name: any;
|
|
129
|
+
type: any;
|
|
130
|
+
isNullable: any;
|
|
131
|
+
isPublished: any;
|
|
132
|
+
isUpdatable: any;
|
|
133
|
+
defaultValue: any;
|
|
134
|
+
description: any;
|
|
135
|
+
options: any;
|
|
136
|
+
allowContractBroadening: any;
|
|
137
|
+
}) => Promise<{
|
|
138
|
+
action: string;
|
|
139
|
+
tableId: any;
|
|
140
|
+
columnId: any;
|
|
141
|
+
contractBroadening: string[];
|
|
142
|
+
result: any;
|
|
143
|
+
}>;
|
|
144
|
+
updateOneTable: (args: any) => Promise<{
|
|
145
|
+
action: string;
|
|
146
|
+
tableId: any;
|
|
147
|
+
schemaConstraintNormalization: AnyRecord;
|
|
148
|
+
result: any;
|
|
149
|
+
}>;
|
|
150
|
+
};
|