mcp-quickbase 2.0.5 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/.crewchief/runs/state.json +3 -0
  2. package/.mcp.json +6 -32
  3. package/.sdd/tickets/RELS_relationship-management/README.md +98 -0
  4. package/.sdd/tickets/RELS_relationship-management/planning/analysis.md +190 -0
  5. package/.sdd/tickets/RELS_relationship-management/planning/architecture.md +413 -0
  6. package/.sdd/tickets/RELS_relationship-management/planning/plan.md +177 -0
  7. package/.sdd/tickets/RELS_relationship-management/planning/quality-strategy.md +335 -0
  8. package/.sdd/tickets/RELS_relationship-management/planning/review-updates.md +95 -0
  9. package/.sdd/tickets/RELS_relationship-management/planning/security-review.md +213 -0
  10. package/.sdd/tickets/RELS_relationship-management/planning/ticket-review.md +885 -0
  11. package/.sdd/tickets/RELS_relationship-management/tasks/RELS.1001_domain-setup.md +96 -0
  12. package/.sdd/tickets/RELS_relationship-management/tasks/RELS.1002_get-relationships-tool.md +142 -0
  13. package/.sdd/tickets/RELS_relationship-management/tasks/RELS.1003_register-phase1-tools.md +105 -0
  14. package/.sdd/tickets/RELS_relationship-management/tasks/RELS.2001_create-relationship-tool.md +151 -0
  15. package/.sdd/tickets/RELS_relationship-management/tasks/RELS.2002_update-relationship-tool.md +145 -0
  16. package/.sdd/tickets/RELS_relationship-management/tasks/RELS.3001_delete-relationship-tool.md +154 -0
  17. package/.sdd/tickets/RELS_relationship-management/tasks/RELS.4001_integration-testing.md +159 -0
  18. package/.sdd/tickets/RELS_relationship-management/tasks/RELS.4002_final-verification.md +182 -0
  19. package/.sdd/tickets/RELS_relationship-management/tasks/RELS_TASK_INDEX.md +179 -0
  20. package/crewchief.config.js +31 -0
  21. package/dist/client/quickbase.d.ts +7 -2
  22. package/dist/client/quickbase.js +64 -51
  23. package/dist/client/quickbase.js.map +1 -1
  24. package/dist/mcp/index.d.ts +1 -1
  25. package/dist/mcp/server.d.ts +3 -3
  26. package/dist/mcp/server.js +21 -17
  27. package/dist/mcp/server.js.map +1 -1
  28. package/dist/mcp-stdio-server.js +64 -49
  29. package/dist/mcp-stdio-server.js.map +1 -1
  30. package/dist/server.js +84 -83
  31. package/dist/server.js.map +1 -1
  32. package/dist/tools/apps/create_app.d.ts +2 -2
  33. package/dist/tools/apps/create_app.js +23 -23
  34. package/dist/tools/apps/create_app.js.map +1 -1
  35. package/dist/tools/apps/index.d.ts +4 -4
  36. package/dist/tools/apps/index.js +3 -3
  37. package/dist/tools/apps/list_tables.d.ts +7 -7
  38. package/dist/tools/apps/list_tables.js +28 -27
  39. package/dist/tools/apps/list_tables.js.map +1 -1
  40. package/dist/tools/apps/update_app.d.ts +2 -2
  41. package/dist/tools/apps/update_app.js +28 -26
  42. package/dist/tools/apps/update_app.js.map +1 -1
  43. package/dist/tools/base.d.ts +3 -3
  44. package/dist/tools/base.js +7 -7
  45. package/dist/tools/base.js.map +1 -1
  46. package/dist/tools/configure_cache.d.ts +3 -3
  47. package/dist/tools/configure_cache.js +16 -16
  48. package/dist/tools/configure_cache.js.map +1 -1
  49. package/dist/tools/fields/create_field.d.ts +8 -7
  50. package/dist/tools/fields/create_field.js +39 -29
  51. package/dist/tools/fields/create_field.js.map +1 -1
  52. package/dist/tools/fields/delete_field.d.ts +79 -0
  53. package/dist/tools/fields/delete_field.js +105 -0
  54. package/dist/tools/fields/delete_field.js.map +1 -0
  55. package/dist/tools/fields/get_field.d.ts +91 -0
  56. package/dist/tools/fields/get_field.js +82 -0
  57. package/dist/tools/fields/get_field.js.map +1 -0
  58. package/dist/tools/fields/index.d.ts +5 -3
  59. package/dist/tools/fields/index.js +11 -5
  60. package/dist/tools/fields/index.js.map +1 -1
  61. package/dist/tools/fields/update_field.d.ts +7 -15
  62. package/dist/tools/fields/update_field.js +39 -38
  63. package/dist/tools/fields/update_field.js.map +1 -1
  64. package/dist/tools/files/download_file.d.ts +2 -2
  65. package/dist/tools/files/download_file.js +35 -35
  66. package/dist/tools/files/download_file.js.map +1 -1
  67. package/dist/tools/files/index.d.ts +3 -3
  68. package/dist/tools/files/index.js +3 -3
  69. package/dist/tools/files/upload_file.d.ts +2 -2
  70. package/dist/tools/files/upload_file.js +52 -44
  71. package/dist/tools/files/upload_file.js.map +1 -1
  72. package/dist/tools/index.d.ts +13 -12
  73. package/dist/tools/index.js +6 -3
  74. package/dist/tools/index.js.map +1 -1
  75. package/dist/tools/records/bulk_create_records.d.ts +2 -2
  76. package/dist/tools/records/bulk_create_records.js +28 -28
  77. package/dist/tools/records/bulk_create_records.js.map +1 -1
  78. package/dist/tools/records/bulk_update_records.d.ts +2 -2
  79. package/dist/tools/records/bulk_update_records.js +27 -27
  80. package/dist/tools/records/bulk_update_records.js.map +1 -1
  81. package/dist/tools/records/create_record.d.ts +2 -2
  82. package/dist/tools/records/create_record.js +40 -40
  83. package/dist/tools/records/create_record.js.map +1 -1
  84. package/dist/tools/records/index.d.ts +6 -6
  85. package/dist/tools/records/index.js +3 -3
  86. package/dist/tools/records/query_records.d.ts +3 -3
  87. package/dist/tools/records/query_records.js +82 -78
  88. package/dist/tools/records/query_records.js.map +1 -1
  89. package/dist/tools/records/update_record.d.ts +2 -2
  90. package/dist/tools/records/update_record.js +31 -29
  91. package/dist/tools/records/update_record.js.map +1 -1
  92. package/dist/tools/registry.d.ts +1 -1
  93. package/dist/tools/registry.js +1 -1
  94. package/dist/tools/relationships/create_relationship.d.ts +150 -0
  95. package/dist/tools/relationships/create_relationship.js +181 -0
  96. package/dist/tools/relationships/create_relationship.js.map +1 -0
  97. package/dist/tools/relationships/delete_relationship.d.ts +66 -0
  98. package/dist/tools/relationships/delete_relationship.js +85 -0
  99. package/dist/tools/relationships/delete_relationship.js.map +1 -0
  100. package/dist/tools/relationships/get_relationships.d.ts +126 -0
  101. package/dist/tools/relationships/get_relationships.js +126 -0
  102. package/dist/tools/relationships/get_relationships.js.map +1 -0
  103. package/dist/tools/relationships/index.d.ts +14 -0
  104. package/dist/tools/relationships/index.js +37 -0
  105. package/dist/tools/relationships/index.js.map +1 -0
  106. package/dist/tools/relationships/update_relationship.d.ts +139 -0
  107. package/dist/tools/relationships/update_relationship.js +168 -0
  108. package/dist/tools/relationships/update_relationship.js.map +1 -0
  109. package/dist/tools/reports/index.d.ts +2 -2
  110. package/dist/tools/reports/index.js +3 -3
  111. package/dist/tools/reports/run_report.d.ts +3 -3
  112. package/dist/tools/reports/run_report.js +29 -29
  113. package/dist/tools/reports/run_report.js.map +1 -1
  114. package/dist/tools/tables/create_table.d.ts +2 -49
  115. package/dist/tools/tables/create_table.js +26 -49
  116. package/dist/tools/tables/create_table.js.map +1 -1
  117. package/dist/tools/tables/get_table_fields.d.ts +2 -2
  118. package/dist/tools/tables/get_table_fields.js +25 -25
  119. package/dist/tools/tables/get_table_fields.js.map +1 -1
  120. package/dist/tools/tables/index.d.ts +4 -4
  121. package/dist/tools/tables/index.js +3 -3
  122. package/dist/tools/tables/update_table.d.ts +2 -2
  123. package/dist/tools/tables/update_table.js +28 -26
  124. package/dist/tools/tables/update_table.js.map +1 -1
  125. package/dist/tools/test_connection.d.ts +2 -2
  126. package/dist/tools/test_connection.js +28 -28
  127. package/dist/tools/test_connection.js.map +1 -1
  128. package/dist/types/api.d.ts +1 -1
  129. package/dist/types/mcp.d.ts +1 -1
  130. package/dist/utils/cache.js +16 -16
  131. package/dist/utils/cache.js.map +1 -1
  132. package/dist/utils/file.js +44 -40
  133. package/dist/utils/file.js.map +1 -1
  134. package/dist/utils/logger.js +30 -28
  135. package/dist/utils/logger.js.map +1 -1
  136. package/dist/utils/retry.js +10 -10
  137. package/dist/utils/retry.js.map +1 -1
  138. package/dist/utils/validation.d.ts +1 -1
  139. package/dist/utils/validation.js +39 -36
  140. package/dist/utils/validation.js.map +1 -1
  141. package/docs/README.md +6 -0
  142. package/docs/future-improvements.md +33 -0
  143. package/docs/migration-guide.md +160 -0
  144. package/docs/release-notes.md +89 -0
  145. package/package.json +5 -4
  146. /package/{HARDENING_SUMMARY.md → docs/hardening-summary.md} +0 -0
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UpdateRecordTool = void 0;
4
4
  const base_1 = require("../base");
