zotero-bridge 1.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/dist/pdf.js ADDED
@@ -0,0 +1,143 @@
1
+ /**
2
+ * ZoteroBridge - PDF Processing Module
3
+ *
4
+ * Handles PDF text extraction and content analysis
5
+ *
6
+ * @author Combjellyshen
7
+ */
8
+ import { readFileSync, existsSync } from 'fs';
9
+ // @ts-ignore - pdf-parse doesn't have type definitions
10
+ import pdfParse from 'pdf-parse';
11
+ export class PDFProcessor {
12
+ db;
13
+ constructor(db) {
14
+ this.db = db;
15
+ }
16
+ /**
17
+ * Extract text from a PDF file
18
+ */
19
+ async extractText(pdfPath) {
20
+ if (!existsSync(pdfPath)) {
21
+ throw new Error(`PDF file not found: ${pdfPath}`);
22
+ }
23
+ const buffer = readFileSync(pdfPath);
24
+ const data = await pdfParse(buffer);
25
+ return {
26
+ text: data.text,
27
+ numPages: data.numpages,
28
+ info: data.info || {},
29
+ metadata: data.metadata || null
30
+ };
31
+ }
32
+ /**
33
+ * Extract text from a PDF attachment by item ID
34
+ */
35
+ async extractTextFromAttachment(attachmentItemID) {
36
+ const path = this.db.getAttachmentPath(attachmentItemID);
37
+ if (!path) {
38
+ return null;
39
+ }
40
+ return this.extractText(path);
41
+ }
42
+ /**
43
+ * Extract text from all PDF attachments of a parent item
44
+ */
45
+ async extractTextFromItem(parentItemID) {
46
+ const attachments = this.db.getPDFAttachments(parentItemID);
47
+ const results = new Map();
48
+ for (const att of attachments) {
49
+ const path = this.db.getAttachmentPath(att.itemID);
50
+ if (path && existsSync(path)) {
51
+ try {
52
+ const content = await this.extractText(path);
53
+ results.set(att.itemID, content);
54
+ }
55
+ catch (error) {
56
+ console.error(`Failed to extract PDF ${att.itemID}: ${error}`);
57
+ }
58
+ }
59
+ }
60
+ return results;
61
+ }
62
+ /**
63
+ * Get a summary of a PDF attachment
64
+ */
65
+ async getPDFSummary(attachmentItemID) {
66
+ const path = this.db.getAttachmentPath(attachmentItemID);
67
+ if (!path || !existsSync(path)) {
68
+ return null;
69
+ }
70
+ try {
71
+ const content = await this.extractText(path);
72
+ const title = content.info?.Title || path.split(/[/\\]/).pop() || 'Unknown';
73
+ const wordCount = content.text.split(/\s+/).length;
74
+ const preview = content.text.substring(0, 500).replace(/\s+/g, ' ').trim();
75
+ return {
76
+ itemID: attachmentItemID,
77
+ title,
78
+ numPages: content.numPages,
79
+ wordCount,
80
+ preview,
81
+ path
82
+ };
83
+ }
84
+ catch (error) {
85
+ return null;
86
+ }
87
+ }
88
+ /**
89
+ * Generate an abstract/summary from PDF content
90
+ * This is a simple extraction - for AI-generated summaries,
91
+ * use the extracted text with an LLM
92
+ */
93
+ generateSimpleSummary(content, maxLength = 1000) {
94
+ const text = content.text;
95
+ // Try to find abstract section
96
+ const abstractMatch = text.match(/abstract[:\s]*\n?([\s\S]{100,2000}?)(?=\n\s*(?:introduction|keywords|1\.|background))/i);
97
+ if (abstractMatch) {
98
+ return abstractMatch[1].replace(/\s+/g, ' ').trim().substring(0, maxLength);
99
+ }
100
+ // Try to find introduction
101
+ const introMatch = text.match(/introduction[:\s]*\n?([\s\S]{100,2000}?)(?=\n\s*(?:2\.|background|related|method))/i);
102
+ if (introMatch) {
103
+ return introMatch[1].replace(/\s+/g, ' ').trim().substring(0, maxLength);
104
+ }
105
+ // Fall back to first paragraph
106
+ const paragraphs = text.split(/\n\s*\n/).filter(p => p.trim().length > 100);
107
+ if (paragraphs.length > 0) {
108
+ return paragraphs[0].replace(/\s+/g, ' ').trim().substring(0, maxLength);
109
+ }
110
+ return text.substring(0, maxLength).replace(/\s+/g, ' ').trim();
111
+ }
112
+ /**
113
+ * Search for text within PDF content
114
+ */
115
+ searchInPDF(content, query, caseSensitive = false) {
116
+ const text = caseSensitive ? content.text : content.text.toLowerCase();
117
+ const searchQuery = caseSensitive ? query : query.toLowerCase();
118
+ const results = [];
119
+ const lines = text.split('\n');
120
+ for (let i = 0; i < lines.length; i++) {
121
+ if (lines[i].includes(searchQuery)) {
122
+ // Get context (previous and next lines)
123
+ const start = Math.max(0, i - 1);
124
+ const end = Math.min(lines.length - 1, i + 1);
125
+ const context = lines.slice(start, end + 1).join(' ').replace(/\s+/g, ' ').trim();
126
+ results.push(context);
127
+ }
128
+ }
129
+ return results;
130
+ }
131
+ /**
132
+ * Get PDF info/metadata
133
+ */
134
+ async getPDFInfo(pdfPath) {
135
+ const content = await this.extractText(pdfPath);
136
+ return {
137
+ ...content.info,
138
+ numPages: content.numPages,
139
+ metadata: content.metadata
140
+ };
141
+ }
142
+ }
143
+ //# sourceMappingURL=pdf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdf.js","sourceRoot":"","sources":["../src/pdf.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAE9C,uDAAuD;AACvD,OAAO,QAAQ,MAAM,WAAW,CAAC;AAmBjC,MAAM,OAAO,YAAY;IACf,EAAE,CAAiB;IAE3B,YAAY,EAAkB;QAC5B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,OAAe;QAC/B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEpC,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI;SAChC,CAAC;IACJ,CAAC;IAED;;OAE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,CAAC,EAAE,CAAC;gBACnC,wCAAwC;gBACxC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;gBACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;gBAClF,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,OAAe;QAC9B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO;YACL,GAAG,OAAO,CAAC,IAAI;YACf,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,396 @@
1
+ /**
2
+ * ZoteroBridge - MCP Tool Definitions
3
+ *
4
+ * Defines all available MCP tools for Zotero operations
5
+ *
6
+ * @author Combjellyshen
7
+ */
8
+ import { z } from 'zod';
9
+ export declare const listCollectionsSchema: z.ZodObject<{
10
+ libraryID: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ libraryID: number;
13
+ }, {
14
+ libraryID?: number | undefined;
15
+ }>;
16
+ export declare const getCollectionSchema: z.ZodObject<{
17
+ collectionID: z.ZodOptional<z.ZodNumber>;
18
+ name: z.ZodOptional<z.ZodString>;
19
+ libraryID: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ libraryID: number;
22
+ collectionID?: number | undefined;
23
+ name?: string | undefined;
24
+ }, {
25
+ libraryID?: number | undefined;
26
+ collectionID?: number | undefined;
27
+ name?: string | undefined;
28
+ }>;
29
+ export declare const createCollectionSchema: z.ZodObject<{
30
+ name: z.ZodString;
31
+ parentCollectionID: z.ZodOptional<z.ZodNumber>;
32
+ libraryID: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ libraryID: number;
35
+ name: string;
36
+ parentCollectionID?: number | undefined;
37
+ }, {
38
+ name: string;
39
+ libraryID?: number | undefined;
40
+ parentCollectionID?: number | undefined;
41
+ }>;
42
+ export declare const renameCollectionSchema: z.ZodObject<{
43
+ collectionID: z.ZodNumber;
44
+ newName: z.ZodString;
45
+ }, "strip", z.ZodTypeAny, {
46
+ collectionID: number;
47
+ newName: string;
48
+ }, {
49
+ collectionID: number;
50
+ newName: string;
51
+ }>;
52
+ export declare const moveCollectionSchema: z.ZodObject<{
53
+ collectionID: z.ZodNumber;
54
+ newParentID: z.ZodNullable<z.ZodNumber>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ collectionID: number;
57
+ newParentID: number | null;
58
+ }, {
59
+ collectionID: number;
60
+ newParentID: number | null;
61
+ }>;
62
+ export declare const deleteCollectionSchema: z.ZodObject<{
63
+ collectionID: z.ZodNumber;
64
+ }, "strip", z.ZodTypeAny, {
65
+ collectionID: number;
66
+ }, {
67
+ collectionID: number;
68
+ }>;
69
+ export declare const getSubcollectionsSchema: z.ZodObject<{
70
+ parentCollectionID: z.ZodNumber;
71
+ }, "strip", z.ZodTypeAny, {
72
+ parentCollectionID: number;
73
+ }, {
74
+ parentCollectionID: number;
75
+ }>;
76
+ export declare const listTagsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
77
+ export declare const addTagSchema: z.ZodObject<{
78
+ itemID: z.ZodNumber;
79
+ tagName: z.ZodString;
80
+ type: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ itemID: number;
83
+ type: number;
84
+ tagName: string;
85
+ }, {
86
+ itemID: number;
87
+ tagName: string;
88
+ type?: number | undefined;
89
+ }>;
90
+ export declare const removeTagSchema: z.ZodObject<{
91
+ itemID: z.ZodNumber;
92
+ tagName: z.ZodString;
93
+ }, "strip", z.ZodTypeAny, {
94
+ itemID: number;
95
+ tagName: string;
96
+ }, {
97
+ itemID: number;
98
+ tagName: string;
99
+ }>;
100
+ export declare const getItemTagsSchema: z.ZodObject<{
101
+ itemID: z.ZodNumber;
102
+ }, "strip", z.ZodTypeAny, {
103
+ itemID: number;
104
+ }, {
105
+ itemID: number;
106
+ }>;
107
+ export declare const createTagSchema: z.ZodObject<{
108
+ name: z.ZodString;
109
+ type: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ type: number;
112
+ name: string;
113
+ }, {
114
+ name: string;
115
+ type?: number | undefined;
116
+ }>;
117
+ export declare const searchItemsSchema: z.ZodObject<{
118
+ query: z.ZodString;
119
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
120
+ libraryID: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ libraryID: number;
123
+ query: string;
124
+ limit: number;
125
+ }, {
126
+ query: string;
127
+ libraryID?: number | undefined;
128
+ limit?: number | undefined;
129
+ }>;
130
+ export declare const getItemDetailsSchema: z.ZodObject<{
131
+ itemID: z.ZodOptional<z.ZodNumber>;
132
+ itemKey: z.ZodOptional<z.ZodString>;
133
+ }, "strip", z.ZodTypeAny, {
134
+ itemID?: number | undefined;
135
+ itemKey?: string | undefined;
136
+ }, {
137
+ itemID?: number | undefined;
138
+ itemKey?: string | undefined;
139
+ }>;
140
+ export declare const addItemToCollectionSchema: z.ZodObject<{
141
+ itemID: z.ZodNumber;
142
+ collectionID: z.ZodNumber;
143
+ }, "strip", z.ZodTypeAny, {
144
+ itemID: number;
145
+ collectionID: number;
146
+ }, {
147
+ itemID: number;
148
+ collectionID: number;
149
+ }>;
150
+ export declare const removeItemFromCollectionSchema: z.ZodObject<{
151
+ itemID: z.ZodNumber;
152
+ collectionID: z.ZodNumber;
153
+ }, "strip", z.ZodTypeAny, {
154
+ itemID: number;
155
+ collectionID: number;
156
+ }, {
157
+ itemID: number;
158
+ collectionID: number;
159
+ }>;
160
+ export declare const getCollectionItemsSchema: z.ZodObject<{
161
+ collectionID: z.ZodNumber;
162
+ }, "strip", z.ZodTypeAny, {
163
+ collectionID: number;
164
+ }, {
165
+ collectionID: number;
166
+ }>;
167
+ export declare const getItemAbstractSchema: z.ZodObject<{
168
+ itemID: z.ZodNumber;
169
+ }, "strip", z.ZodTypeAny, {
170
+ itemID: number;
171
+ }, {
172
+ itemID: number;
173
+ }>;
174
+ export declare const setItemAbstractSchema: z.ZodObject<{
175
+ itemID: z.ZodNumber;
176
+ abstract: z.ZodString;
177
+ }, "strip", z.ZodTypeAny, {
178
+ itemID: number;
179
+ abstract: string;
180
+ }, {
181
+ itemID: number;
182
+ abstract: string;
183
+ }>;
184
+ export declare const getItemNotesSchema: z.ZodObject<{
185
+ itemID: z.ZodNumber;
186
+ }, "strip", z.ZodTypeAny, {
187
+ itemID: number;
188
+ }, {
189
+ itemID: number;
190
+ }>;
191
+ export declare const addItemNoteSchema: z.ZodObject<{
192
+ itemID: z.ZodNumber;
193
+ content: z.ZodString;
194
+ title: z.ZodDefault<z.ZodOptional<z.ZodString>>;
195
+ }, "strip", z.ZodTypeAny, {
196
+ itemID: number;
197
+ title: string;
198
+ content: string;
199
+ }, {
200
+ itemID: number;
201
+ content: string;
202
+ title?: string | undefined;
203
+ }>;
204
+ export declare const extractPDFTextSchema: z.ZodObject<{
205
+ attachmentItemID: z.ZodNumber;
206
+ }, "strip", z.ZodTypeAny, {
207
+ attachmentItemID: number;
208
+ }, {
209
+ attachmentItemID: number;
210
+ }>;
211
+ export declare const getPDFSummarySchema: z.ZodObject<{
212
+ attachmentItemID: z.ZodNumber;
213
+ }, "strip", z.ZodTypeAny, {
214
+ attachmentItemID: number;
215
+ }, {
216
+ attachmentItemID: number;
217
+ }>;
218
+ export declare const getItemPDFsSchema: z.ZodObject<{
219
+ parentItemID: z.ZodNumber;
220
+ }, "strip", z.ZodTypeAny, {
221
+ parentItemID: number;
222
+ }, {
223
+ parentItemID: number;
224
+ }>;
225
+ export declare const searchPDFSchema: z.ZodObject<{
226
+ attachmentItemID: z.ZodNumber;
227
+ query: z.ZodString;
228
+ caseSensitive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
229
+ }, "strip", z.ZodTypeAny, {
230
+ query: string;
231
+ attachmentItemID: number;
232
+ caseSensitive: boolean;
233
+ }, {
234
+ query: string;
235
+ attachmentItemID: number;
236
+ caseSensitive?: boolean | undefined;
237
+ }>;
238
+ export declare const generateAbstractFromPDFSchema: z.ZodObject<{
239
+ attachmentItemID: z.ZodNumber;
240
+ maxLength: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
241
+ saveToItem: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
242
+ }, "strip", z.ZodTypeAny, {
243
+ attachmentItemID: number;
244
+ maxLength: number;
245
+ saveToItem: boolean;
246
+ }, {
247
+ attachmentItemID: number;
248
+ maxLength?: number | undefined;
249
+ saveToItem?: boolean | undefined;
250
+ }>;
251
+ export declare const findByDOISchema: z.ZodObject<{
252
+ doi: z.ZodString;
253
+ }, "strip", z.ZodTypeAny, {
254
+ doi: string;
255
+ }, {
256
+ doi: string;
257
+ }>;
258
+ export declare const findByISBNSchema: z.ZodObject<{
259
+ isbn: z.ZodString;
260
+ }, "strip", z.ZodTypeAny, {
261
+ isbn: string;
262
+ }, {
263
+ isbn: string;
264
+ }>;
265
+ export declare const findByIdentifierSchema: z.ZodObject<{
266
+ identifier: z.ZodString;
267
+ type: z.ZodOptional<z.ZodString>;
268
+ }, "strip", z.ZodTypeAny, {
269
+ identifier: string;
270
+ type?: string | undefined;
271
+ }, {
272
+ identifier: string;
273
+ type?: string | undefined;
274
+ }>;
275
+ export declare const getItemAnnotationsSchema: z.ZodObject<{
276
+ itemID: z.ZodNumber;
277
+ }, "strip", z.ZodTypeAny, {
278
+ itemID: number;
279
+ }, {
280
+ itemID: number;
281
+ }>;
282
+ export declare const getAttachmentAnnotationsSchema: z.ZodObject<{
283
+ attachmentID: z.ZodNumber;
284
+ }, "strip", z.ZodTypeAny, {
285
+ attachmentID: number;
286
+ }, {
287
+ attachmentID: number;
288
+ }>;
289
+ export declare const getAnnotationsByTypeSchema: z.ZodObject<{
290
+ itemID: z.ZodNumber;
291
+ types: z.ZodArray<z.ZodString, "many">;
292
+ }, "strip", z.ZodTypeAny, {
293
+ itemID: number;
294
+ types: string[];
295
+ }, {
296
+ itemID: number;
297
+ types: string[];
298
+ }>;
299
+ export declare const getAnnotationsByColorSchema: z.ZodObject<{
300
+ itemID: z.ZodNumber;
301
+ colors: z.ZodArray<z.ZodString, "many">;
302
+ }, "strip", z.ZodTypeAny, {
303
+ itemID: number;
304
+ colors: string[];
305
+ }, {
306
+ itemID: number;
307
+ colors: string[];
308
+ }>;
309
+ export declare const searchAnnotationsSchema: z.ZodObject<{
310
+ query: z.ZodString;
311
+ itemID: z.ZodOptional<z.ZodNumber>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ query: string;
314
+ itemID?: number | undefined;
315
+ }, {
316
+ query: string;
317
+ itemID?: number | undefined;
318
+ }>;
319
+ export declare const searchFulltextSchema: z.ZodObject<{
320
+ query: z.ZodString;
321
+ libraryID: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
322
+ }, "strip", z.ZodTypeAny, {
323
+ libraryID: number;
324
+ query: string;
325
+ }, {
326
+ query: string;
327
+ libraryID?: number | undefined;
328
+ }>;
329
+ export declare const getFulltextContentSchema: z.ZodObject<{
330
+ attachmentID: z.ZodNumber;
331
+ }, "strip", z.ZodTypeAny, {
332
+ attachmentID: number;
333
+ }, {
334
+ attachmentID: number;
335
+ }>;
336
+ export declare const searchFulltextWithContextSchema: z.ZodObject<{
337
+ query: z.ZodString;
338
+ contextLength: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
339
+ libraryID: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
340
+ }, "strip", z.ZodTypeAny, {
341
+ libraryID: number;
342
+ query: string;
343
+ contextLength: number;
344
+ }, {
345
+ query: string;
346
+ libraryID?: number | undefined;
347
+ contextLength?: number | undefined;
348
+ }>;
349
+ export declare const getRelatedItemsSchema: z.ZodObject<{
350
+ itemID: z.ZodNumber;
351
+ }, "strip", z.ZodTypeAny, {
352
+ itemID: number;
353
+ }, {
354
+ itemID: number;
355
+ }>;
356
+ export declare const findSimilarByTagsSchema: z.ZodObject<{
357
+ itemID: z.ZodNumber;
358
+ minSharedTags: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
359
+ }, "strip", z.ZodTypeAny, {
360
+ itemID: number;
361
+ minSharedTags: number;
362
+ }, {
363
+ itemID: number;
364
+ minSharedTags?: number | undefined;
365
+ }>;
366
+ export declare const findSimilarByCreatorsSchema: z.ZodObject<{
367
+ itemID: z.ZodNumber;
368
+ }, "strip", z.ZodTypeAny, {
369
+ itemID: number;
370
+ }, {
371
+ itemID: number;
372
+ }>;
373
+ export declare const findSimilarByCollectionSchema: z.ZodObject<{
374
+ itemID: z.ZodNumber;
375
+ }, "strip", z.ZodTypeAny, {
376
+ itemID: number;
377
+ }, {
378
+ itemID: number;
379
+ }>;
380
+ export declare const getDatabaseInfoSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
381
+ export declare const rawQuerySchema: z.ZodObject<{
382
+ sql: z.ZodString;
383
+ params: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodAny, "many">>>;
384
+ }, "strip", z.ZodTypeAny, {
385
+ params: any[];
386
+ sql: string;
387
+ }, {
388
+ sql: string;
389
+ params?: any[] | undefined;
390
+ }>;
391
+ export declare const toolDefinitions: {
392
+ name: string;
393
+ description: string;
394
+ inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
395
+ }[];
396
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,qBAAqB;;;;;;EAEhC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAIjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;EAEjC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAMH,eAAO,MAAM,cAAc,gDAAe,CAAC;AAE3C,eAAO,MAAM,YAAY;;;;;;;;;;;;EAIvB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;EAG1B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;EAG1B,CAAC;AAMH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;EAGpC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;EAGzC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;EAEnC,CAAC;AAMH,eAAO,MAAM,qBAAqB;;;;;;EAEhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AAEH,eAAO,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