@doist/todoist-ai 5.2.0 → 6.0.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/dist/index.d.ts +272 -901
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/main.js +1 -1
- package/dist/mcp-helpers.d.ts.map +1 -1
- package/dist/{mcp-server-D0ROki3I.js → mcp-server-BwerBJpX.js} +117 -127
- package/dist/tools/add-comments.d.ts +9 -82
- package/dist/tools/add-comments.d.ts.map +1 -1
- package/dist/tools/add-projects.d.ts +11 -73
- package/dist/tools/add-projects.d.ts.map +1 -1
- package/dist/tools/add-sections.d.ts +2 -14
- package/dist/tools/add-sections.d.ts.map +1 -1
- package/dist/tools/add-tasks.d.ts +24 -76
- package/dist/tools/add-tasks.d.ts.map +1 -1
- package/dist/tools/complete-tasks.d.ts +3 -11
- package/dist/tools/complete-tasks.d.ts.map +1 -1
- package/dist/tools/delete-object.d.ts +15 -11
- package/dist/tools/delete-object.d.ts.map +1 -1
- package/dist/tools/fetch.d.ts.map +1 -1
- package/dist/tools/find-activity.d.ts +25 -31
- package/dist/tools/find-activity.d.ts.map +1 -1
- package/dist/tools/find-comments.d.ts +9 -74
- package/dist/tools/find-comments.d.ts.map +1 -1
- package/dist/tools/find-completed-tasks.d.ts +28 -53
- package/dist/tools/find-completed-tasks.d.ts.map +1 -1
- package/dist/tools/find-project-collaborators.d.ts +2 -18
- package/dist/tools/find-project-collaborators.d.ts.map +1 -1
- package/dist/tools/find-projects.d.ts +3 -21
- package/dist/tools/find-projects.d.ts.map +1 -1
- package/dist/tools/find-sections.d.ts +1 -7
- package/dist/tools/find-sections.d.ts.map +1 -1
- package/dist/tools/find-tasks-by-date.d.ts +34 -54
- package/dist/tools/find-tasks-by-date.d.ts.map +1 -1
- package/dist/tools/find-tasks.d.ts +31 -55
- package/dist/tools/find-tasks.d.ts.map +1 -1
- package/dist/tools/get-overview.d.ts +8 -15
- package/dist/tools/get-overview.d.ts.map +1 -1
- package/dist/tools/manage-assignments.d.ts +9 -27
- package/dist/tools/manage-assignments.d.ts.map +1 -1
- package/dist/tools/search.d.ts +1 -9
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/update-comments.d.ts +10 -85
- package/dist/tools/update-comments.d.ts.map +1 -1
- package/dist/tools/update-projects.d.ts +12 -80
- package/dist/tools/update-projects.d.ts.map +1 -1
- package/dist/tools/update-sections.d.ts +4 -16
- package/dist/tools/update-sections.d.ts.map +1 -1
- package/dist/tools/update-tasks.d.ts +25 -87
- package/dist/tools/update-tasks.d.ts.map +1 -1
- package/dist/tools/user-info.d.ts +6 -2
- package/dist/tools/user-info.d.ts.map +1 -1
- package/dist/utils/labels.d.ts +5 -2
- package/dist/utils/labels.d.ts.map +1 -1
- package/dist/utils/output-schemas.d.ts +20 -176
- package/dist/utils/output-schemas.d.ts.map +1 -1
- package/dist/utils/priorities.d.ts +6 -1
- package/dist/utils/priorities.d.ts.map +1 -1
- package/package.json +11 -11
- package/scripts/validate-schemas.ts +66 -65
|
@@ -7,56 +7,25 @@ declare const TaskSchema: z.ZodObject<{
|
|
|
7
7
|
content: z.ZodString;
|
|
8
8
|
description: z.ZodString;
|
|
9
9
|
dueDate: z.ZodOptional<z.ZodString>;
|
|
10
|
-
recurring: z.ZodUnion<[z.ZodBoolean, z.ZodString]>;
|
|
10
|
+
recurring: z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>;
|
|
11
11
|
deadlineDate: z.ZodOptional<z.ZodString>;
|
|
12
|
-
priority: z.ZodEnum<
|
|
12
|
+
priority: z.ZodEnum<{
|
|
13
|
+
p1: "p1";
|
|
14
|
+
p2: "p2";
|
|
15
|
+
p3: "p3";
|
|
16
|
+
p4: "p4";
|
|
17
|
+
}>;
|
|
13
18
|
projectId: z.ZodString;
|
|
14
19
|
sectionId: z.ZodOptional<z.ZodString>;
|
|
15
20
|
parentId: z.ZodOptional<z.ZodString>;
|
|
16
|
-
labels: z.ZodOptional<z.ZodArray<z.ZodString
|
|
21
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
22
|
duration: z.ZodOptional<z.ZodString>;
|
|
18
23
|
responsibleUid: z.ZodOptional<z.ZodString>;
|
|
19
24
|
isUncompletable: z.ZodOptional<z.ZodBoolean>;
|
|
20
25
|
assignedByUid: z.ZodOptional<z.ZodString>;
|
|
21
26
|
checked: z.ZodBoolean;
|
|
22
27
|
completedAt: z.ZodOptional<z.ZodString>;
|
|
23
|
-
},
|
|
24
|
-
content: string;
|
|
25
|
-
description: string;
|
|
26
|
-
id: string;
|
|
27
|
-
projectId: string;
|
|
28
|
-
checked: boolean;
|
|
29
|
-
priority: "p1" | "p2" | "p3" | "p4";
|
|
30
|
-
recurring: string | boolean;
|
|
31
|
-
parentId?: string | undefined;
|
|
32
|
-
sectionId?: string | undefined;
|
|
33
|
-
assignedByUid?: string | undefined;
|
|
34
|
-
responsibleUid?: string | undefined;
|
|
35
|
-
labels?: string[] | undefined;
|
|
36
|
-
duration?: string | undefined;
|
|
37
|
-
completedAt?: string | undefined;
|
|
38
|
-
isUncompletable?: boolean | undefined;
|
|
39
|
-
dueDate?: string | undefined;
|
|
40
|
-
deadlineDate?: string | undefined;
|
|
41
|
-
}, {
|
|
42
|
-
content: string;
|
|
43
|
-
description: string;
|
|
44
|
-
id: string;
|
|
45
|
-
projectId: string;
|
|
46
|
-
checked: boolean;
|
|
47
|
-
priority: "p1" | "p2" | "p3" | "p4";
|
|
48
|
-
recurring: string | boolean;
|
|
49
|
-
parentId?: string | undefined;
|
|
50
|
-
sectionId?: string | undefined;
|
|
51
|
-
assignedByUid?: string | undefined;
|
|
52
|
-
responsibleUid?: string | undefined;
|
|
53
|
-
labels?: string[] | undefined;
|
|
54
|
-
duration?: string | undefined;
|
|
55
|
-
completedAt?: string | undefined;
|
|
56
|
-
isUncompletable?: boolean | undefined;
|
|
57
|
-
dueDate?: string | undefined;
|
|
58
|
-
deadlineDate?: string | undefined;
|
|
59
|
-
}>;
|
|
28
|
+
}, z.core.$strip>;
|
|
60
29
|
/**
|
|
61
30
|
* Schema for a mapped project object returned by tools
|
|
62
31
|
*/
|
|
@@ -69,38 +38,14 @@ declare const ProjectSchema: z.ZodObject<{
|
|
|
69
38
|
parentId: z.ZodOptional<z.ZodString>;
|
|
70
39
|
inboxProject: z.ZodBoolean;
|
|
71
40
|
viewStyle: z.ZodString;
|
|
72
|
-
},
|
|
73
|
-
name: string;
|
|
74
|
-
id: string;
|
|
75
|
-
color: string;
|
|
76
|
-
isFavorite: boolean;
|
|
77
|
-
viewStyle: string;
|
|
78
|
-
isShared: boolean;
|
|
79
|
-
inboxProject: boolean;
|
|
80
|
-
parentId?: string | undefined;
|
|
81
|
-
}, {
|
|
82
|
-
name: string;
|
|
83
|
-
id: string;
|
|
84
|
-
color: string;
|
|
85
|
-
isFavorite: boolean;
|
|
86
|
-
viewStyle: string;
|
|
87
|
-
isShared: boolean;
|
|
88
|
-
inboxProject: boolean;
|
|
89
|
-
parentId?: string | undefined;
|
|
90
|
-
}>;
|
|
41
|
+
}, z.core.$strip>;
|
|
91
42
|
/**
|
|
92
43
|
* Schema for a section object returned by tools
|
|
93
44
|
*/
|
|
94
45
|
declare const SectionSchema: z.ZodObject<{
|
|
95
46
|
id: z.ZodString;
|
|
96
47
|
name: z.ZodString;
|
|
97
|
-
},
|
|
98
|
-
name: string;
|
|
99
|
-
id: string;
|
|
100
|
-
}, {
|
|
101
|
-
name: string;
|
|
102
|
-
id: string;
|
|
103
|
-
}>;
|
|
48
|
+
}, z.core.$strip>;
|
|
104
49
|
/**
|
|
105
50
|
* Schema for a comment object returned by tools
|
|
106
51
|
*/
|
|
@@ -118,82 +63,17 @@ declare const CommentSchema: z.ZodObject<{
|
|
|
118
63
|
fileType: z.ZodOptional<z.ZodString>;
|
|
119
64
|
fileUrl: z.ZodOptional<z.ZodString>;
|
|
120
65
|
fileDuration: z.ZodOptional<z.ZodNumber>;
|
|
121
|
-
uploadState: z.ZodOptional<z.ZodEnum<
|
|
66
|
+
uploadState: z.ZodOptional<z.ZodEnum<{
|
|
67
|
+
pending: "pending";
|
|
68
|
+
completed: "completed";
|
|
69
|
+
}>>;
|
|
122
70
|
url: z.ZodOptional<z.ZodString>;
|
|
123
71
|
title: z.ZodOptional<z.ZodString>;
|
|
124
72
|
image: z.ZodOptional<z.ZodString>;
|
|
125
73
|
imageWidth: z.ZodOptional<z.ZodNumber>;
|
|
126
74
|
imageHeight: z.ZodOptional<z.ZodNumber>;
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
title?: string | undefined;
|
|
130
|
-
fileName?: string | undefined;
|
|
131
|
-
fileSize?: number | undefined;
|
|
132
|
-
fileType?: string | undefined;
|
|
133
|
-
fileUrl?: string | undefined;
|
|
134
|
-
fileDuration?: number | undefined;
|
|
135
|
-
uploadState?: "pending" | "completed" | undefined;
|
|
136
|
-
image?: string | undefined;
|
|
137
|
-
imageWidth?: number | undefined;
|
|
138
|
-
imageHeight?: number | undefined;
|
|
139
|
-
url?: string | undefined;
|
|
140
|
-
}, {
|
|
141
|
-
resourceType: string;
|
|
142
|
-
title?: string | undefined;
|
|
143
|
-
fileName?: string | undefined;
|
|
144
|
-
fileSize?: number | undefined;
|
|
145
|
-
fileType?: string | undefined;
|
|
146
|
-
fileUrl?: string | undefined;
|
|
147
|
-
fileDuration?: number | undefined;
|
|
148
|
-
uploadState?: "pending" | "completed" | undefined;
|
|
149
|
-
image?: string | undefined;
|
|
150
|
-
imageWidth?: number | undefined;
|
|
151
|
-
imageHeight?: number | undefined;
|
|
152
|
-
url?: string | undefined;
|
|
153
|
-
}>>;
|
|
154
|
-
}, "strip", z.ZodTypeAny, {
|
|
155
|
-
content: string;
|
|
156
|
-
id: string;
|
|
157
|
-
postedAt: string;
|
|
158
|
-
projectId?: string | undefined;
|
|
159
|
-
fileAttachment?: {
|
|
160
|
-
resourceType: string;
|
|
161
|
-
title?: string | undefined;
|
|
162
|
-
fileName?: string | undefined;
|
|
163
|
-
fileSize?: number | undefined;
|
|
164
|
-
fileType?: string | undefined;
|
|
165
|
-
fileUrl?: string | undefined;
|
|
166
|
-
fileDuration?: number | undefined;
|
|
167
|
-
uploadState?: "pending" | "completed" | undefined;
|
|
168
|
-
image?: string | undefined;
|
|
169
|
-
imageWidth?: number | undefined;
|
|
170
|
-
imageHeight?: number | undefined;
|
|
171
|
-
url?: string | undefined;
|
|
172
|
-
} | undefined;
|
|
173
|
-
postedUid?: string | undefined;
|
|
174
|
-
taskId?: string | undefined;
|
|
175
|
-
}, {
|
|
176
|
-
content: string;
|
|
177
|
-
id: string;
|
|
178
|
-
postedAt: string;
|
|
179
|
-
projectId?: string | undefined;
|
|
180
|
-
fileAttachment?: {
|
|
181
|
-
resourceType: string;
|
|
182
|
-
title?: string | undefined;
|
|
183
|
-
fileName?: string | undefined;
|
|
184
|
-
fileSize?: number | undefined;
|
|
185
|
-
fileType?: string | undefined;
|
|
186
|
-
fileUrl?: string | undefined;
|
|
187
|
-
fileDuration?: number | undefined;
|
|
188
|
-
uploadState?: "pending" | "completed" | undefined;
|
|
189
|
-
image?: string | undefined;
|
|
190
|
-
imageWidth?: number | undefined;
|
|
191
|
-
imageHeight?: number | undefined;
|
|
192
|
-
url?: string | undefined;
|
|
193
|
-
} | undefined;
|
|
194
|
-
postedUid?: string | undefined;
|
|
195
|
-
taskId?: string | undefined;
|
|
196
|
-
}>;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
}, z.core.$strip>;
|
|
197
77
|
/**
|
|
198
78
|
* Schema for an activity event object returned by tools
|
|
199
79
|
*/
|
|
@@ -207,27 +87,7 @@ declare const ActivityEventSchema: z.ZodObject<{
|
|
|
207
87
|
parentItemId: z.ZodOptional<z.ZodString>;
|
|
208
88
|
initiatorId: z.ZodOptional<z.ZodString>;
|
|
209
89
|
extraData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
210
|
-
},
|
|
211
|
-
objectType: string;
|
|
212
|
-
objectId: string;
|
|
213
|
-
eventType: string;
|
|
214
|
-
eventDate: string;
|
|
215
|
-
id?: string | undefined;
|
|
216
|
-
parentProjectId?: string | undefined;
|
|
217
|
-
parentItemId?: string | undefined;
|
|
218
|
-
initiatorId?: string | undefined;
|
|
219
|
-
extraData?: Record<string, unknown> | undefined;
|
|
220
|
-
}, {
|
|
221
|
-
objectType: string;
|
|
222
|
-
objectId: string;
|
|
223
|
-
eventType: string;
|
|
224
|
-
eventDate: string;
|
|
225
|
-
id?: string | undefined;
|
|
226
|
-
parentProjectId?: string | undefined;
|
|
227
|
-
parentItemId?: string | undefined;
|
|
228
|
-
initiatorId?: string | undefined;
|
|
229
|
-
extraData?: Record<string, unknown> | undefined;
|
|
230
|
-
}>;
|
|
90
|
+
}, z.core.$strip>;
|
|
231
91
|
/**
|
|
232
92
|
* Schema for a user/collaborator object returned by tools
|
|
233
93
|
*/
|
|
@@ -235,15 +95,7 @@ declare const CollaboratorSchema: z.ZodObject<{
|
|
|
235
95
|
id: z.ZodString;
|
|
236
96
|
name: z.ZodString;
|
|
237
97
|
email: z.ZodString;
|
|
238
|
-
},
|
|
239
|
-
name: string;
|
|
240
|
-
id: string;
|
|
241
|
-
email: string;
|
|
242
|
-
}, {
|
|
243
|
-
name: string;
|
|
244
|
-
id: string;
|
|
245
|
-
email: string;
|
|
246
|
-
}>;
|
|
98
|
+
}, z.core.$strip>;
|
|
247
99
|
/**
|
|
248
100
|
* Schema for batch operation failure
|
|
249
101
|
*/
|
|
@@ -251,14 +103,6 @@ declare const FailureSchema: z.ZodObject<{
|
|
|
251
103
|
item: z.ZodString;
|
|
252
104
|
error: z.ZodString;
|
|
253
105
|
code: z.ZodOptional<z.ZodString>;
|
|
254
|
-
},
|
|
255
|
-
error: string;
|
|
256
|
-
item: string;
|
|
257
|
-
code?: string | undefined;
|
|
258
|
-
}, {
|
|
259
|
-
error: string;
|
|
260
|
-
item: string;
|
|
261
|
-
code?: string | undefined;
|
|
262
|
-
}>;
|
|
106
|
+
}, z.core.$strip>;
|
|
263
107
|
export { ActivityEventSchema, CollaboratorSchema, CommentSchema, FailureSchema, ProjectSchema, SectionSchema, TaskSchema, };
|
|
264
108
|
//# sourceMappingURL=output-schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-schemas.d.ts","sourceRoot":"","sources":["../../src/utils/output-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;GAEG;AACH,QAAA,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"output-schemas.d.ts","sourceRoot":"","sources":["../../src/utils/output-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;GAEG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;iBA+Bd,CAAA;AAEF;;GAEG;AACH,QAAA,MAAM,aAAa;;;;;;;;;iBASjB,CAAA;AAEF;;GAEG;AACH,QAAA,MAAM,aAAa;;;iBAGjB,CAAA;AA0BF;;GAEG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;iBAQjB,CAAA;AAEF;;GAEG;AACH,QAAA,MAAM,mBAAmB;;;;;;;;;;iBAYvB,CAAA;AAEF;;GAEG;AACH,QAAA,MAAM,kBAAkB;;;;iBAItB,CAAA;AAEF;;GAEG;AACH,QAAA,MAAM,aAAa;;;;iBAIjB,CAAA;AAEF,OAAO,EACH,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,GACb,CAAA"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
declare const PRIORITY_VALUES: readonly ["p1", "p2", "p3", "p4"];
|
|
3
3
|
export type Priority = (typeof PRIORITY_VALUES)[number];
|
|
4
|
-
export declare const PrioritySchema: z.ZodEnum<
|
|
4
|
+
export declare const PrioritySchema: z.ZodEnum<{
|
|
5
|
+
p1: "p1";
|
|
6
|
+
p2: "p2";
|
|
7
|
+
p3: "p3";
|
|
8
|
+
p4: "p4";
|
|
9
|
+
}>;
|
|
5
10
|
export declare function convertPriorityToNumber(priority: Priority): number;
|
|
6
11
|
export declare function convertNumberToPriority(priority: number): Priority | undefined;
|
|
7
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priorities.d.ts","sourceRoot":"","sources":["../../src/utils/priorities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,eAAe,mCAAoC,CAAA;AACzD,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"priorities.d.ts","sourceRoot":"","sources":["../../src/utils/priorities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,eAAe,mCAAoC,CAAA;AACzD,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,eAAO,MAAM,cAAc;;;;;EAE8D,CAAA;AAEzF,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAIlE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAI9E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/todoist-ai",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -48,26 +48,26 @@
|
|
|
48
48
|
"prepare": "husky"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@doist/todoist-api-typescript": "6.2.
|
|
52
|
-
"@modelcontextprotocol/sdk": "1.
|
|
51
|
+
"@doist/todoist-api-typescript": "6.2.1",
|
|
52
|
+
"@modelcontextprotocol/sdk": "1.24.3",
|
|
53
53
|
"date-fns": "4.1.0",
|
|
54
54
|
"dotenv": "17.2.3",
|
|
55
|
-
"zod": "
|
|
55
|
+
"zod": "4.1.13"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@biomejs/biome": "2.3.
|
|
59
|
-
"@types/express": "5.0.
|
|
58
|
+
"@biomejs/biome": "2.3.8",
|
|
59
|
+
"@types/express": "5.0.6",
|
|
60
60
|
"@types/morgan": "1.9.10",
|
|
61
|
-
"@types/node": "22.19.
|
|
61
|
+
"@types/node": "22.19.2",
|
|
62
62
|
"concurrently": "9.2.1",
|
|
63
|
-
"express": "5.1
|
|
63
|
+
"express": "5.2.1",
|
|
64
64
|
"husky": "9.1.7",
|
|
65
|
-
"lint-staged": "16.2.
|
|
65
|
+
"lint-staged": "16.2.7",
|
|
66
66
|
"morgan": "1.10.1",
|
|
67
67
|
"nodemon": "3.1.11",
|
|
68
|
-
"rimraf": "6.1.
|
|
68
|
+
"rimraf": "6.1.2",
|
|
69
69
|
"typescript": "5.9.3",
|
|
70
|
-
"vite": "7.2.
|
|
70
|
+
"vite": "7.2.7",
|
|
71
71
|
"vite-plugin-dts": "4.5.4",
|
|
72
72
|
"vitest": "3.2.4"
|
|
73
73
|
},
|
|
@@ -17,37 +17,37 @@
|
|
|
17
17
|
|
|
18
18
|
import { z } from 'zod'
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
type ValidationIssue = {
|
|
21
21
|
toolName: string
|
|
22
22
|
parameterPath: string
|
|
23
23
|
issue: string
|
|
24
24
|
suggestion: string
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
type ValidationResult = {
|
|
28
28
|
success: boolean
|
|
29
29
|
issues: ValidationIssue[]
|
|
30
30
|
toolsChecked: number
|
|
31
31
|
parametersChecked: number
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
type AnyZodSchema = z.ZodTypeAny | { _zod: { def: unknown } }
|
|
35
|
+
|
|
34
36
|
/**
|
|
35
37
|
* Recursively walk a Zod schema and detect problematic patterns
|
|
36
38
|
*/
|
|
37
39
|
function walkZodSchema(
|
|
38
|
-
schema:
|
|
40
|
+
schema: AnyZodSchema,
|
|
39
41
|
path: string,
|
|
40
42
|
issues: ValidationIssue[],
|
|
41
43
|
toolName: string,
|
|
42
44
|
): void {
|
|
43
|
-
const typeName = schema._def.typeName
|
|
44
|
-
|
|
45
45
|
// Check for ZodOptional containing a ZodNullable ZodString
|
|
46
|
-
if (
|
|
47
|
-
const innerSchema = schema.
|
|
48
|
-
if (innerSchema
|
|
49
|
-
const nullableInner = innerSchema.
|
|
50
|
-
if (nullableInner
|
|
46
|
+
if (schema instanceof z.ZodOptional) {
|
|
47
|
+
const innerSchema = schema.unwrap()
|
|
48
|
+
if (innerSchema instanceof z.ZodNullable) {
|
|
49
|
+
const nullableInner = innerSchema.unwrap()
|
|
50
|
+
if (nullableInner instanceof z.ZodString) {
|
|
51
51
|
issues.push({
|
|
52
52
|
toolName,
|
|
53
53
|
parameterPath: path,
|
|
@@ -60,11 +60,11 @@ function walkZodSchema(
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// Check for ZodNullable containing a ZodOptional ZodString
|
|
63
|
-
if (
|
|
64
|
-
const innerSchema = schema.
|
|
65
|
-
if (innerSchema
|
|
66
|
-
const optionalInner = innerSchema.
|
|
67
|
-
if (optionalInner
|
|
63
|
+
if (schema instanceof z.ZodNullable) {
|
|
64
|
+
const innerSchema = schema.unwrap()
|
|
65
|
+
if (innerSchema instanceof z.ZodOptional) {
|
|
66
|
+
const optionalInner = innerSchema.unwrap()
|
|
67
|
+
if (optionalInner instanceof z.ZodString) {
|
|
68
68
|
issues.push({
|
|
69
69
|
toolName,
|
|
70
70
|
parameterPath: path,
|
|
@@ -77,61 +77,60 @@ function walkZodSchema(
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// Recursively check nested schemas
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
walkZodSchema(value as z.ZodTypeAny, newPath, issues, toolName)
|
|
86
|
-
}
|
|
87
|
-
break
|
|
88
|
-
}
|
|
89
|
-
case 'ZodArray':
|
|
90
|
-
walkZodSchema(schema._def.type, `${path}[]`, issues, toolName)
|
|
91
|
-
break
|
|
92
|
-
|
|
93
|
-
case 'ZodOptional':
|
|
94
|
-
case 'ZodNullable':
|
|
95
|
-
case 'ZodDefault':
|
|
96
|
-
walkZodSchema(schema._def.innerType, path, issues, toolName)
|
|
97
|
-
break
|
|
98
|
-
|
|
99
|
-
case 'ZodUnion':
|
|
100
|
-
case 'ZodDiscriminatedUnion': {
|
|
101
|
-
const options = schema._def.options || schema._def.discriminatedUnion
|
|
102
|
-
if (Array.isArray(options)) {
|
|
103
|
-
options.forEach((option: z.ZodTypeAny, index: number) => {
|
|
104
|
-
walkZodSchema(option, `${path}[union:${index}]`, issues, toolName)
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
break
|
|
80
|
+
if (schema instanceof z.ZodObject) {
|
|
81
|
+
const shape = schema.shape
|
|
82
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
83
|
+
const newPath = path ? `${path}.${key}` : key
|
|
84
|
+
walkZodSchema(value as AnyZodSchema, newPath, issues, toolName)
|
|
108
85
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
86
|
+
} else if (schema instanceof z.ZodArray) {
|
|
87
|
+
const element = (schema as unknown as { _zod: { def: { element: AnyZodSchema } } })._zod.def
|
|
88
|
+
.element
|
|
89
|
+
walkZodSchema(element, `${path}[]`, issues, toolName)
|
|
90
|
+
} else if (
|
|
91
|
+
schema instanceof z.ZodOptional ||
|
|
92
|
+
schema instanceof z.ZodNullable ||
|
|
93
|
+
schema instanceof z.ZodDefault
|
|
94
|
+
) {
|
|
95
|
+
walkZodSchema(schema.unwrap() as AnyZodSchema, path, issues, toolName)
|
|
96
|
+
} else if (schema instanceof z.ZodUnion) {
|
|
97
|
+
const options = (schema as unknown as { _zod: { def: { options: AnyZodSchema[] } } })._zod
|
|
98
|
+
.def.options
|
|
99
|
+
options.forEach((option: AnyZodSchema, index: number) => {
|
|
100
|
+
walkZodSchema(option, `${path}[union:${index}]`, issues, toolName)
|
|
101
|
+
})
|
|
102
|
+
} else if (schema instanceof z.ZodDiscriminatedUnion) {
|
|
103
|
+
const options = (schema as unknown as { _zod: { def: { options: AnyZodSchema[] } } })._zod
|
|
104
|
+
.def.options
|
|
105
|
+
options.forEach((option: AnyZodSchema, index: number) => {
|
|
106
|
+
walkZodSchema(option, `${path}[union:${index}]`, issues, toolName)
|
|
107
|
+
})
|
|
108
|
+
} else if (schema instanceof z.ZodIntersection) {
|
|
109
|
+
const left = (schema as unknown as { _zod: { def: { left: AnyZodSchema } } })._zod.def.left
|
|
110
|
+
const right = (schema as unknown as { _zod: { def: { right: AnyZodSchema } } })._zod.def
|
|
111
|
+
.right
|
|
112
|
+
walkZodSchema(left, `${path}[left]`, issues, toolName)
|
|
113
|
+
walkZodSchema(right, `${path}[right]`, issues, toolName)
|
|
114
|
+
} else if (schema instanceof z.ZodRecord) {
|
|
115
|
+
const valueType = (schema as unknown as { _zod: { def: { valueType: AnyZodSchema } } })._zod
|
|
116
|
+
.def.valueType
|
|
117
|
+
walkZodSchema(valueType, `${path}[value]`, issues, toolName)
|
|
118
|
+
} else if (schema instanceof z.ZodTuple) {
|
|
119
|
+
const items = (schema as unknown as { _zod: { def: { items: AnyZodSchema[] } } })._zod.def
|
|
120
|
+
.items
|
|
121
|
+
items.forEach((item: AnyZodSchema, index: number) => {
|
|
122
|
+
walkZodSchema(item, `${path}[${index}]`, issues, toolName)
|
|
123
|
+
})
|
|
127
124
|
}
|
|
128
125
|
}
|
|
129
126
|
|
|
130
127
|
/**
|
|
131
128
|
* Validate a single tool's parameter schema
|
|
132
129
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
function validateToolSchema(tool: {
|
|
131
|
+
name?: string
|
|
132
|
+
parameters?: Record<string, z.ZodTypeAny>
|
|
133
|
+
}): ValidationIssue[] {
|
|
135
134
|
const issues: ValidationIssue[] = []
|
|
136
135
|
const toolName = tool.name || 'unknown'
|
|
137
136
|
|
|
@@ -174,8 +173,10 @@ async function validateAllSchemas(verbose: boolean = false): Promise<ValidationR
|
|
|
174
173
|
if (tool.parameters) {
|
|
175
174
|
try {
|
|
176
175
|
const schema = z.object(tool.parameters)
|
|
177
|
-
const shape = schema.
|
|
178
|
-
|
|
176
|
+
const shape = schema.shape
|
|
177
|
+
if (shape) {
|
|
178
|
+
totalParameters += Object.keys(shape).length
|
|
179
|
+
}
|
|
179
180
|
} catch {
|
|
180
181
|
// Skip counting if schema is invalid
|
|
181
182
|
}
|