5
5
  const logger_1 = require("../../utils/logger");
6
- const logger = (0, logger_1.createLogger)('UpdateRecordTool');
6
+ const logger = (0, logger_1.createLogger)("UpdateRecordTool");
7
7
  /**
8
8
  * Tool for updating an existing record in a Quickbase table
9
9
  */
@@ -14,29 +14,29 @@ class UpdateRecordTool extends base_1.BaseTool {
14
14
  */
15
15
  constructor(client) {
16
16
  super(client);
17
- this.name = 'update_record';
18
- this.description = 'Updates an existing record in a Quickbase table';
17
+ this.name = "update_record";
18
+ this.description = "Updates an existing record in a Quickbase table";
19
19
  /**
20
20
  * Parameter schema for update_record
21
21
  */
22
22
  this.paramSchema = {
23
- type: 'object',
23
+ type: "object",
24
24
  properties: {
25
25
  table_id: {
26
- type: 'string',
27
- description: 'The ID of the Quickbase table'
26
+ type: "string",
27
+ description: "The ID of the Quickbase table",
28
28
  },
29
29
  record_id: {
30
- type: 'string',
31
- description: 'The ID of the record to update'
30
+ type: "string",
31
+ description: "The ID of the record to update",
32
32
  },
33
33
  data: {
34
- type: 'object',
35
- description: 'The updated data for the record',
36
- additionalProperties: true
37
- }
34
+ type: "object",
35
+ description: "The updated data for the record",
36
+ additionalProperties: true,
37
+ },
38
38
  },
39
- required: ['table_id', 'record_id', 'data']
39
+ required: ["table_id", "record_id", "data"],
40
40
  };
41
41
  }
