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.
- package/.crewchief/runs/state.json +3 -0
- package/.mcp.json +6 -32
- package/.sdd/tickets/RELS_relationship-management/README.md +98 -0
- package/.sdd/tickets/RELS_relationship-management/planning/analysis.md +190 -0
- package/.sdd/tickets/RELS_relationship-management/planning/architecture.md +413 -0
- package/.sdd/tickets/RELS_relationship-management/planning/plan.md +177 -0
- package/.sdd/tickets/RELS_relationship-management/planning/quality-strategy.md +335 -0
- package/.sdd/tickets/RELS_relationship-management/planning/review-updates.md +95 -0
- package/.sdd/tickets/RELS_relationship-management/planning/security-review.md +213 -0
- package/.sdd/tickets/RELS_relationship-management/planning/ticket-review.md +885 -0
- package/.sdd/tickets/RELS_relationship-management/tasks/RELS.1001_domain-setup.md +96 -0
- package/.sdd/tickets/RELS_relationship-management/tasks/RELS.1002_get-relationships-tool.md +142 -0
- package/.sdd/tickets/RELS_relationship-management/tasks/RELS.1003_register-phase1-tools.md +105 -0
- package/.sdd/tickets/RELS_relationship-management/tasks/RELS.2001_create-relationship-tool.md +151 -0
- package/.sdd/tickets/RELS_relationship-management/tasks/RELS.2002_update-relationship-tool.md +145 -0
- package/.sdd/tickets/RELS_relationship-management/tasks/RELS.3001_delete-relationship-tool.md +154 -0
- package/.sdd/tickets/RELS_relationship-management/tasks/RELS.4001_integration-testing.md +159 -0
- package/.sdd/tickets/RELS_relationship-management/tasks/RELS.4002_final-verification.md +182 -0
- package/.sdd/tickets/RELS_relationship-management/tasks/RELS_TASK_INDEX.md +179 -0
- package/crewchief.config.js +31 -0
- package/dist/client/quickbase.d.ts +7 -2
- package/dist/client/quickbase.js +64 -51
- package/dist/client/quickbase.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/server.d.ts +3 -3
- package/dist/mcp/server.js +21 -17
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp-stdio-server.js +64 -49
- package/dist/mcp-stdio-server.js.map +1 -1
- package/dist/server.js +84 -83
- package/dist/server.js.map +1 -1
- package/dist/tools/apps/create_app.d.ts +2 -2
- package/dist/tools/apps/create_app.js +23 -23
- package/dist/tools/apps/create_app.js.map +1 -1
- package/dist/tools/apps/index.d.ts +4 -4
- package/dist/tools/apps/index.js +3 -3
- package/dist/tools/apps/list_tables.d.ts +7 -7
- package/dist/tools/apps/list_tables.js +28 -27
- package/dist/tools/apps/list_tables.js.map +1 -1
- package/dist/tools/apps/update_app.d.ts +2 -2
- package/dist/tools/apps/update_app.js +28 -26
- package/dist/tools/apps/update_app.js.map +1 -1
- package/dist/tools/base.d.ts +3 -3
- package/dist/tools/base.js +7 -7
- package/dist/tools/base.js.map +1 -1
- package/dist/tools/configure_cache.d.ts +3 -3
- package/dist/tools/configure_cache.js +16 -16
- package/dist/tools/configure_cache.js.map +1 -1
- package/dist/tools/fields/create_field.d.ts +8 -7
- package/dist/tools/fields/create_field.js +39 -29
- package/dist/tools/fields/create_field.js.map +1 -1
- package/dist/tools/fields/delete_field.d.ts +79 -0
- package/dist/tools/fields/delete_field.js +105 -0
- package/dist/tools/fields/delete_field.js.map +1 -0
- package/dist/tools/fields/get_field.d.ts +91 -0
- package/dist/tools/fields/get_field.js +82 -0
- package/dist/tools/fields/get_field.js.map +1 -0
- package/dist/tools/fields/index.d.ts +5 -3
- package/dist/tools/fields/index.js +11 -5
- package/dist/tools/fields/index.js.map +1 -1
- package/dist/tools/fields/update_field.d.ts +7 -15
- package/dist/tools/fields/update_field.js +39 -38
- package/dist/tools/fields/update_field.js.map +1 -1
- package/dist/tools/files/download_file.d.ts +2 -2
- package/dist/tools/files/download_file.js +35 -35
- package/dist/tools/files/download_file.js.map +1 -1
- package/dist/tools/files/index.d.ts +3 -3
- package/dist/tools/files/index.js +3 -3
- package/dist/tools/files/upload_file.d.ts +2 -2
- package/dist/tools/files/upload_file.js +52 -44
- package/dist/tools/files/upload_file.js.map +1 -1
- package/dist/tools/index.d.ts +13 -12
- package/dist/tools/index.js +6 -3
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/records/bulk_create_records.d.ts +2 -2
- package/dist/tools/records/bulk_create_records.js +28 -28
- package/dist/tools/records/bulk_create_records.js.map +1 -1
- package/dist/tools/records/bulk_update_records.d.ts +2 -2
- package/dist/tools/records/bulk_update_records.js +27 -27
- package/dist/tools/records/bulk_update_records.js.map +1 -1
- package/dist/tools/records/create_record.d.ts +2 -2
- package/dist/tools/records/create_record.js +40 -40
- package/dist/tools/records/create_record.js.map +1 -1
- package/dist/tools/records/index.d.ts +6 -6
- package/dist/tools/records/index.js +3 -3
- package/dist/tools/records/query_records.d.ts +3 -3
- package/dist/tools/records/query_records.js +82 -78
- package/dist/tools/records/query_records.js.map +1 -1
- package/dist/tools/records/update_record.d.ts +2 -2
- package/dist/tools/records/update_record.js +31 -29
- package/dist/tools/records/update_record.js.map +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.js +1 -1
- package/dist/tools/relationships/create_relationship.d.ts +150 -0
- package/dist/tools/relationships/create_relationship.js +181 -0
- package/dist/tools/relationships/create_relationship.js.map +1 -0
- package/dist/tools/relationships/delete_relationship.d.ts +66 -0
- package/dist/tools/relationships/delete_relationship.js +85 -0
- package/dist/tools/relationships/delete_relationship.js.map +1 -0
- package/dist/tools/relationships/get_relationships.d.ts +126 -0
- package/dist/tools/relationships/get_relationships.js +126 -0
- package/dist/tools/relationships/get_relationships.js.map +1 -0
- package/dist/tools/relationships/index.d.ts +14 -0
- package/dist/tools/relationships/index.js +37 -0
- package/dist/tools/relationships/index.js.map +1 -0
- package/dist/tools/relationships/update_relationship.d.ts +139 -0
- package/dist/tools/relationships/update_relationship.js +168 -0
- package/dist/tools/relationships/update_relationship.js.map +1 -0
- package/dist/tools/reports/index.d.ts +2 -2
- package/dist/tools/reports/index.js +3 -3
- package/dist/tools/reports/run_report.d.ts +3 -3
- package/dist/tools/reports/run_report.js +29 -29
- package/dist/tools/reports/run_report.js.map +1 -1
- package/dist/tools/tables/create_table.d.ts +2 -49
- package/dist/tools/tables/create_table.js +26 -49
- package/dist/tools/tables/create_table.js.map +1 -1
- package/dist/tools/tables/get_table_fields.d.ts +2 -2
- package/dist/tools/tables/get_table_fields.js +25 -25
- package/dist/tools/tables/get_table_fields.js.map +1 -1
- package/dist/tools/tables/index.d.ts +4 -4
- package/dist/tools/tables/index.js +3 -3
- package/dist/tools/tables/update_table.d.ts +2 -2
- package/dist/tools/tables/update_table.js +28 -26
- package/dist/tools/tables/update_table.js.map +1 -1
- package/dist/tools/test_connection.d.ts +2 -2
- package/dist/tools/test_connection.js +28 -28
- package/dist/tools/test_connection.js.map +1 -1
- package/dist/types/api.d.ts +1 -1
- package/dist/types/mcp.d.ts +1 -1
- package/dist/utils/cache.js +16 -16
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/file.js +44 -40
- package/dist/utils/file.js.map +1 -1
- package/dist/utils/logger.js +30 -28
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/retry.js +10 -10
- package/dist/utils/retry.js.map +1 -1
- package/dist/utils/validation.d.ts +1 -1
- package/dist/utils/validation.js +39 -36
- package/dist/utils/validation.js.map +1 -1
- package/docs/README.md +6 -0
- package/docs/future-improvements.md +33 -0
- package/docs/migration-guide.md +160 -0
- package/docs/release-notes.md +89 -0
- package/package.json +5 -4
- /package/{HARDENING_SUMMARY.md → docs/hardening-summary.md} +0 -0
|
@@ -37,7 +37,7 @@ exports.UploadFileTool = void 0;
|
|
|
37
37
|
const base_1 = require("../base");
|
|
38
38
|
const logger_1 = require("../../utils/logger");
|
|
39
39
|
const file_1 = require("../../utils/file");
|
|
40
|
-
const logger = (0, logger_1.createLogger)(
|
|
40
|
+
const logger = (0, logger_1.createLogger)("UploadFileTool");
|
|
41
41
|
/**
|
|
42
42
|
* Tool for uploading a file to a field in a Quickbase record
|
|
43
43
|
*/
|
|
@@ -48,36 +48,36 @@ class UploadFileTool extends base_1.BaseTool {
|
|
|
48
48
|
*/
|
|
49
49
|
constructor(client) {
|
|
50
50
|
super(client);
|
|
51
|
-
this.name =
|
|
52
|
-
this.description =
|
|
51
|
+
this.name = "upload_file";
|
|
52
|
+
this.description = "Uploads a file to a field in a Quickbase record";
|
|
53
53
|
/**
|
|
54
54
|
* Parameter schema for upload_file
|
|
55
55
|
*/
|
|
56
56
|
this.paramSchema = {
|
|
57
|
-
type:
|
|
57
|
+
type: "object",
|
|
58
58
|
properties: {
|
|
59
59
|
table_id: {
|
|
60
|
-
type:
|
|
61
|
-
description:
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "The ID of the table (must be a file attachment field)",
|
|
62
62
|
},
|
|
63
63
|
record_id: {
|
|
64
|
-
type:
|
|
65
|
-
description:
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "The ID of the record",
|
|
66
66
|
},
|
|
67
67
|
field_id: {
|
|
68
|
-
type:
|
|
69
|
-
description:
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "The ID of the field (must be a file attachment field)",
|
|
70
70
|
},
|
|
71
71
|
file_path: {
|
|
72
|
-
type:
|
|
73
|
-
description:
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Path to the file to upload",
|
|
74
74
|
},
|
|
75
75
|
file_name: {
|
|
76
|
-
type:
|
|
77
|
-
description:
|
|
78
|
-
}
|
|
76
|
+
type: "string",
|
|
77
|
+
description: "Custom file name (optional, defaults to the original filename)",
|
|
78
|
+
},
|
|
79
79
|
},
|
|
80
|
-
required: [
|
|
80
|
+
required: ["table_id", "record_id", "field_id", "file_path"],
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
@@ -87,11 +87,11 @@ class UploadFileTool extends base_1.BaseTool {
|
|
|
87
87
|
*/
|
|
88
88
|
async run(params) {
|
|
89
89
|
const { table_id, record_id, field_id, file_path, file_name } = params;
|
|
90
|
-
logger.info(
|
|
90
|
+
logger.info("Uploading file to Quickbase record", {
|
|
91
91
|
tableId: table_id,
|
|
92
92
|
recordId: record_id,
|
|
93
93
|
fieldId: field_id,
|
|
94
|
-
filePath: file_path
|
|
94
|
+
filePath: file_path,
|
|
95
95
|
});
|
|
96
96
|
// Check if the file exists
|
|
97
97
|
if (!(0, file_1.fileExists)(file_path)) {
|
|
@@ -108,15 +108,17 @@ class UploadFileTool extends base_1.BaseTool {
|
|
|
108
108
|
throw new Error(`File size ${fileInfo.size} bytes exceeds maximum allowed size of ${MAX_FILE_SIZE} bytes`);
|
|
109
109
|
}
|
|
110
110
|
// Secure file path validation - prevent directory traversal attacks
|
|
111
|
-
const path = await Promise.resolve().then(() => __importStar(require(
|
|
112
|
-
const fs = await Promise.resolve().then(() => __importStar(require(
|
|
111
|
+
const path = await Promise.resolve().then(() => __importStar(require("path")));
|
|
112
|
+
const fs = await Promise.resolve().then(() => __importStar(require("fs")));
|
|
113
113
|
// First, validate the input path before any resolution
|
|
114
|
-
if (!file_path || typeof file_path !==
|
|
115
|
-
throw new Error(
|
|
114
|
+
if (!file_path || typeof file_path !== "string") {
|
|
115
|
+
throw new Error("Invalid file path: must be a non-empty string");
|
|
116
116
|
}
|
|
117
117
|
// Reject obvious traversal attempts immediately
|
|
118
|
-
if (file_path.includes(
|
|
119
|
-
|
|
118
|
+
if (file_path.includes("..") ||
|
|
119
|
+
file_path.startsWith("/") ||
|
|
120
|
+
file_path.includes("\\")) {
|
|
121
|
+
throw new Error("Invalid file path: directory traversal detected");
|
|
120
122
|
}
|
|
121
123
|
// Define allowed working directory (current directory only)
|
|
122
124
|
const workingDir = process.cwd();
|
|
@@ -126,11 +128,12 @@ class UploadFileTool extends base_1.BaseTool {
|
|
|
126
128
|
resolvedPath = path.resolve(workingDir, file_path);
|
|
127
129
|
}
|
|
128
130
|
catch (error) {
|
|
129
|
-
throw new Error(
|
|
131
|
+
throw new Error("Invalid file path format");
|
|
130
132
|
}
|
|
131
133
|
// Critical security check: ensure resolved path is within working directory
|
|
132
|
-
if (!resolvedPath.startsWith(workingDir + path.sep) &&
|
|
133
|
-
|
|
134
|
+
if (!resolvedPath.startsWith(workingDir + path.sep) &&
|
|
135
|
+
resolvedPath !== workingDir) {
|
|
136
|
+
throw new Error("Invalid file path: access outside working directory denied");
|
|
134
137
|
}
|
|
135
138
|
// Verify file exists and is readable
|
|
136
139
|
try {
|
|
@@ -143,15 +146,20 @@ class UploadFileTool extends base_1.BaseTool {
|
|
|
143
146
|
const CHUNK_SIZE = 1024 * 1024; // 1MB chunks
|
|
144
147
|
let fileBase64;
|
|
145
148
|
try {
|
|
146
|
-
if (fileInfo.size > 10 * 1024 * 1024) {
|
|
147
|
-
|
|
149
|
+
if (fileInfo.size > 10 * 1024 * 1024) {
|
|
150
|
+
// > 10MB, use streaming
|
|
151
|
+
logger.debug("Using streaming read for large file", {
|
|
152
|
+
size: fileInfo.size,
|
|
153
|
+
});
|
|
148
154
|
// Stream the file in chunks to prevent memory overflow
|
|
149
155
|
const chunks = [];
|
|
150
|
-
const readStream = fs.createReadStream(resolvedPath, {
|
|
156
|
+
const readStream = fs.createReadStream(resolvedPath, {
|
|
157
|
+
highWaterMark: CHUNK_SIZE,
|
|
158
|
+
});
|
|
151
159
|
for await (const chunk of readStream) {
|
|
152
|
-
chunks.push(chunk.toString(
|
|
160
|
+
chunks.push(chunk.toString("base64"));
|
|
153
161
|
}
|
|
154
|
-
fileBase64 = chunks.join(
|
|
162
|
+
fileBase64 = chunks.join("");
|
|
155
163
|
}
|
|
156
164
|
else {
|
|
157
165
|
// Small files can be read directly
|
|
@@ -159,11 +167,11 @@ class UploadFileTool extends base_1.BaseTool {
|
|
|
159
167
|
if (!fileBuffer) {
|
|
160
168
|
throw new Error(`Unable to read file: ${file_path}`);
|
|
161
169
|
}
|
|
162
|
-
fileBase64 = fileBuffer.toString(
|
|
170
|
+
fileBase64 = fileBuffer.toString("base64");
|
|
163
171
|
}
|
|
164
172
|
}
|
|
165
173
|
catch (error) {
|
|
166
|
-
throw new Error(`Failed to read file: ${error instanceof Error ? error.message :
|
|
174
|
+
throw new Error(`Failed to read file: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
167
175
|
}
|
|
168
176
|
// Prepare the file upload request
|
|
169
177
|
const body = {
|
|
@@ -172,29 +180,29 @@ class UploadFileTool extends base_1.BaseTool {
|
|
|
172
180
|
fieldId: field_id,
|
|
173
181
|
fileName: file_name || fileInfo.name,
|
|
174
182
|
contentType: fileInfo.mimeType,
|
|
175
|
-
fileData: fileBase64
|
|
183
|
+
fileData: fileBase64,
|
|
176
184
|
};
|
|
177
185
|
// Upload the file
|
|
178
186
|
const response = await this.client.request({
|
|
179
|
-
method:
|
|
180
|
-
path:
|
|
181
|
-
body
|
|
187
|
+
method: "POST",
|
|
188
|
+
path: "/files",
|
|
189
|
+
body,
|
|
182
190
|
});
|
|
183
191
|
if (!response.success || !response.data) {
|
|
184
|
-
logger.error(
|
|
192
|
+
logger.error("Failed to upload file", {
|
|
185
193
|
error: response.error,
|
|
186
194
|
tableId: table_id,
|
|
187
195
|
recordId: record_id,
|
|
188
|
-
fieldId: field_id
|
|
196
|
+
fieldId: field_id,
|
|
189
197
|
});
|
|
190
|
-
throw new Error(response.error?.message ||
|
|
198
|
+
throw new Error(response.error?.message || "Failed to upload file");
|
|
191
199
|
}
|
|
192
200
|
const fileData = response.data;
|
|
193
|
-
logger.info(
|
|
201
|
+
logger.info("Successfully uploaded file", {
|
|
194
202
|
tableId: table_id,
|
|
195
203
|
recordId: record_id,
|
|
196
204
|
fieldId: field_id,
|
|
197
|
-
fileName: file_name || fileInfo.name
|
|
205
|
+
fileName: file_name || fileInfo.name,
|
|
198
206
|
});
|
|
199
207
|
return {
|
|
200
208
|
recordId: record_id,
|
|
@@ -203,7 +211,7 @@ class UploadFileTool extends base_1.BaseTool {
|
|
|
203
211
|
fileName: file_name || fileInfo.name,
|
|
204
212
|
fileSize: fileInfo.size,
|
|
205
213
|
version: fileData.version || 1,
|
|
206
|
-
uploadTime: new Date().toISOString()
|
|
214
|
+
uploadTime: new Date().toISOString(),
|
|
207
215
|
};
|
|
208
216
|
}
|
|
209
217
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload_file.js","sourceRoot":"","sources":["../../../src/tools/files/upload_file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAmC;AAEnC,+CAAkD;AAClD,2CAA6E;AAE7E,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,gBAAgB,CAAC,CAAC;AAwE9C;;GAEG;AACH,MAAa,cAAe,SAAQ,
|
|
1
|
+
{"version":3,"file":"upload_file.js","sourceRoot":"","sources":["../../../src/tools/files/upload_file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAmC;AAEnC,+CAAkD;AAClD,2CAA6E;AAE7E,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,gBAAgB,CAAC,CAAC;AAwE9C;;GAEG;AACH,MAAa,cAAe,SAAQ,eAGnC;IAmCC;;;OAGG;IACH,YAAY,MAAuB;QACjC,KAAK,CAAC,MAAM,CAAC,CAAC;QAvCT,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,iDAAiD,CAAC;QAEvE;;WAEG;QACI,gBAAW,GAAG;YACnB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,uDAAuD;iBACrE;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sBAAsB;iBACpC;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,uDAAuD;iBACrE;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,4BAA4B;iBAC1C;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,gEAAgE;iBACnE;aACF;YACD,QAAQ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OAAO,CAAC;YACzC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,QAAQ;YACd,IAAI;SACL,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACxC,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE;gBACpC,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,OAAO,EAAE,QAAQ;gBACjB,QAAQ,EAAE,SAAS;gBACnB,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,IAAI,uBAAuB,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAA2B,CAAC;QAEtD,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACxC,OAAO,EAAE,QAAQ;YACjB,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,QAAQ;YACjB,QAAQ,EAAE,SAAS,IAAI,QAAQ,CAAC,IAAI;SACrC,CAAC,CAAC;QAEH,OAAO;YACL,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,QAAQ;YACjB,QAAQ,EAAE,SAAS,IAAI,QAAQ,CAAC,IAAI;YACpC,QAAQ,EAAE,QAAQ,CAAC,IAAI;YACvB,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,CAAC;YAC9B,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC;IACJ,CAAC;CACF;AAlND,wCAkNC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { QuickbaseClient } from
|
|
2
|
-
import { CacheService } from
|
|
1
|
+
import { QuickbaseClient } from "../client/quickbase";
|
|
2
|
+
import { CacheService } from "../utils/cache";
|
|
3
3
|
/**
|
|
4
4
|
* Initialize all MCP tools and register them with the registry
|
|
5
5
|
* @param client Quickbase client
|
|
6
6
|
* @param cacheService Cache service
|
|
7
7
|
*/
|
|
8
8
|
export declare function initializeTools(client: QuickbaseClient, cacheService: CacheService): void;
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
9
|
+
export * from "./registry";
|
|
10
|
+
export * from "./base";
|
|
11
|
+
export * from "./test_connection";
|
|
12
|
+
export * from "./configure_cache";
|
|
13
|
+
export * from "./apps";
|
|
14
|
+
export * from "./tables";
|
|
15
|
+
export * from "./fields";
|
|
16
|
+
export * from "./records";
|
|
17
|
+
export * from "./files";
|
|
18
|
+
export * from "./reports";
|
|
19
|
+
export * from "./relationships";
|
package/dist/tools/index.js
CHANGED
|
@@ -24,15 +24,16 @@ const fields_1 = require("./fields");
|
|
|
24
24
|
const records_1 = require("./records");
|
|
25
25
|
const files_1 = require("./files");
|
|
26
26
|
const reports_1 = require("./reports");
|
|
27
|
+
const relationships_1 = require("./relationships");
|
|
27
28
|
const logger_1 = require("../utils/logger");
|
|
28
|
-
const logger = (0, logger_1.createLogger)(
|
|
29
|
+
const logger = (0, logger_1.createLogger)("ToolsInit");
|
|
29
30
|
/**
|
|
30
31
|
* Initialize all MCP tools and register them with the registry
|
|
31
32
|
* @param client Quickbase client
|
|
32
33
|
* @param cacheService Cache service
|
|
33
34
|
*/
|
|
34
35
|
function initializeTools(client, cacheService) {
|
|
35
|
-
logger.info(
|
|
36
|
+
logger.info("Initializing MCP tools");
|
|
36
37
|
// Register connection tools
|
|
37
38
|
registry_1.toolRegistry.registerTool(new test_connection_1.TestConnectionTool(client));
|
|
38
39
|
registry_1.toolRegistry.registerTool(new configure_cache_1.ConfigureCacheTool(client, cacheService));
|
|
@@ -48,7 +49,8 @@ function initializeTools(client, cacheService) {
|
|
|
48
49
|
(0, files_1.registerFileTools)(client);
|
|
49
50
|
// Register report operation tools
|
|
50
51
|
(0, reports_1.registerReportTools)(client);
|
|
51
|
-
//
|
|
52
|
+
// Register relationship management tools
|
|
53
|
+
(0, relationships_1.registerRelationshipTools)(client);
|
|
52
54
|
logger.info(`Registered ${registry_1.toolRegistry.getToolCount()} tools`);
|
|
53
55
|
}
|
|
54
56
|
// Export all tools and related types
|
|
@@ -62,4 +64,5 @@ __exportStar(require("./fields"), exports);
|
|
|
62
64
|
__exportStar(require("./records"), exports);
|
|
63
65
|
__exportStar(require("./files"), exports);
|
|
64
66
|
__exportStar(require("./reports"), exports);
|
|
67
|
+
__exportStar(require("./relationships"), exports);
|
|
65
68
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAqBA,0CAgCC;AAnDD,yCAA0C;AAC1C,uDAAuD;AACvD,uDAAuD;AACvD,iCAA0C;AAC1C,qCAA8C;AAC9C,qCAA8C;AAC9C,uCAAgD;AAChD,mCAA4C;AAC5C,uCAAgD;AAChD,mDAA4D;AAC5D,4CAA+C;AAE/C,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,WAAW,CAAC,CAAC;AAEzC;;;;GAIG;AACH,SAAgB,eAAe,CAC7B,MAAuB,EACvB,YAA0B;IAE1B,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAEtC,4BAA4B;IAC5B,uBAAY,CAAC,YAAY,CAAC,IAAI,oCAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1D,uBAAY,CAAC,YAAY,CAAC,IAAI,oCAAkB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAExE,gCAAgC;IAChC,IAAA,uBAAgB,EAAC,MAAM,CAAC,CAAC;IAEzB,iCAAiC;IACjC,IAAA,2BAAkB,EAAC,MAAM,CAAC,CAAC;IAE3B,kCAAkC;IAClC,IAAA,2BAAkB,EAAC,MAAM,CAAC,CAAC;IAE3B,kCAAkC;IAClC,IAAA,6BAAmB,EAAC,MAAM,CAAC,CAAC;IAE5B,gCAAgC;IAChC,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;IAE1B,kCAAkC;IAClC,IAAA,6BAAmB,EAAC,MAAM,CAAC,CAAC;IAE5B,yCAAyC;IACzC,IAAA,yCAAyB,EAAC,MAAM,CAAC,CAAC;IAElC,MAAM,CAAC,IAAI,CAAC,cAAc,uBAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC;AAED,qCAAqC;AACrC,6CAA2B;AAC3B,yCAAuB;AACvB,oDAAkC;AAClC,oDAAkC;AAClC,yCAAuB;AACvB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,4CAA0B;AAC1B,kDAAgC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BulkCreateRecordsTool = void 0;
|
|
4
4
|
const base_1 = require("../base");
|
|
5
5
|
const logger_1 = require("../../utils/logger");
|
|
6
|
-
const logger = (0, logger_1.createLogger)(
|
|
6
|
+
const logger = (0, logger_1.createLogger)("BulkCreateRecordsTool");
|
|
7
7
|
/**
|
|
8
8
|
* Tool for creating multiple records in a Quickbase table
|
|
9
9
|
*/
|
|
@@ -14,28 +14,28 @@ class BulkCreateRecordsTool extends base_1.BaseTool {
|
|
|
14
14
|
*/
|
|
15
15
|
constructor(client) {
|
|
16
16
|
super(client);
|
|
17
|
-
this.name =
|
|
18
|
-
this.description =
|
|
17
|
+
this.name = "bulk_create_records";
|
|
18
|
+
this.description = "Creates multiple records in a Quickbase table";
|
|
19
19
|
/**
|
|
20
20
|
* Parameter schema for bulk_create_records
|
|
21
21
|
*/
|
|
22
22
|
this.paramSchema = {
|
|
23
|
-
type:
|
|
23
|
+
type: "object",
|
|
24
24
|
properties: {
|
|
25
25
|
table_id: {
|
|
26
|
-
type:
|
|
27
|
-
description:
|
|
26
|
+
type: "string",
|
|
27
|
+
description: "The ID of the Quickbase table",
|
|
28
28
|
},
|
|
29
29
|
records: {
|
|
30
|
-
type:
|
|
31
|
-
description:
|
|
30
|
+
type: "array",
|
|
31
|
+
description: "Array of record data to insert",
|
|
32
32
|
items: {
|
|
33
|
-
type:
|
|
34
|
-
additionalProperties: true
|
|
35
|
-
}
|
|
36
|
-
}
|
|
33
|
+
type: "object",
|
|
34
|
+
additionalProperties: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
37
|
},
|
|
38
|
-
required: [
|
|
38
|
+
required: ["table_id", "records"],
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -47,14 +47,14 @@ class BulkCreateRecordsTool extends base_1.BaseTool {
|
|
|
47
47
|
const { table_id, records } = params;
|
|
48
48
|
logger.info(`Bulk creating ${records.length} records in Quickbase table`, {
|
|
49
49
|
tableId: table_id,
|
|
50
|
-
recordCount: records.length
|
|
50
|
+
recordCount: records.length,
|
|
51
51
|
});
|
|
52
52
|
// Validate records
|
|
53
53
|
if (!records || !Array.isArray(records) || records.length === 0) {
|
|
54
|
-
throw new Error(
|
|
54
|
+
throw new Error("Records array is required and must not be empty");
|
|
55
55
|
}
|
|
56
56
|
// Prepare record data
|
|
57
|
-
const formattedRecords = records.map(record => {
|
|
57
|
+
const formattedRecords = records.map((record) => {
|
|
58
58
|
const recordData = {};
|
|
59
59
|
for (const [field, value] of Object.entries(record)) {
|
|
60
60
|
recordData[field] = { value };
|
|
@@ -64,39 +64,39 @@ class BulkCreateRecordsTool extends base_1.BaseTool {
|
|
|
64
64
|
// Prepare request body
|
|
65
65
|
const body = {
|
|
66
66
|
to: table_id,
|
|
67
|
-
data: formattedRecords
|
|
67
|
+
data: formattedRecords,
|
|
68
68
|
};
|
|
69
69
|
// Create the records
|
|
70
70
|
const response = await this.client.request({
|
|
71
|
-
method:
|
|
72
|
-
path:
|
|
73
|
-
body
|
|
71
|
+
method: "POST",
|
|
72
|
+
path: "/records",
|
|
73
|
+
body,
|
|
74
74
|
});
|
|
75
75
|
if (!response.success || !response.data) {
|
|
76
|
-
logger.error(
|
|
76
|
+
logger.error("Failed to bulk create records", {
|
|
77
77
|
error: response.error,
|
|
78
|
-
tableId: table_id
|
|
78
|
+
tableId: table_id,
|
|
79
79
|
});
|
|
80
|
-
throw new Error(response.error?.message ||
|
|
80
|
+
throw new Error(response.error?.message || "Failed to bulk create records");
|
|
81
81
|
}
|
|
82
82
|
const result = response.data;
|
|
83
83
|
const metadata = result.metadata || {};
|
|
84
84
|
if (!metadata.createdRecordIds || metadata.createdRecordIds.length === 0) {
|
|
85
|
-
logger.error(
|
|
86
|
-
response: result
|
|
85
|
+
logger.error("Bulk record creation response missing record IDs", {
|
|
86
|
+
response: result,
|
|
87
87
|
});
|
|
88
|
-
throw new Error(
|
|
88
|
+
throw new Error("Records created but no record IDs were returned");
|
|
89
89
|
}
|
|
90
90
|
const recordIds = metadata.createdRecordIds;
|
|
91
91
|
logger.info(`Successfully created ${recordIds.length} records`, {
|
|
92
92
|
recordCount: recordIds.length,
|
|
93
|
-
tableId: table_id
|
|
93
|
+
tableId: table_id,
|
|
94
94
|
});
|
|
95
95
|
return {
|
|
96
96
|
recordIds,
|
|
97
97
|
tableId: table_id,
|
|
98
98
|
createdCount: recordIds.length,
|
|
99
|
-
createdTime: new Date().toISOString()
|
|
99
|
+
createdTime: new Date().toISOString(),
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk_create_records.js","sourceRoot":"","sources":["../../../src/tools/records/bulk_create_records.ts"],"names":[],"mappings":";;;AAAA,kCAAmC;AAEnC,+CAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,uBAAuB,CAAC,CAAC;AA0CrD;;GAEG;AACH,MAAa,qBAAsB,SAAQ,
|
|
1
|
+
{"version":3,"file":"bulk_create_records.js","sourceRoot":"","sources":["../../../src/tools/records/bulk_create_records.ts"],"names":[],"mappings":";;;AAAA,kCAAmC;AAEnC,+CAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,uBAAuB,CAAC,CAAC;AA0CrD;;GAEG;AACH,MAAa,qBAAsB,SAAQ,eAG1C;IA0BC;;;OAGG;IACH,YAAY,MAAuB;QACjC,KAAK,CAAC,MAAM,CAAC,CAAC;QA9BT,SAAI,GAAG,qBAAqB,CAAC;QAC7B,gBAAW,GAAG,+CAA+C,CAAC;QAErE;;WAEG;QACI,gBAAW,GAAG;YACnB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,+BAA+B;iBAC7C;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,gCAAgC;oBAC7C,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,oBAAoB,EAAE,IAAI;qBAC3B;iBACF;aACF;YACD,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;SAClC,CAAC;IAQF,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,GAAG,CACjB,MAA+B;QAE/B,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAErC,MAAM,CAAC,IAAI,CAAC,iBAAiB,OAAO,CAAC,MAAM,6BAA6B,EAAE;YACxE,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,OAAO,CAAC,MAAM;SAC5B,CAAC,CAAC;QAEH,mBAAmB;QACnB,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CA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CAAC,EAAE,CAAC;YACzE,MAAM,CAAC,KAAK,CAAC,kDAAkD,EAAE;gBAC/D,QAAQ,EAAE,MAAM;aACjB,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QAED,MAAM,SAAS,GAAG,QAAQ,CAAC,gBAAgB,CAAC;QAE5C,MAAM,CAAC,IAAI,CAAC,wBAAwB,SAAS,CAAC,MAAM,UAAU,EAAE;YAC9D,WAAW,EAAE,SAAS,CAAC,MAAM;YAC7B,OAAO,EAAE,QAAQ;SAClB,CAAC,CAAC;QAEH,OAAO;YACL,SAAS;YACT,OAAO,EAAE,QAAQ;YACjB,YAAY,EAAE,SAAS,CAAC,MAAM;YAC9B,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;IACJ,CAAC;CACF;AAnHD,sDAmHC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BulkUpdateRecordsTool = void 0;
|
|
4
4
|
const base_1 = require("../base");
|
|
5
5
|
const logger_1 = require("../../utils/logger");
|
|
6
|
-
const logger = (0, logger_1.createLogger)(
|
|
6
|
+
const logger = (0, logger_1.createLogger)("BulkUpdateRecordsTool");
|
|
7
7
|
/**
|
|
8
8
|
* Tool for updating multiple records in a Quickbase table
|
|
9
9
|
*/
|
|
@@ -14,28 +14,28 @@ class BulkUpdateRecordsTool extends base_1.BaseTool {
|
|
|
14
14
|
*/
|
|
15
15
|
constructor(client) {
|
|
16
16
|
super(client);
|
|
17
|
-
this.name =
|
|
18
|
-
this.description =
|
|
17
|
+
this.name = "bulk_update_records";
|
|
18
|
+
this.description = "Updates multiple records in a Quickbase table";
|
|
19
19
|
/**
|
|
20
20
|
* Parameter schema for bulk_update_records
|
|
21
21
|
*/
|
|
22
22
|
this.paramSchema = {
|
|
23
|
-
type:
|
|
23
|
+
type: "object",
|
|
24
24
|
properties: {
|
|
25
25
|
table_id: {
|
|
26
|
-
type:
|
|
27
|
-
description:
|
|
26
|
+
type: "string",
|
|
27
|
+
description: "The ID of the Quickbase table",
|
|
28
28
|
},
|
|
29
29
|
records: {
|
|
30
|
-
type:
|
|
31
|
-
description:
|
|
30
|
+
type: "array",
|
|
31
|
+
description: "Array of record data to update (must include record IDs)",
|
|
32
32
|
items: {
|
|
33
|
-
type:
|
|
34
|
-
additionalProperties: true
|
|
35
|
-
}
|
|
36
|
-
}
|
|
33
|
+
type: "object",
|
|
34
|
+
additionalProperties: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
37
|
},
|
|
38
|
-
required: [
|
|
38
|
+
required: ["table_id", "records"],
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -47,19 +47,19 @@ class BulkUpdateRecordsTool extends base_1.BaseTool {
|
|
|
47
47
|
const { table_id, records } = params;
|
|
48
48
|
logger.info(`Bulk updating ${records.length} records in Quickbase table`, {
|
|
49
49
|
tableId: table_id,
|
|
50
|
-
recordCount: records.length
|
|
50
|
+
recordCount: records.length,
|
|
51
51
|
});
|
|
52
52
|
// Validate records
|
|
53
53
|
if (!records || !Array.isArray(records) || records.length === 0) {
|
|
54
|
-
throw new Error(
|
|
54
|
+
throw new Error("Records array is required and must not be empty");
|
|
55
55
|
}
|
|
56
56
|
// Check if all records have IDs
|
|
57
|
-
const missingIds = records.some(record => !record.id);
|
|
57
|
+
const missingIds = records.some((record) => !record.id);
|
|
58
58
|
if (missingIds) {
|
|
59
59
|
throw new Error('All records must include an "id" field for bulk updates');
|
|
60
60
|
}
|
|
61
61
|
// Prepare record data
|
|
62
|
-
const formattedRecords = records.map(record => {
|
|
62
|
+
const formattedRecords = records.map((record) => {
|
|
63
63
|
const { id, ...fields } = record;
|
|
64
64
|
const recordData = { id };
|
|
65
65
|
for (const [field, value] of Object.entries(fields)) {
|
|
@@ -70,31 +70,31 @@ class BulkUpdateRecordsTool extends base_1.BaseTool {
|
|
|
70
70
|
// Prepare request body
|
|
71
71
|
const body = {
|
|
72
72
|
to: table_id,
|
|
73
|
-
data: formattedRecords
|
|
73
|
+
data: formattedRecords,
|
|
74
74
|
};
|
|
75
75
|
// Update the records
|
|
76
76
|
const response = await this.client.request({
|
|
77
|
-
method:
|
|
78
|
-
path:
|
|
79
|
-
body
|
|
77
|
+
method: "POST",
|
|
78
|
+
path: "/records",
|
|
79
|
+
body,
|
|
80
80
|
});
|
|
81
81
|
if (!response.success || !response.data) {
|
|
82
|
-
logger.error(
|
|
82
|
+
logger.error("Failed to bulk update records", {
|
|
83
83
|
error: response.error,
|
|
84
|
-
tableId: table_id
|
|
84
|
+
tableId: table_id,
|
|
85
85
|
});
|
|
86
|
-
throw new Error(response.error?.message ||
|
|
86
|
+
throw new Error(response.error?.message || "Failed to bulk update records");
|
|
87
87
|
}
|
|
88
|
-
const recordIds = records.map(record => record.id);
|
|
88
|
+
const recordIds = records.map((record) => record.id);
|
|
89
89
|
logger.info(`Successfully updated ${recordIds.length} records`, {
|
|
90
90
|
recordCount: recordIds.length,
|
|
91
|
-
tableId: table_id
|
|
91
|
+
tableId: table_id,
|
|
92
92
|
});
|
|
93
93
|
return {
|
|
94
94
|
recordIds,
|
|
95
95
|
tableId: table_id,
|
|
96
96
|
updatedCount: recordIds.length,
|
|
97
|
-
updatedTime: new Date().toISOString()
|
|
97
|
+
updatedTime: new Date().toISOString(),
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk_update_records.js","sourceRoot":"","sources":["../../../src/tools/records/bulk_update_records.ts"],"names":[],"mappings":";;;AAAA,kCAAmC;AAEnC,+CAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,uBAAuB,CAAC,CAAC;AA0CrD;;GAEG;AACH,MAAa,qBAAsB,SAAQ,
|
|
1
|
+
{"version":3,"file":"bulk_update_records.js","sourceRoot":"","sources":["../../../src/tools/records/bulk_update_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