mcp-quickbase 2.0.1
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/CHANGELOG.md +82 -0
- package/LICENSE +21 -0
- package/README.md +301 -0
- package/dist/client/quickbase.d.ts +28 -0
- package/dist/client/quickbase.js +235 -0
- package/dist/client/quickbase.js.map +1 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.js +21 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +19 -0
- package/dist/mcp/server.js +102 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp-stdio-server.d.ts +2 -0
- package/dist/mcp-stdio-server.js +168 -0
- package/dist/mcp-stdio-server.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +318 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/apps/create_app.d.ts +87 -0
- package/dist/tools/apps/create_app.js +87 -0
- package/dist/tools/apps/create_app.js.map +1 -0
- package/dist/tools/apps/index.d.ts +9 -0
- package/dist/tools/apps/index.js +40 -0
- package/dist/tools/apps/index.js.map +1 -0
- package/dist/tools/apps/list_tables.d.ts +108 -0
- package/dist/tools/apps/list_tables.js +100 -0
- package/dist/tools/apps/list_tables.js.map +1 -0
- package/dist/tools/apps/update_app.d.ts +91 -0
- package/dist/tools/apps/update_app.js +99 -0
- package/dist/tools/apps/update_app.js.map +1 -0
- package/dist/tools/base.d.ts +47 -0
- package/dist/tools/base.js +63 -0
- package/dist/tools/base.js.map +1 -0
- package/dist/tools/configure_cache.d.ts +81 -0
- package/dist/tools/configure_cache.js +77 -0
- package/dist/tools/configure_cache.js.map +1 -0
- package/dist/tools/fields/create_field.d.ts +121 -0
- package/dist/tools/fields/create_field.js +102 -0
- package/dist/tools/fields/create_field.js.map +1 -0
- package/dist/tools/fields/index.d.ts +8 -0
- package/dist/tools/fields/index.js +37 -0
- package/dist/tools/fields/index.js.map +1 -0
- package/dist/tools/fields/update_field.d.ts +112 -0
- package/dist/tools/fields/update_field.js +114 -0
- package/dist/tools/fields/update_field.js.map +1 -0
- package/dist/tools/files/download_file.d.ts +111 -0
- package/dist/tools/files/download_file.js +173 -0
- package/dist/tools/files/download_file.js.map +1 -0
- package/dist/tools/files/index.d.ts +8 -0
- package/dist/tools/files/index.js +37 -0
- package/dist/tools/files/index.js.map +1 -0
- package/dist/tools/files/upload_file.d.ts +107 -0
- package/dist/tools/files/upload_file.js +211 -0
- package/dist/tools/files/upload_file.js.map +1 -0
- package/dist/tools/index.d.ts +18 -0
- package/dist/tools/index.js +65 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/records/bulk_create_records.d.ts +75 -0
- package/dist/tools/records/bulk_create_records.js +104 -0
- package/dist/tools/records/bulk_create_records.js.map +1 -0
- package/dist/tools/records/bulk_update_records.d.ts +77 -0
- package/dist/tools/records/bulk_update_records.js +102 -0
- package/dist/tools/records/bulk_update_records.js.map +1 -0
- package/dist/tools/records/create_record.d.ts +68 -0
- package/dist/tools/records/create_record.js +123 -0
- package/dist/tools/records/create_record.js.map +1 -0
- package/dist/tools/records/index.d.ts +11 -0
- package/dist/tools/records/index.js +46 -0
- package/dist/tools/records/index.js.map +1 -0
- package/dist/tools/records/query_records.d.ts +164 -0
- package/dist/tools/records/query_records.js +261 -0
- package/dist/tools/records/query_records.js.map +1 -0
- package/dist/tools/records/update_record.d.ts +81 -0
- package/dist/tools/records/update_record.js +99 -0
- package/dist/tools/records/update_record.js.map +1 -0
- package/dist/tools/registry.d.ts +41 -0
- package/dist/tools/registry.js +66 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/reports/index.d.ts +6 -0
- package/dist/tools/reports/index.js +31 -0
- package/dist/tools/reports/index.js.map +1 -0
- package/dist/tools/reports/run_report.d.ts +70 -0
- package/dist/tools/reports/run_report.js +72 -0
- package/dist/tools/reports/run_report.js.map +1 -0
- package/dist/tools/tables/create_table.d.ts +142 -0
- package/dist/tools/tables/create_table.js +119 -0
- package/dist/tools/tables/create_table.js.map +1 -0
- package/dist/tools/tables/get_table_fields.d.ts +108 -0
- package/dist/tools/tables/get_table_fields.js +96 -0
- package/dist/tools/tables/get_table_fields.js.map +1 -0
- package/dist/tools/tables/index.d.ts +9 -0
- package/dist/tools/tables/index.js +40 -0
- package/dist/tools/tables/index.js.map +1 -0
- package/dist/tools/tables/update_table.d.ts +91 -0
- package/dist/tools/tables/update_table.js +99 -0
- package/dist/tools/tables/update_table.js.map +1 -0
- package/dist/tools/test_connection.d.ts +51 -0
- package/dist/tools/test_connection.js +101 -0
- package/dist/tools/test_connection.js.map +1 -0
- package/dist/types/api.d.ts +70 -0
- package/dist/types/api.js +6 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/config.d.ts +49 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/mcp.d.ts +55 -0
- package/dist/types/mcp.js +3 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/utils/cache.d.ts +87 -0
- package/dist/utils/cache.js +211 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/file.d.ts +40 -0
- package/dist/utils/file.js +167 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/logger.d.ts +37 -0
- package/dist/utils/logger.js +144 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/retry.d.ts +39 -0
- package/dist/utils/retry.js +88 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/validation.d.ts +32 -0
- package/dist/utils/validation.js +227 -0
- package/dist/utils/validation.js.map +1 -0
- package/docs/README.md +41 -0
- package/docs/architecture.md +94 -0
- package/docs/claude-prompts.md +218 -0
- package/docs/deployment.md +244 -0
- package/docs/developer-guide.md +537 -0
- package/docs/final-qa-report.md +243 -0
- package/docs/performance-benchmarks.md +306 -0
- package/docs/quick-reference.md +109 -0
- package/docs/quickstart.md +183 -0
- package/docs/security-review.md +263 -0
- package/docs/tools.md +269 -0
- package/package.json +68 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryRecordsTool = void 0;
|
|
4
|
+
const base_1 = require("../base");
|
|
5
|
+
const logger_1 = require("../../utils/logger");
|
|
6
|
+
const logger = (0, logger_1.createLogger)('QueryRecordsTool');
|
|
7
|
+
/**
|
|
8
|
+
* Tool for querying records from a Quickbase table
|
|
9
|
+
*/
|
|
10
|
+
class QueryRecordsTool extends base_1.BaseTool {
|
|
11
|
+
/**
|
|
12
|
+
* Constructor
|
|
13
|
+
* @param client Quickbase client
|
|
14
|
+
*/
|
|
15
|
+
constructor(client) {
|
|
16
|
+
super(client);
|
|
17
|
+
this.name = 'query_records';
|
|
18
|
+
this.description = 'Executes a query against a Quickbase table with optional pagination';
|
|
19
|
+
/**
|
|
20
|
+
* Parameter schema for query_records
|
|
21
|
+
*/
|
|
22
|
+
this.paramSchema = {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
table_id: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'The ID of the Quickbase table'
|
|
28
|
+
},
|
|
29
|
+
where: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'Query criteria'
|
|
32
|
+
},
|
|
33
|
+
select: {
|
|
34
|
+
type: 'array',
|
|
35
|
+
description: 'Fields to select',
|
|
36
|
+
items: {
|
|
37
|
+
type: 'string'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
orderBy: {
|
|
41
|
+
type: 'array',
|
|
42
|
+
description: 'Fields to order results by',
|
|
43
|
+
items: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
properties: {
|
|
46
|
+
fieldId: {
|
|
47
|
+
type: 'string'
|
|
48
|
+
},
|
|
49
|
+
order: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
enum: ['ASC', 'DESC']
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
max_records: {
|
|
57
|
+
type: 'number',
|
|
58
|
+
description: 'Maximum number of records to return when paginating (default: 1000)'
|
|
59
|
+
},
|
|
60
|
+
skip: {
|
|
61
|
+
type: 'number',
|
|
62
|
+
description: 'Number of records to skip'
|
|
63
|
+
},
|
|
64
|
+
paginate: {
|
|
65
|
+
type: 'boolean',
|
|
66
|
+
description: 'Whether to automatically handle pagination for large result sets'
|
|
67
|
+
},
|
|
68
|
+
options: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
description: 'Query options for filtering, ordering, and pagination'
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
required: ['table_id']
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Run the query_records tool
|
|
78
|
+
* @param params Tool parameters
|
|
79
|
+
* @returns Queried records
|
|
80
|
+
*/
|
|
81
|
+
async run(params) {
|
|
82
|
+
const { table_id, where, select, orderBy, max_records = 1000, skip = 0, paginate = false, options } = params;
|
|
83
|
+
logger.info('Querying records from Quickbase table', {
|
|
84
|
+
tableId: table_id,
|
|
85
|
+
maxRecords: max_records,
|
|
86
|
+
pagination: paginate ? 'enabled' : 'disabled'
|
|
87
|
+
});
|
|
88
|
+
// Prepare the query body
|
|
89
|
+
const body = {
|
|
90
|
+
from: table_id
|
|
91
|
+
};
|
|
92
|
+
// Add where clause if provided
|
|
93
|
+
if (where) {
|
|
94
|
+
body.where = where;
|
|
95
|
+
}
|
|
96
|
+
// Add select clause if provided
|
|
97
|
+
if (select && select.length > 0) {
|
|
98
|
+
body.select = select;
|
|
99
|
+
}
|
|
100
|
+
// Add sorting if provided
|
|
101
|
+
if (orderBy && orderBy.length > 0) {
|
|
102
|
+
body.sortBy = orderBy;
|
|
103
|
+
}
|
|
104
|
+
// Add pagination
|
|
105
|
+
const limit = parseInt(max_records.toString(), 10);
|
|
106
|
+
body.options = {
|
|
107
|
+
skip,
|
|
108
|
+
top: Math.min(limit, 1000), // API has a limit of 1000 records per request
|
|
109
|
+
...(options || {})
|
|
110
|
+
};
|
|
111
|
+
// Execute the query
|
|
112
|
+
const response = await this.client.request({
|
|
113
|
+
method: 'POST',
|
|
114
|
+
path: '/records/query',
|
|
115
|
+
body
|
|
116
|
+
});
|
|
117
|
+
if (!response.success || !response.data) {
|
|
118
|
+
logger.error('Failed to query records', {
|
|
119
|
+
error: response.error,
|
|
120
|
+
tableId: table_id
|
|
121
|
+
});
|
|
122
|
+
throw new Error(response.error?.message || 'Failed to query records');
|
|
123
|
+
}
|
|
124
|
+
// Safely validate response structure
|
|
125
|
+
if (typeof response.data !== 'object' || response.data === null) {
|
|
126
|
+
throw new Error('Invalid API response: data is not an object');
|
|
127
|
+
}
|
|
128
|
+
const data = response.data;
|
|
129
|
+
// Validate records array exists
|
|
130
|
+
if (!Array.isArray(data.data)) {
|
|
131
|
+
logger.error('Query response missing data array', { data });
|
|
132
|
+
throw new Error('Query response does not contain records array');
|
|
133
|
+
}
|
|
134
|
+
const records = data.data;
|
|
135
|
+
// Validate and type-cast fields array
|
|
136
|
+
const fields = Array.isArray(data.fields)
|
|
137
|
+
? data.fields
|
|
138
|
+
: undefined;
|
|
139
|
+
const metadata = {
|
|
140
|
+
fields,
|
|
141
|
+
tableId: table_id,
|
|
142
|
+
numRecords: records.length,
|
|
143
|
+
skip
|
|
144
|
+
};
|
|
145
|
+
// Handle pagination if enabled and there may be more records
|
|
146
|
+
let allRecords = [...records];
|
|
147
|
+
let hasMore = records.length === body.options.top;
|
|
148
|
+
if (paginate && hasMore && allRecords.length < limit) {
|
|
149
|
+
logger.info('Paginating query results', {
|
|
150
|
+
recordsFetched: allRecords.length,
|
|
151
|
+
limit
|
|
152
|
+
});
|
|
153
|
+
let currentSkip = skip + records.length;
|
|
154
|
+
let iterationCount = 0;
|
|
155
|
+
const maxIterations = 100; // Circuit breaker: prevent infinite loops
|
|
156
|
+
const startTime = Date.now();
|
|
157
|
+
const maxTimeMs = 30000; // 30 second timeout
|
|
158
|
+
// Continue fetching until we reach the limit or there are no more records
|
|
159
|
+
while (hasMore && allRecords.length < limit) {
|
|
160
|
+
// Circuit breaker checks
|
|
161
|
+
iterationCount++;
|
|
162
|
+
if (iterationCount > maxIterations) {
|
|
163
|
+
logger.error('Pagination circuit breaker: too many iterations', {
|
|
164
|
+
iterationCount,
|
|
165
|
+
maxIterations,
|
|
166
|
+
totalRecords: allRecords.length
|
|
167
|
+
});
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
if (Date.now() - startTime > maxTimeMs) {
|
|
171
|
+
logger.error('Pagination circuit breaker: timeout exceeded', {
|
|
172
|
+
timeElapsed: Date.now() - startTime,
|
|
173
|
+
maxTimeMs,
|
|
174
|
+
totalRecords: allRecords.length
|
|
175
|
+
});
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
// Update pagination options
|
|
179
|
+
body.options.skip = currentSkip;
|
|
180
|
+
body.options.top = Math.min(limit - allRecords.length, 1000);
|
|
181
|
+
// Execute next page query
|
|
182
|
+
const pageResponse = await this.client.request({
|
|
183
|
+
method: 'POST',
|
|
184
|
+
path: '/records/query',
|
|
185
|
+
body
|
|
186
|
+
});
|
|
187
|
+
if (!pageResponse.success || !pageResponse.data) {
|
|
188
|
+
logger.error('Failed to query additional records', {
|
|
189
|
+
error: pageResponse.error,
|
|
190
|
+
tableId: table_id,
|
|
191
|
+
skip: currentSkip
|
|
192
|
+
});
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
// Safely validate pagination response structure
|
|
196
|
+
if (typeof pageResponse.data !== 'object' || pageResponse.data === null) {
|
|
197
|
+
logger.error('Invalid pagination response: data is not an object');
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
const pageData = pageResponse.data;
|
|
201
|
+
// Validate page records array exists
|
|
202
|
+
if (!Array.isArray(pageData.data)) {
|
|
203
|
+
logger.error('Pagination response missing data array', { pageData });
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
const pageRecords = pageData.data;
|
|
207
|
+
// Zero progress detection - prevent infinite loops from bad API responses
|
|
208
|
+
if (pageRecords.length === 0) {
|
|
209
|
+
logger.debug('No more records returned, stopping pagination');
|
|
210
|
+
hasMore = false;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
// Add the new records to our results
|
|
214
|
+
allRecords = [...allRecords, ...pageRecords];
|
|
215
|
+
// Validate pagination progress to prevent infinite loops
|
|
216
|
+
const previousSkip = currentSkip;
|
|
217
|
+
currentSkip += pageRecords.length;
|
|
218
|
+
// Anti-bypass check: ensure offset actually advanced
|
|
219
|
+
if (currentSkip <= previousSkip) {
|
|
220
|
+
logger.error('Pagination offset did not advance - potential infinite loop', {
|
|
221
|
+
previousSkip,
|
|
222
|
+
currentSkip,
|
|
223
|
+
recordsReceived: pageRecords.length
|
|
224
|
+
});
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
// Anti-bypass check: ensure we're not receiving the same data
|
|
228
|
+
if (pageRecords.length === body.options.top &&
|
|
229
|
+
allRecords.length + pageRecords.length > limit) {
|
|
230
|
+
logger.debug('Truncating final page to respect limit');
|
|
231
|
+
const remainingSlots = limit - allRecords.length;
|
|
232
|
+
allRecords = [...allRecords, ...pageRecords.slice(0, remainingSlots)];
|
|
233
|
+
hasMore = false;
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
hasMore = pageRecords.length === body.options.top && allRecords.length < limit;
|
|
237
|
+
logger.debug('Fetched additional records', {
|
|
238
|
+
newRecords: pageRecords.length,
|
|
239
|
+
totalRecords: allRecords.length,
|
|
240
|
+
limit,
|
|
241
|
+
currentSkip,
|
|
242
|
+
hasMore
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
// Update metadata for the complete result set
|
|
246
|
+
metadata.numRecords = allRecords.length;
|
|
247
|
+
}
|
|
248
|
+
logger.info(`Retrieved ${allRecords.length} records from table`, {
|
|
249
|
+
tableId: table_id,
|
|
250
|
+
hasMore
|
|
251
|
+
});
|
|
252
|
+
return {
|
|
253
|
+
records: allRecords,
|
|
254
|
+
totalRecords: allRecords.length,
|
|
255
|
+
hasMore,
|
|
256
|
+
metadata
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
exports.QueryRecordsTool = QueryRecordsTool;
|
|
261
|
+
//# sourceMappingURL=query_records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query_records.js","sourceRoot":"","sources":["../../../src/tools/records/query_records.ts"],"names":[],"mappings":";;;AAAA,kCAAmC;AAEnC,+CAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,kBAAkB,CAAC,CAAC;AA2GhD;;GAEG;AACH,MAAa,gBAAiB,SAAQ,eAAgD;IA6DpF;;;OAGG;IACH,YAAY,MAAuB;QACjC,KAAK,CAAC,MAAM,CAAC,CAAC;QAjET,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,qEAAqE,CAAC;QAE3F;;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,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gBAAgB;iBAC9B;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,kBAAkB;oBAC/B,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;qBACf;iBACF;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,4BAA4B;oBACzC,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,OAAO,EAAE;gCACP,IAAI,EAAE,QAAQ;6BACf;4BACD,KAAK,EAAE;gCACL,IAAI,EAAE,QAAQ;gCACd,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;6BACtB;yBACF;qBACF;iBAC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CAAC;gBAE/E,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE;oBACzC,UAAU,EAAE,WAAW,CAAC,MAAM;oBAC9B,YAAY,EAAE,UAAU,CAAC,MAAM;oBAC/B,KAAK;oBACL,WAAW;oBACX,OAAO;iBACR,CAAC,CAAC;YACL,CAAC;YAED,8CAA8C;YAC9C,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC;QAC1C,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,aAAa,UAAU,CAAC,MAAM,qBAAqB,EAAE;YAC/D,OAAO,EAAE,QAAQ;YACjB,OAAO;SACR,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,UAAU;YACnB,YAAY,EAAE,UAAU,CAAC,MAAM;YAC/B,OAAO;YACP,QAAQ;SACT,CAAC;IACJ,CAAC;CACF;AAxSD,4CAwSC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { BaseTool } from '../base';
|
|
2
|
+
import { QuickbaseClient } from '../../client/quickbase';
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for update_record tool
|
|
5
|
+
*/
|
|
6
|
+
export interface UpdateRecordParams {
|
|
7
|
+
/**
|
|
8
|
+
* The ID of the table containing the record
|
|
9
|
+
*/
|
|
10
|
+
table_id: string;
|
|
11
|
+
/**
|
|
12
|
+
* The ID of the record to update
|
|
13
|
+
*/
|
|
14
|
+
record_id: string;
|
|
15
|
+
/**
|
|
16
|
+
* The data to update in the record, formatted as a JSON object
|
|
17
|
+
* with field IDs or field names as keys
|
|
18
|
+
*/
|
|
19
|
+
data: Record<string, any>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Response from updating a record
|
|
23
|
+
*/
|
|
24
|
+
export interface UpdateRecordResult {
|
|
25
|
+
/**
|
|
26
|
+
* The ID of the updated record
|
|
27
|
+
*/
|
|
28
|
+
recordId: string;
|
|
29
|
+
/**
|
|
30
|
+
* The ID of the table containing the record
|
|
31
|
+
*/
|
|
32
|
+
tableId: string;
|
|
33
|
+
/**
|
|
34
|
+
* Update timestamp
|
|
35
|
+
*/
|
|
36
|
+
updatedTime?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Fields that were updated
|
|
39
|
+
*/
|
|
40
|
+
updatedFields?: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Tool for updating an existing record in a Quickbase table
|
|
44
|
+
*/
|
|
45
|
+
export declare class UpdateRecordTool extends BaseTool<UpdateRecordParams, UpdateRecordResult> {
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
/**
|
|
49
|
+
* Parameter schema for update_record
|
|
50
|
+
*/
|
|
51
|
+
paramSchema: {
|
|
52
|
+
type: string;
|
|
53
|
+
properties: {
|
|
54
|
+
table_id: {
|
|
55
|
+
type: string;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
record_id: {
|
|
59
|
+
type: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
data: {
|
|
63
|
+
type: string;
|
|
64
|
+
description: string;
|
|
65
|
+
additionalProperties: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
required: string[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Constructor
|
|
72
|
+
* @param client Quickbase client
|
|
73
|
+
*/
|
|
74
|
+
constructor(client: QuickbaseClient);
|
|
75
|
+
/**
|
|
76
|
+
* Run the update_record tool
|
|
77
|
+
* @param params Tool parameters
|
|
78
|
+
* @returns Updated record information
|
|
79
|
+
*/
|
|
80
|
+
protected run(params: UpdateRecordParams): Promise<UpdateRecordResult>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateRecordTool = void 0;
|
|
4
|
+
const base_1 = require("../base");
|
|
5
|
+
const logger_1 = require("../../utils/logger");
|
|
6
|
+
const logger = (0, logger_1.createLogger)('UpdateRecordTool');
|
|
7
|
+
/**
|
|
8
|
+
* Tool for updating an existing record in a Quickbase table
|
|
9
|
+
*/
|
|
10
|
+
class UpdateRecordTool extends base_1.BaseTool {
|
|
11
|
+
/**
|
|
12
|
+
* Constructor
|
|
13
|
+
* @param client Quickbase client
|
|
14
|
+
*/
|
|
15
|
+
constructor(client) {
|
|
16
|
+
super(client);
|
|
17
|
+
this.name = 'update_record';
|
|
18
|
+
this.description = 'Updates an existing record in a Quickbase table';
|
|
19
|
+
/**
|
|
20
|
+
* Parameter schema for update_record
|
|
21
|
+
*/
|
|
22
|
+
this.paramSchema = {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
table_id: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'The ID of the Quickbase table'
|
|
28
|
+
},
|
|
29
|
+
record_id: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'The ID of the record to update'
|
|
32
|
+
},
|
|
33
|
+
data: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
description: 'The updated data for the record',
|
|
36
|
+
additionalProperties: true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
required: ['table_id', 'record_id', 'data']
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Run the update_record tool
|
|
44
|
+
* @param params Tool parameters
|
|
45
|
+
* @returns Updated record information
|
|
46
|
+
*/
|
|
47
|
+
async run(params) {
|
|
48
|
+
const { table_id, record_id, data } = params;
|
|
49
|
+
logger.info('Updating record in Quickbase table', {
|
|
50
|
+
tableId: table_id,
|
|
51
|
+
recordId: record_id
|
|
52
|
+
});
|
|
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');
|
|
56
|
+
}
|
|
57
|
+
// Prepare record data
|
|
58
|
+
// Convert data to { [fieldId]: { value: fieldValue } } format expected by the API
|
|
59
|
+
const recordData = {};
|
|
60
|
+
for (const [field, value] of Object.entries(data)) {
|
|
61
|
+
recordData[field] = { value };
|
|
62
|
+
}
|
|
63
|
+
// Prepare request body
|
|
64
|
+
const body = {
|
|
65
|
+
to: table_id,
|
|
66
|
+
data: [{
|
|
67
|
+
id: record_id,
|
|
68
|
+
...recordData
|
|
69
|
+
}]
|
|
70
|
+
};
|
|
71
|
+
// Update the record
|
|
72
|
+
const response = await this.client.request({
|
|
73
|
+
method: 'POST',
|
|
74
|
+
path: '/records',
|
|
75
|
+
body
|
|
76
|
+
});
|
|
77
|
+
if (!response.success || !response.data) {
|
|
78
|
+
logger.error('Failed to update record', {
|
|
79
|
+
error: response.error,
|
|
80
|
+
tableId: table_id,
|
|
81
|
+
recordId: record_id
|
|
82
|
+
});
|
|
83
|
+
throw new Error(response.error?.message || 'Failed to update record');
|
|
84
|
+
}
|
|
85
|
+
logger.info('Successfully updated record', {
|
|
86
|
+
recordId: record_id,
|
|
87
|
+
tableId: table_id,
|
|
88
|
+
updatedFields: Object.keys(data)
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
recordId: record_id,
|
|
92
|
+
tableId: table_id,
|
|
93
|
+
updatedTime: new Date().toISOString(),
|
|
94
|
+
updatedFields: Object.keys(data)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.UpdateRecordTool = UpdateRecordTool;
|
|
99
|
+
//# sourceMappingURL=update_record.js.map
|
|
@@ -0,0 +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;Q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AAE,EAAE,QAAQ;YACZ,IAAI,EAAE,CAAC;oBACL,EAAE,EAAE,SAAS;oBACb,GAAG,UAAU;iBACd,CAAC;SACH,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;AAnGD,4CAmGC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { McpTool, ToolRegistry } from '../types/mcp';
|
|
2
|
+
/**
|
|
3
|
+
* Implementation of the MCP Tool Registry
|
|
4
|
+
* Manages all available MCP tools
|
|
5
|
+
*/
|
|
6
|
+
export declare class ToolRegistryImpl implements ToolRegistry {
|
|
7
|
+
private tools;
|
|
8
|
+
/**
|
|
9
|
+
* Get a tool by name
|
|
10
|
+
* @param name Tool name
|
|
11
|
+
* @returns The tool or undefined if not found
|
|
12
|
+
*/
|
|
13
|
+
getTool(name: string): McpTool<any, any> | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Register a tool
|
|
16
|
+
* @param tool Tool to register
|
|
17
|
+
*/
|
|
18
|
+
registerTool<TParams, TResult>(tool: McpTool<TParams, TResult>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get all registered tools
|
|
21
|
+
* @returns Array of all registered tools
|
|
22
|
+
*/
|
|
23
|
+
getAllTools(): McpTool<any, any>[];
|
|
24
|
+
/**
|
|
25
|
+
* Get tool names
|
|
26
|
+
* @returns Array of tool names
|
|
27
|
+
*/
|
|
28
|
+
getToolNames(): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Check if a tool exists
|
|
31
|
+
* @param name Tool name
|
|
32
|
+
* @returns True if the tool exists
|
|
33
|
+
*/
|
|
34
|
+
hasTool(name: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Get tool count
|
|
37
|
+
* @returns Number of registered tools
|
|
38
|
+
*/
|
|
39
|
+
getToolCount(): number;
|
|
40
|
+
}
|
|
41
|
+
export declare const toolRegistry: ToolRegistryImpl;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toolRegistry = exports.ToolRegistryImpl = void 0;
|
|
4
|
+
const logger_1 = require("../utils/logger");
|
|
5
|
+
const logger = (0, logger_1.createLogger)('ToolRegistry');
|
|
6
|
+
/**
|
|
7
|
+
* Implementation of the MCP Tool Registry
|
|
8
|
+
* Manages all available MCP tools
|
|
9
|
+
*/
|
|
10
|
+
class ToolRegistryImpl {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.tools = new Map();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get a tool by name
|
|
16
|
+
* @param name Tool name
|
|
17
|
+
* @returns The tool or undefined if not found
|
|
18
|
+
*/
|
|
19
|
+
getTool(name) {
|
|
20
|
+
return this.tools.get(name);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Register a tool
|
|
24
|
+
* @param tool Tool to register
|
|
25
|
+
*/
|
|
26
|
+
registerTool(tool) {
|
|
27
|
+
if (this.tools.has(tool.name)) {
|
|
28
|
+
logger.warn(`Tool with name ${tool.name} already exists, overwriting`);
|
|
29
|
+
}
|
|
30
|
+
this.tools.set(tool.name, tool);
|
|
31
|
+
logger.info(`Registered tool: ${tool.name}`);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get all registered tools
|
|
35
|
+
* @returns Array of all registered tools
|
|
36
|
+
*/
|
|
37
|
+
getAllTools() {
|
|
38
|
+
return Array.from(this.tools.values());
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get tool names
|
|
42
|
+
* @returns Array of tool names
|
|
43
|
+
*/
|
|
44
|
+
getToolNames() {
|
|
45
|
+
return Array.from(this.tools.keys());
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Check if a tool exists
|
|
49
|
+
* @param name Tool name
|
|
50
|
+
* @returns True if the tool exists
|
|
51
|
+
*/
|
|
52
|
+
hasTool(name) {
|
|
53
|
+
return this.tools.has(name);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get tool count
|
|
57
|
+
* @returns Number of registered tools
|
|
58
|
+
*/
|
|
59
|
+
getToolCount() {
|
|
60
|
+
return this.tools.size;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.ToolRegistryImpl = ToolRegistryImpl;
|
|
64
|
+
// Create singleton instance
|
|
65
|
+
exports.toolRegistry = new ToolRegistryImpl();
|
|
66
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":";;;AACA,4CAA+C;AAE/C,MAAM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|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.registerReportTools = registerReportTools;
|
|
18
|
+
const registry_1 = require("../registry");
|
|
19
|
+
const run_report_1 = require("./run_report");
|
|
20
|
+
const logger_1 = require("../../utils/logger");
|
|
21
|
+
const logger = (0, logger_1.createLogger)('ReportTools');
|
|
22
|
+
/**
|
|
23
|
+
* Register all report-related tools
|
|
24
|
+
*/
|
|
25
|
+
function registerReportTools(client) {
|
|
26
|
+
logger.info('Registering report operation tools');
|
|
27
|
+
registry_1.toolRegistry.registerTool(new run_report_1.RunReportTool(client));
|
|
28
|
+
logger.info('Report operation tools registered');
|
|
29
|
+
}
|
|
30
|
+
__exportStar(require("./run_report"), exports);
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/reports/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAUA,kDAMC;AAfD,0CAA2C;AAC3C,6CAA6C;AAC7C,+CAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,aAAa,CAAC,CAAC;AAE3C;;GAEG;AACH,SAAgB,mBAAmB,CAAC,MAAuB;IACzD,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IAElD,uBAAY,CAAC,YAAY,CAAC,IAAI,0BAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAErD,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;AACnD,CAAC;AAED,+CAA6B"}
|