42
42
  /**
@@ -46,13 +46,13 @@ class UpdateRecordTool extends base_1.BaseTool {
46
46
  */
47
47
  async run(params) {
48
48
  const { table_id, record_id, data } = params;
49
- logger.info('Updating record in Quickbase table', {
49
+ logger.info("Updating record in Quickbase table", {
50
50
  tableId: table_id,
51
- recordId: record_id
51
+ recordId: record_id,
52
52
  });
53
53
  // Validate data
54
- if (!data || typeof data !== 'object' || Object.keys(data).length === 0) {
55
- throw new Error('Update data is required and must be a non-empty object');
54
+ if (!data || typeof data !== "object" || Object.keys(data).length === 0) {
55
+ throw new Error("Update data is required and must be a non-empty object");
56
56
  }
57
57
  // Prepare record data
58
58
  // Convert data to { [fieldId]: { value: fieldValue } } format expected by the API
@@ -63,35 +63,37 @@ class UpdateRecordTool extends base_1.BaseTool {
63
63
  // Prepare request body
64
64
  const body = {
65
65
  to: table_id,
66
- data: [{
66
+ data: [
67
+ {
67
68
  id: record_id,
68
- ...recordData
69
- }]
69
+ ...recordData,
70
+ },
71
+ ],
70
72
  };
71
73
  // Update the record
72
74
  const response = await this.client.request({
73
- method: 'POST',
74
- path: '/records',
75
- body
75
+ method: "POST",
76
+ path: "/records",
77
+ body,
76
78
  });
77
79
  if (!response.success || !response.data) {
78
- logger.error('Failed to update record', {
80
+ logger.error("Failed to update record", {
79
81
  error: response.error,
80
82
  tableId: table_id,
81
- recordId: record_id
83
+ recordId: record_id,
82
84
  });
83
- throw new Error(response.error?.message || 'Failed to update record');
85
+ throw new Error(response.error?.message || "Failed to update record");
84
86
  }
85
- logger.info('Successfully updated record', {
87
+ logger.info("Successfully updated record", {
86
88
  recordId: record_id,
87
89
  tableId: table_id,
88
- updatedFields: Object.keys(data)
90
+ updatedFields: Object.keys(data),
89
91
  });
90
92
  return {
91
93
  recordId: record_id,
92
94
  tableId: table_id,
93
95
  updatedTime: new Date().toISOString(),
94
- updatedFields: Object.keys(data)
96
+ updatedFields: Object.keys(data),
95
97
  };
96
98
  }
97
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"update_record.js","sourceRoot":"","sources":["../../../src/tools/records/update_record.ts"],"names":[],"mappings":";;;AAAA,kCAAmC;AAEnC,+CAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,kBAAkB,CAAC,CAAC;AAgDhD;;GAEG;AACH,MAAa,gBAAiB,SAAQ,eAAgD;IA2BpF;;;OAGG;IACH,YAAY,MAAuB;QACjC,KAAK,CAAC,MAAM,CAAC,CAAC;QA/BT,SAAI,GAAG,eAAe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I,GAAwB;YAChC,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE;gBACJ;oBACE,EAAE,EAAE,SAAS;oBACb,GAAG,UAAU;iBACd;aACF;SACF,CAAC;QAEF,oBAAoB;QACpB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACzC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,UAAU;YAChB,IAAI;SACL,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACxC,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE;gBACtC,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,OAAO,EAAE,QAAQ;gBACjB,QAAQ,EAAE,SAAS;aACpB,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,IAAI,yBAAyB,CAAC,CAAC;QACxE,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE;YACzC,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,QAAQ;YACjB,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;SACjC,CAAC,CAAC;QAEH,OAAO;YACL,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;SACjC,CAAC;IACJ,CAAC;CACF;AAxGD,4CAwGC"}
@@ -1,4 +1,4 @@
1
- import { McpTool, ToolRegistry } from '../types/mcp';
1
+ import { McpTool, ToolRegistry } from "../types/mcp";
2
2
  /**
3
3
  * Implementation of the MCP Tool Registry
4
4
  * Manages all available MCP tools
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toolRegistry = exports.ToolRegistryImpl = void 0;
4
4
  const logger_1 = require("../utils/logger");
5
- const logger = (0, logger_1.createLogger)('ToolRegistry');
5
+ const logger = (0, logger_1.createLogger)("ToolRegistry");
6
6
  /**
7
7
  * Implementation of the MCP Tool Registry
8
8
  * Manages all available MCP tools
@@ -0,0 +1,150 @@
1
+ import { BaseTool } from "../base";
2
+ import { QuickbaseClient } from "../../client/quickbase";
3
+ import { RelationshipFieldInfo } from "./get_relationships";
4
+ /**
5
+ * Valid accumulation types for summary fields
6
+ */
7
+ export type SummaryAccumulationType = "SUM" | "COUNT" | "AVG" | "MAX" | "MIN";
8
+ /**
9
+ * Parameters for create_relationship tool
10
+ */
11
+ export interface CreateRelationshipParams {
12
+ /**
13
+ * The ID of the child table (DBID) where the relationship reference field will be created
14
+ */
15
+ table_id: string;
16
+ /**
17
+ * The ID of the parent table (DBID) to link to
18
+ */
19
+ parent_table_id: string;
20
+ /**
21
+ * Optional label for the foreign key reference field created in the child table
22
+ */
23
+ foreign_key_label?: string;
24
+ /**
25
+ * Optional array of parent field IDs to create as lookup fields in the child table
26
+ */
27
+ lookup_field_ids?: number[];
28
+ /**
29
+ * Optional child field ID to summarize in the parent table
30
+ */
31
+ summary_field_id?: number;
32
+ /**
33
+ * Optional label for the summary field created in the parent table
34
+ */
35
+ summary_label?: string;
36
+ /**
37
+ * Accumulation type for the summary field (required if summary_field_id is provided)
38
+ */
39
+ summary_accumulation_type?: SummaryAccumulationType;
40
+ /**
41
+ * Optional Quickbase query filter for the summary field
42
+ */
43
+ summary_where?: string;
44
+ }
45
+ /**
46
+ * Result from creating a relationship
47
+ */
48
+ export interface CreateRelationshipResult {
49
+ /**
50
+ * The ID of the relationship (same as the foreign key field ID)
51
+ */
52
+ id: number;
53
+ /**
54
+ * The ID of the parent table
55
+ */
56
+ parentTableId: string;
57
+ /**
58
+ * The ID of the child table
59
+ */
60
+ childTableId: string;
61
+ /**
62
+ * The foreign key field created in the child table
63
+ */
64
+ foreignKeyField: RelationshipFieldInfo;
65
+ /**
66
+ * Lookup fields created in the child table
67
+ */
68
+ lookupFields: RelationshipFieldInfo[];
69
+ /**
70
+ * Summary fields created in the parent table
71
+ */
72
+ summaryFields: RelationshipFieldInfo[];
73
+ }
74
+ /**
75
+ * Tool for creating a new table-to-table relationship in Quickbase.
76
+ *
77
+ * Creates a reference field in the child table linking to the parent table.
78
+ * Optionally creates lookup fields and/or summary fields.
79
+ */
80
+ export declare class CreateRelationshipTool extends BaseTool<CreateRelationshipParams, CreateRelationshipResult> {
81
+ name: string;
82
+ description: string;
83
+ /**
84
+ * Parameter schema for create_relationship with conditional validation
85
+ */
86
+ paramSchema: {
87
+ type: string;
88
+ properties: {
89
+ table_id: {
90
+ type: string;
91
+ description: string;
92
+ };
93
+ parent_table_id: {
94
+ type: string;
95
+ description: string;
96
+ };
97
+ foreign_key_label: {
98
+ type: string;
99
+ description: string;
100
+ };
101
+ lookup_field_ids: {
102
+ type: string;
103
+ items: {
104
+ type: string;
105
+ };
106
+ description: string;
107
+ };
108
+ summary_field_id: {
109
+ type: string;
110
+ description: string;
111
+ };
112
+ summary_label: {
113
+ type: string;
114
+ description: string;
115
+ };
116
+ summary_accumulation_type: {
117
+ type: string;
118
+ enum: string[];
119
+ description: string;
120
+ };
121
+ summary_where: {
122
+ type: string;
123
+ description: string;
124
+ };
125
+ };
126
+ required: string[];
127
+ if: {
128
+ properties: {
129
+ summary_field_id: {
130
+ type: string;
131
+ };
132
+ };
133
+ required: string[];
134
+ };
135
+ then: {
136
+ required: string[];
137
+ };
138
+ };
139
+ /**
140
+ * Constructor
141
+ * @param client Quickbase client
142
+ */
143
+ constructor(client: QuickbaseClient);
144
+ /**
145
+ * Run the create_relationship tool
146
+ * @param params Tool parameters
147
+ * @returns Created relationship details
148
+ */
149
+ protected run(params: CreateRelationshipParams): Promise<CreateRelationshipResult>;
150
+ }
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateRelationshipTool = void 0;
4
+ const base_1 = require("../base");
5
+ const logger_1 = require("../../utils/logger");
6
+ const logger = (0, logger_1.createLogger)("CreateRelationshipTool");
7
+ /**
8
+ * Tool for creating a new table-to-table relationship in Quickbase.
9
+ *
10
+ * Creates a reference field in the child table linking to the parent table.
11
+ * Optionally creates lookup fields and/or summary fields.
12
+ */
13
+ class CreateRelationshipTool extends base_1.BaseTool {
14
+ /**
15
+ * Constructor
16
+ * @param client Quickbase client
17
+ */
18
+ constructor(client) {
19
+ super(client);
20
+ this.name = "create_relationship";
21
+ this.description = "Creates a new table-to-table relationship linking a child table to a parent table. " +
22
+ "This creates a reference field in the child table. Optionally creates lookup fields " +
23
+ "(to display parent data in child records) and/or a summary field (to aggregate child " +
24
+ "data in parent records). Relationships can only be created between tables in the same " +
25
+ "application. This operation is SAFE and does not modify existing data.";
26
+ /**
27
+ * Parameter schema for create_relationship with conditional validation
28
+ */
29
+ this.paramSchema = {
30
+ type: "object",
31
+ properties: {
32
+ table_id: {
33
+ type: "string",
34
+ description: "The ID of the child Quickbase table (DBID) where the relationship reference field will be created",
35
+ },
36
+ parent_table_id: {
37
+ type: "string",
38
+ description: "The ID of the parent Quickbase table (DBID) to link to",
39
+ },
40
+ foreign_key_label: {
41
+ type: "string",
42
+ description: "Optional label for the foreign key reference field created in the child table",
43
+ },
44
+ lookup_field_ids: {
45
+ type: "array",
46
+ items: {
47
+ type: "number",
48
+ },
49
+ description: "Optional array of parent field IDs to create as lookup fields in the child table",
50
+ },
51
+ summary_field_id: {
52
+ type: "number",
53
+ description: "Optional child field ID to summarize in the parent table",
54
+ },
55
+ summary_label: {
56
+ type: "string",
57
+ description: "Optional label for the summary field created in the parent table",
58
+ },
59
+ summary_accumulation_type: {
60
+ type: "string",
61
+ enum: ["SUM", "COUNT", "AVG", "MAX", "MIN"],
62
+ description: "Accumulation type for the summary field. Required when summary_field_id is provided. " +
63
+ "Valid values: SUM, COUNT, AVG, MAX, MIN",
64
+ },
65
+ summary_where: {
66
+ type: "string",
67
+ description: "Optional Quickbase query filter for the summary field (e.g., \"{6.EX.'Active'}\")",
68
+ },
69
+ },
70
+ required: ["table_id", "parent_table_id"],
71
+ // Conditional validation: summary_accumulation_type is required when summary_field_id is provided
72
+ if: {
73
+ properties: { summary_field_id: { type: "number" } },
74
+ required: ["summary_field_id"],
75
+ },
76
+ then: {
77
+ required: ["summary_accumulation_type"],
78
+ },
79
+ };
80
+ }
81
+ /**
82
+ * Run the create_relationship tool
83
+ * @param params Tool parameters
84
+ * @returns Created relationship details
85
+ */
86
+ async run(params) {
87
+ const { table_id, parent_table_id, foreign_key_label, lookup_field_ids, summary_field_id, summary_label, summary_accumulation_type, summary_where, } = params;
88
+ logger.info("Creating relationship between tables", {
89
+ childTableId: table_id,
90
+ parentTableId: parent_table_id,
91
+ hasLookupFields: !!lookup_field_ids?.length,
92
+ hasSummaryField: !!summary_field_id,
93
+ });
94
+ // Validate conditional requirement: summary_accumulation_type required when summary_field_id is provided
95
+ if (summary_field_id !== undefined && !summary_accumulation_type) {
96
+ const errorMessage = "summary_accumulation_type is required when summary_field_id is provided. " +
97
+ "Valid values: SUM, COUNT, AVG, MAX, MIN";
98
+ logger.error("Validation failed", { error: errorMessage });
99
+ throw new Error(errorMessage);
100
+ }
101
+ // Build the request body according to Quickbase API format
102
+ const body = {
103
+ parentTableId: parent_table_id,
104
+ };
105
+ // Add optional foreign key label
106
+ if (foreign_key_label) {
107
+ body.foreignKeyField = {
108
+ label: foreign_key_label,
109
+ };
110
+ }
111
+ // Add lookup fields if provided
112
+ if (lookup_field_ids && lookup_field_ids.length > 0) {
113
+ body.lookupFieldIds = lookup_field_ids;
114
+ }
115
+ // Add summary field configuration if provided
116
+ if (summary_field_id !== undefined && summary_accumulation_type) {
117
+ const summaryField = {
118
+ summaryFid: summary_field_id,
119
+ accumulationType: summary_accumulation_type,
120
+ };
121
+ if (summary_label) {
122
+ summaryField.label = summary_label;
123
+ }
124
+ if (summary_where) {
125
+ summaryField.where = summary_where;
126
+ }
127
+ body.summaryFields = [summaryField];
128
+ }
129
+ // Create the relationship
130
+ const response = await this.client.request({
131
+ method: "POST",
132
+ path: `/tables/${table_id}/relationship`,
133
+ body,
134
+ });
135
+ if (!response.success || !response.data) {
136
+ logger.error("Failed to create relationship", {
137
+ error: response.error,
138
+ childTableId: table_id,
139
+ parentTableId: parent_table_id,
140
+ });
141
+ throw new Error(response.error?.message || "Failed to create relationship");
142
+ }
143
+ // Parse and transform the API response
144
+ const data = response.data;
145
+ const foreignKeyField = data.foreignKeyField;
146
+ const lookupFields = data.lookupFields;
147
+ const summaryFields = data.summaryFields;
148
+ const result = {
149
+ id: data.id,
150
+ parentTableId: data.parentTableId,
151
+ childTableId: data.childTableId,
152
+ foreignKeyField: foreignKeyField
153
+ ? {
154
+ id: foreignKeyField.id,
155
+ label: foreignKeyField.label,
156
+ type: foreignKeyField.type,
157
+ }
158
+ : { id: 0, label: "", type: "" },
159
+ lookupFields: (lookupFields || []).map((field) => ({
160
+ id: field.id,
161
+ label: field.label,
162
+ type: field.type,
163
+ })),
164
+ summaryFields: (summaryFields || []).map((field) => ({
165
+ id: field.id,
166
+ label: field.label,
167
+ type: field.type,
168
+ })),
169
+ };
170
+ logger.info("Successfully created relationship", {
171
+ relationshipId: result.id,
172
+ childTableId: result.childTableId,
173
+ parentTableId: result.parentTableId,
174
+ lookupFieldsCreated: result.lookupFields.length,
175
+ summaryFieldsCreated: result.summaryFields.length,
176
+ });
177
+ return result;
178
+ }
179
+ }
180
+ exports.CreateRelationshipTool = CreateRelationshipTool;
181
+ //# sourceMappingURL=create_relationship.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_relationship.js","sourceRoot":"","sources":["../../../src/tools/relationships/create_relationship.ts"],"names":[],"mappings":";;;AAAA,kCAAmC;AAEnC,+CAAkD;AAGlD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,wBAAwB,CAAC,CAAC;AAuFtD;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,eAG3C;IAsEC;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AY;oBAChC,KAAK,EAAE,eAAe,CAAC,KAAe;oBACtC,IAAI,EAAE,eAAe,CAAC,IAAc;iBACrC;gBACH,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAClC,YAAY,EAAE,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,GAAG,CACpC,CAAC,KAA8B,EAAE,EAAE,CAAC,CAAC;gBACnC,EAAE,EAAE,KAAK,CAAC,EAAY;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAe;gBAC5B,IAAI,EAAE,KAAK,CAAC,IAAc;aAC3B,CAAC,CACH;YACD,aAAa,EAAE,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,GAAG,CACtC,CAAC,KAA8B,EAAE,EAAE,CAAC,CAAC;gBACnC,EAAE,EAAE,KAAK,CAAC,EAAY;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAe;gBAC5B,IAAI,EAAE,KAAK,CAAC,IAAc;aAC3B,CAAC,CACH;SACF,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,mCAAmC,EAAE;YAC/C,cAAc,EAAE,MAAM,CAAC,EAAE;YACzB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,mBAAmB,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM;YAC/C,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM;SAClD,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3ND,wDA2NC"}
@@ -0,0 +1,66 @@
1
+ import { BaseTool } from "../base";
2
+ import { QuickbaseClient } from "../../client/quickbase";
3
+ /**
4
+ * Parameters for delete_relationship tool
5
+ */
6
+ export interface DeleteRelationshipParams {
7
+ /**
8
+ * The ID of the child table (DBID) containing the relationship
9
+ */
10
+ table_id: string;
11
+ /**
12
+ * The ID of the relationship to delete
13
+ */
14
+ relationship_id: number;
15
+ }
16
+ /**
17
+ * Result from deleting a relationship
18
+ */
19
+ export interface DeleteRelationshipResult {
20
+ /**
21
+ * The ID of the deleted relationship
22
+ */
23
+ relationshipId: number;
24
+ /**
25
+ * Whether the deletion was successful
26
+ */
27
+ deleted: boolean;
28
+ }
29
+ /**
30
+ * Tool for deleting a table-to-table relationship in Quickbase.
31
+ *
32
+ * WARNING: This is a DESTRUCTIVE operation that permanently deletes
33
+ * the relationship and all associated lookup and summary fields.
34
+ */
35
+ export declare class DeleteRelationshipTool extends BaseTool<DeleteRelationshipParams, DeleteRelationshipResult> {
36
+ name: string;
37
+ description: string;
38
+ /**
39
+ * Parameter schema for delete_relationship
40
+ */
41
+ paramSchema: {
42
+ type: string;
43
+ properties: {
44
+ table_id: {
45
+ type: string;
46
+ description: string;
47
+ };
48
+ relationship_id: {
49
+ type: string;
50
+ description: string;
51
+ };
52
+ };
53
+ required: string[];
54
+ };
55
+ /**
56
+ * Constructor
57
+ * @param client Quickbase client
58
+ */
59
+ constructor(client: QuickbaseClient);
60
+ /**
61
+ * Run the delete_relationship tool
62
+ * @param params Tool parameters
63
+ * @returns Deletion confirmation
64
+ */
65
+ protected run(params: DeleteRelationshipParams): Promise<DeleteRelationshipResult>;
66
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteRelationshipTool = void 0;
4
+ const base_1 = require("../base");
5
+ const logger_1 = require("../../utils/logger");
6
+ const logger = (0, logger_1.createLogger)("DeleteRelationshipTool");
7
+ /**
8
+ * Tool for deleting a table-to-table relationship in Quickbase.
9
+ *
10
+ * WARNING: This is a DESTRUCTIVE operation that permanently deletes
11
+ * the relationship and all associated lookup and summary fields.
12
+ */
13
+ class DeleteRelationshipTool extends base_1.BaseTool {
14
+ /**
15
+ * Constructor
16
+ * @param client Quickbase client
17
+ */
18
+ constructor(client) {
19
+ super(client);
20
+ this.name = "delete_relationship";
21
+ this.description = "WARNING: DESTRUCTIVE OPERATION - Permanently deletes an entire table-to-table " +
22
+ "relationship INCLUDING ALL LOOKUP AND SUMMARY FIELDS associated with it. All data " +
23
+ "in those fields will be permanently lost and CANNOT be recovered. The reference " +
24
+ "field in the child table will NOT be deleted (it will remain and may need to be " +
25
+ "manually deleted using field deletion tools if no longer needed). Before using " +
26
+ "this tool:\n" +
27
+ "1. Use get_relationships to see what fields will be deleted\n" +
28
+ "2. Confirm with the user that they want to proceed\n" +
29
+ "3. Consider if you only need to delete specific fields instead\n\n" +
30
+ "Only use this tool when you are certain the entire relationship should be removed.";
31
+ /**
32
+ * Parameter schema for delete_relationship
33
+ */
34
+ this.paramSchema = {
35
+ type: "object",
36
+ properties: {
37
+ table_id: {
38
+ type: "string",
39
+ description: "The ID of the child Quickbase table (DBID) containing the relationship",
40
+ },
41
+ relationship_id: {
42
+ type: "number",
43
+ description: "The ID of the relationship to delete",
44
+ },
45
+ },
46
+ required: ["table_id", "relationship_id"],
47
+ };
48
+ }
49
+ /**
50
+ * Run the delete_relationship tool
51
+ * @param params Tool parameters
52
+ * @returns Deletion confirmation
53
+ */
54
+ async run(params) {
55
+ const { table_id, relationship_id } = params;
56
+ // Use logger.warn for destructive operations
57
+ logger.warn("Deleting relationship", {
58
+ tableId: table_id,
59
+ relationshipId: relationship_id,
60
+ });
61
+ // Delete the relationship
62
+ const response = await this.client.request({
63
+ method: "DELETE",
64
+ path: `/tables/${table_id}/relationship/${relationship_id}`,
65
+ });
66
+ if (!response.success) {
67
+ logger.error("Failed to delete relationship", {
68
+ error: response.error,
69
+ tableId: table_id,
70
+ relationshipId: relationship_id,
71
+ });
72
+ throw new Error(response.error?.message || "Failed to delete relationship");
73
+ }
74
+ logger.warn("Successfully deleted relationship", {
75
+ tableId: table_id,
76
+ relationshipId: relationship_id,
77
+ });
78
+ return {
79
+ relationshipId: relationship_id,
80
+ deleted: true,
81
+ };
82
+ }
83
+ }
84
+ exports.DeleteRelationshipTool = DeleteRelationshipTool;
85
+ //# sourceMappingURL=delete_relationship.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete_relationship.js","sourceRoot":"","sources":["../../../src/tools/relationships/delete_relationship.ts"],"names":[],"mappings":";;;AAAA,kCAAmC;AAEnC,+CAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,wBAAwB,CAAC,CAAC;AAgCtD;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,eAG3C;IAiCC;;;OAGG;IACH,YAAY,MAAuB;QACjC,KAAK,CAAC,MAAM,CAAC,CAAC;QArCT,SAAI,GAAG,qBAAqB,CAAC;QAC7B,gBAAW,GAChB,gFAAgF;YAChF,oFAAoF;YACpF,kFAAkF;YAClF,kFAAkF;YAClF,iFAAiF;YACjF,cAAc;YACd,+DAA+D;YAC/D,sDAAsD;YACtD,oEAAoE;YACpE,oFAAoF,CAAC;QAEvF;;WAEG;QACI,gBAAW,GAAG;YACnB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,wEAAwE;iBAC3E;gBACD,eAAe,EAAE;oBACf,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sCAAsC;iBACpD;aACF;YACD,QAAQ,EAAE,CAAC,UAAU,EAAE,iBAAiB,CAAC;SAC1C,CAAC;IAQF,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,GAAG,CACjB,MAAgC;QAEhC,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;QAE7C,6CAA6C;QAC7C,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE;YACnC,OAAO,EAAE,QAAQ;YACjB,cAAc,EAAE,eAAe;SAChC,CAAC,CAAC;QAEH,0BAA0B;QAC1B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA0B;YAClE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,WAAW,QAAQ,iBA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