@task-shepherd/agent 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/meta.json +5 -5
  4. package/package.json +3 -2
  5. package/shared/dist/index.d.ts +15 -0
  6. package/shared/dist/index.js +12 -0
  7. package/shared/dist/mcp-client/client.d.ts +18 -0
  8. package/shared/dist/mcp-client/client.js +49 -0
  9. package/shared/dist/mcp-client/index.d.ts +7 -0
  10. package/shared/dist/mcp-client/index.js +7 -0
  11. package/shared/dist/mcp-client/types.d.ts +822 -0
  12. package/shared/dist/mcp-client/types.js +193 -0
  13. package/shared/dist/schema/index.d.ts +189 -0
  14. package/shared/dist/schema/index.js +142 -0
  15. package/shared/dist/schema/mcp-mappings.d.ts +50 -0
  16. package/shared/dist/schema/mcp-mappings.js +563 -0
  17. package/shared/dist/schema/validation.d.ts +91 -0
  18. package/shared/dist/schema/validation.js +282 -0
  19. package/shared/dist/work-queue/index.d.ts +7 -0
  20. package/shared/dist/work-queue/index.js +7 -0
  21. package/shared/dist/work-queue/types.d.ts +147 -0
  22. package/shared/dist/work-queue/types.js +4 -0
  23. package/shared/dist/work-queue/validation.d.ts +24 -0
  24. package/shared/dist/work-queue/validation.js +160 -0
  25. package/shared/dist/workspace/constants.d.ts +148 -0
  26. package/shared/dist/workspace/constants.js +432 -0
  27. package/shared/dist/workspace/index.d.ts +10 -0
  28. package/shared/dist/workspace/index.js +10 -0
  29. package/shared/dist/workspace/types.d.ts +477 -0
  30. package/shared/dist/workspace/types.js +9 -0
  31. package/shared/dist/workspace/utils.d.ts +79 -0
  32. package/shared/dist/workspace/utils.js +334 -0
  33. package/shared/dist/workspace/validation.d.ts +1312 -0
  34. package/shared/dist/workspace/validation.js +467 -0
  35. package/shared/graphql/generated-internal.ts +3629 -0
  36. package/shared/graphql/generated-public.ts +773 -0
  37. package/shared/graphql/generated.d.ts +7456 -0
  38. package/shared/graphql/generated.js +11799 -0
  39. package/shared/graphql/generated.ts +27569 -0
  40. package/shared/graphql/generated.ts.backup +16531 -0
  41. package/shared/graphql/generated.ts.working +4828 -0
  42. package/shared/graphql/introspection-internal.json +15845 -0
  43. package/shared/graphql/introspection-public.json +9658 -0
  44. package/shared/graphql/introspection.json +44263 -0
  45. package/shared/graphql/operations/ai-service.graphql +131 -0
  46. package/shared/graphql/operations/ai-work-queue.graphql +31 -0
  47. package/shared/graphql/operations/analytics.graphql +283 -0
  48. package/shared/graphql/operations/analytics.ts +3 -0
  49. package/shared/graphql/operations/api-keys.graphql +126 -0
  50. package/shared/graphql/operations/attachments.graphql +53 -0
  51. package/shared/graphql/operations/attachments.ts +39 -0
  52. package/shared/graphql/operations/audit.graphql +46 -0
  53. package/shared/graphql/operations/auth.graphql +83 -0
  54. package/shared/graphql/operations/claude-usage.graphql +178 -0
  55. package/shared/graphql/operations/comments.graphql +4 -0
  56. package/shared/graphql/operations/dashboard.graphql +29 -0
  57. package/shared/graphql/operations/development-plans.graphql +408 -0
  58. package/shared/graphql/operations/early-access.graphql.disabled +21 -0
  59. package/shared/graphql/operations/errors.graphql.disabled +83 -0
  60. package/shared/graphql/operations/internal-api.graphql +931 -0
  61. package/shared/graphql/operations/notifications.graphql +4 -0
  62. package/shared/graphql/operations/organization-invites.graphql.disabled +32 -0
  63. package/shared/graphql/operations/performance.graphql +4 -0
  64. package/shared/graphql/operations/project-reviews.graphql +610 -0
  65. package/shared/graphql/operations/projects.graphql +98 -0
  66. package/shared/graphql/operations/settings.graphql +4 -0
  67. package/shared/graphql/operations/stories.graphql +113 -0
  68. package/shared/graphql/operations/subscriptions.graphql +235 -0
  69. package/shared/graphql/operations/subscriptions.graphql.disabled +96 -0
  70. package/shared/graphql/operations/tasks.graphql +257 -0
  71. package/shared/graphql/operations/team.graphql +111 -0
  72. package/shared/graphql/operations/team.ts +226 -0
  73. package/shared/graphql/operations/time-tracking.graphql.disabled +96 -0
  74. package/shared/graphql/operations/work-queue.graphql +210 -0
  75. package/shared/graphql/operations/work-queue.graphql.disabled +474 -0
  76. package/shared/graphql/operations/workspace.graphql +146 -0
  77. package/shared/graphql/schema-internal.graphql +1085 -0
  78. package/shared/graphql/schema-public.graphql +709 -0
  79. package/shared/graphql/schema.graphql +3473 -0
  80. package/shared/package.json +23 -0
  81. package/web/README.md +68 -0
@@ -0,0 +1,563 @@
1
+ /**
2
+ * MCP Tool Mappings Configuration
3
+ *
4
+ * This file serves as the centralized mapping between MCP tools and GraphQL operations,
5
+ * ensuring consistency across all TasqHub components. It defines which GraphQL
6
+ * operations each MCP tool corresponds to and validates the interfaces.
7
+ */
8
+ /**
9
+ * Centralized MCP tool mappings organized by functional categories
10
+ */
11
+ export const MCP_TOOL_MAPPINGS = [
12
+ {
13
+ name: 'Project Management',
14
+ description: 'Tools for managing projects, stories, and tasks',
15
+ tools: [
16
+ {
17
+ toolName: 'list_projects',
18
+ description: 'List all projects with optional filtering',
19
+ graphqlOperation: 'projects',
20
+ operationType: 'query',
21
+ requiredPermissions: ['VIEW'],
22
+ inputSchema: {
23
+ type: 'object',
24
+ properties: {
25
+ limit: { type: 'number', default: 20, maximum: 100 },
26
+ offset: { type: 'number', default: 0 },
27
+ search: {
28
+ type: 'object',
29
+ properties: {
30
+ query: { type: 'string' },
31
+ stage: { type: 'string', enum: ['REQUIREMENTS', 'DESIGN', 'IMPLEMENTATION', 'COMPLETE', 'ARCHIVED'] },
32
+ isArchived: { type: 'boolean' },
33
+ isPublic: { type: 'boolean' }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ },
39
+ {
40
+ toolName: 'get_project',
41
+ description: 'Get a specific project by ID',
42
+ graphqlOperation: 'project',
43
+ operationType: 'query',
44
+ requiredPermissions: ['VIEW'],
45
+ inputSchema: {
46
+ type: 'object',
47
+ properties: {
48
+ id: { type: 'string' }
49
+ },
50
+ required: ['id']
51
+ }
52
+ },
53
+ {
54
+ toolName: 'create_project',
55
+ description: 'Create a new project',
56
+ graphqlOperation: 'createProject',
57
+ operationType: 'mutation',
58
+ requiredPermissions: ['PRODUCT', 'ADMIN'],
59
+ inputSchema: {
60
+ type: 'object',
61
+ properties: {
62
+ name: { type: 'string' },
63
+ description: { type: 'string' },
64
+ stage: { type: 'string', enum: ['REQUIREMENTS', 'DESIGN', 'IMPLEMENTATION', 'COMPLETE', 'ARCHIVED'] },
65
+ isPublic: { type: 'boolean' },
66
+ startDate: { type: 'string', format: 'date-time' },
67
+ targetCompletionDate: { type: 'string', format: 'date-time' },
68
+ repositoryUrl: { type: 'string', format: 'uri' },
69
+ documentationUrl: { type: 'string', format: 'uri' }
70
+ },
71
+ required: ['name']
72
+ }
73
+ },
74
+ {
75
+ toolName: 'update_project',
76
+ description: 'Update an existing project',
77
+ graphqlOperation: 'updateProject',
78
+ operationType: 'mutation',
79
+ requiredPermissions: ['PRODUCT', 'ADMIN'],
80
+ inputSchema: {
81
+ type: 'object',
82
+ properties: {
83
+ id: { type: 'string' },
84
+ name: { type: 'string' },
85
+ description: { type: 'string' },
86
+ stage: { type: 'string', enum: ['REQUIREMENTS', 'DESIGN', 'IMPLEMENTATION', 'COMPLETE', 'ARCHIVED'] },
87
+ isPublic: { type: 'boolean' },
88
+ startDate: { type: 'string', format: 'date-time' },
89
+ targetCompletionDate: { type: 'string', format: 'date-time' },
90
+ repositoryUrl: { type: 'string', format: 'uri' },
91
+ documentationUrl: { type: 'string', format: 'uri' }
92
+ },
93
+ required: ['id']
94
+ }
95
+ },
96
+ {
97
+ toolName: 'delete_project',
98
+ description: 'Delete a project',
99
+ graphqlOperation: 'deleteProject',
100
+ operationType: 'mutation',
101
+ requiredPermissions: ['PRODUCT', 'ADMIN'],
102
+ inputSchema: {
103
+ type: 'object',
104
+ properties: {
105
+ id: { type: 'string' }
106
+ },
107
+ required: ['id']
108
+ }
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ name: 'Story Management',
114
+ description: 'Tools for managing user stories and their lifecycle',
115
+ tools: [
116
+ {
117
+ toolName: 'list_stories',
118
+ description: 'List stories with filtering and pagination',
119
+ graphqlOperation: 'stories',
120
+ operationType: 'query',
121
+ requiredPermissions: ['VIEW'],
122
+ inputSchema: {
123
+ type: 'object',
124
+ properties: {
125
+ limit: { type: 'number', default: 20, maximum: 100 },
126
+ offset: { type: 'number', default: 0 },
127
+ projectId: { type: 'string' },
128
+ search: {
129
+ type: 'object',
130
+ properties: {
131
+ query: { type: 'string' },
132
+ state: { type: 'string', enum: ['pending', 'implementation', 'review', 'complete', 'blocked'] },
133
+ assignedTo: { type: 'string' },
134
+ priority: { type: 'string', enum: ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'] },
135
+ tags: { type: 'array', items: { type: 'string' } }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ },
141
+ {
142
+ toolName: 'get_story',
143
+ description: 'Get a specific story by ID',
144
+ graphqlOperation: 'story',
145
+ operationType: 'query',
146
+ requiredPermissions: ['VIEW'],
147
+ inputSchema: {
148
+ type: 'object',
149
+ properties: {
150
+ id: { type: 'string' }
151
+ },
152
+ required: ['id']
153
+ }
154
+ },
155
+ {
156
+ toolName: 'create_story',
157
+ description: 'Create a new story',
158
+ graphqlOperation: 'createStory',
159
+ operationType: 'mutation',
160
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
161
+ inputSchema: {
162
+ type: 'object',
163
+ properties: {
164
+ title: { type: 'string' },
165
+ description: { type: 'string' },
166
+ projectId: { type: 'string' },
167
+ priority: { type: 'string', enum: ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'] },
168
+ estimate: { type: 'number', minimum: 1 },
169
+ tags: { type: 'array', items: { type: 'string' } },
170
+ acceptanceCriteria: { type: 'array', items: { type: 'string' } },
171
+ storyLink: { type: 'string', format: 'uri' },
172
+ assignedTo: { type: 'string' },
173
+ orderIndex: { type: 'number' }
174
+ },
175
+ required: ['title', 'projectId']
176
+ }
177
+ },
178
+ {
179
+ toolName: 'update_story',
180
+ description: 'Update an existing story',
181
+ graphqlOperation: 'updateStory',
182
+ operationType: 'mutation',
183
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
184
+ inputSchema: {
185
+ type: 'object',
186
+ properties: {
187
+ id: { type: 'string' },
188
+ title: { type: 'string' },
189
+ description: { type: 'string' },
190
+ priority: { type: 'string', enum: ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'] },
191
+ estimate: { type: 'number', minimum: 1 },
192
+ tags: { type: 'array', items: { type: 'string' } },
193
+ acceptanceCriteria: { type: 'array', items: { type: 'string' } },
194
+ storyLink: { type: 'string', format: 'uri' },
195
+ assignedTo: { type: 'string' }
196
+ },
197
+ required: ['id']
198
+ }
199
+ },
200
+ {
201
+ toolName: 'claim_story',
202
+ description: 'Claim a story for work',
203
+ graphqlOperation: 'claimStory',
204
+ operationType: 'mutation',
205
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
206
+ inputSchema: {
207
+ type: 'object',
208
+ properties: {
209
+ id: { type: 'string' }
210
+ },
211
+ required: ['id']
212
+ }
213
+ },
214
+ {
215
+ toolName: 'unclaim_story',
216
+ description: 'Unclaim a previously claimed story',
217
+ graphqlOperation: 'releaseStory',
218
+ operationType: 'mutation',
219
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
220
+ inputSchema: {
221
+ type: 'object',
222
+ properties: {
223
+ id: { type: 'string' }
224
+ },
225
+ required: ['id']
226
+ }
227
+ },
228
+ {
229
+ toolName: 'complete_story',
230
+ description: 'Mark a story as complete',
231
+ graphqlOperation: 'completeStory',
232
+ operationType: 'mutation',
233
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
234
+ inputSchema: {
235
+ type: 'object',
236
+ properties: {
237
+ id: { type: 'string' },
238
+ implementationSummary: { type: 'string' }
239
+ },
240
+ required: ['id']
241
+ }
242
+ },
243
+ {
244
+ toolName: 'review_story',
245
+ description: 'Review a completed story',
246
+ graphqlOperation: 'reviewStory',
247
+ operationType: 'mutation',
248
+ requiredPermissions: ['PRODUCT', 'ADMIN'],
249
+ inputSchema: {
250
+ type: 'object',
251
+ properties: {
252
+ id: { type: 'string' },
253
+ approved: { type: 'boolean' },
254
+ reviewNotes: { type: 'string' }
255
+ },
256
+ required: ['id', 'approved']
257
+ }
258
+ }
259
+ ]
260
+ },
261
+ {
262
+ name: 'Task Management',
263
+ description: 'Tools for managing tasks within stories',
264
+ tools: [
265
+ {
266
+ toolName: 'list_tasks',
267
+ description: 'List tasks with filtering and pagination',
268
+ graphqlOperation: 'tasks',
269
+ operationType: 'query',
270
+ requiredPermissions: ['VIEW'],
271
+ inputSchema: {
272
+ type: 'object',
273
+ properties: {
274
+ limit: { type: 'number', default: 20, maximum: 100 },
275
+ offset: { type: 'number', default: 0 },
276
+ storyId: { type: 'string' },
277
+ search: {
278
+ type: 'object',
279
+ properties: {
280
+ query: { type: 'string' },
281
+ status: { type: 'string', enum: ['pending', 'implementation', 'complete', 'blocked'] },
282
+ type: { type: 'string', enum: ['PLANNED', 'FOLLOWUP', 'ASK'] },
283
+ assignedTo: { type: 'string' },
284
+ areas: { type: 'array', items: { type: 'string' } }
285
+ }
286
+ }
287
+ }
288
+ }
289
+ },
290
+ {
291
+ toolName: 'get_task',
292
+ description: 'Get a specific task by ID',
293
+ graphqlOperation: 'task',
294
+ operationType: 'query',
295
+ requiredPermissions: ['VIEW'],
296
+ inputSchema: {
297
+ type: 'object',
298
+ properties: {
299
+ id: { type: 'string' }
300
+ },
301
+ required: ['id']
302
+ }
303
+ },
304
+ {
305
+ toolName: 'create_task',
306
+ description: 'Create a new task',
307
+ graphqlOperation: 'createTask',
308
+ operationType: 'mutation',
309
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
310
+ inputSchema: {
311
+ type: 'object',
312
+ properties: {
313
+ title: { type: 'string' },
314
+ description: { type: 'string' },
315
+ storyId: { type: 'string' },
316
+ areas: { type: 'array', items: { type: 'string' }, minItems: 1 },
317
+ type: { type: 'string', enum: ['PLANNED', 'FOLLOWUP', 'ASK'] },
318
+ priority: { type: 'string', enum: ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'] },
319
+ estimate: { type: 'number', minimum: 1 },
320
+ assignedTo: { type: 'string' }
321
+ },
322
+ required: ['title', 'storyId', 'areas']
323
+ }
324
+ },
325
+ {
326
+ toolName: 'update_task',
327
+ description: 'Update an existing task',
328
+ graphqlOperation: 'updateTask',
329
+ operationType: 'mutation',
330
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
331
+ inputSchema: {
332
+ type: 'object',
333
+ properties: {
334
+ id: { type: 'string' },
335
+ title: { type: 'string' },
336
+ description: { type: 'string' },
337
+ type: { type: 'string', enum: ['PLANNED', 'FOLLOWUP', 'ASK'] },
338
+ priority: { type: 'string', enum: ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'] },
339
+ estimate: { type: 'number', minimum: 1 },
340
+ assignedTo: { type: 'string' }
341
+ },
342
+ required: ['id']
343
+ }
344
+ },
345
+ {
346
+ toolName: 'claim_task',
347
+ description: 'Claim a task for work',
348
+ graphqlOperation: 'claimTask',
349
+ operationType: 'mutation',
350
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
351
+ inputSchema: {
352
+ type: 'object',
353
+ properties: {
354
+ id: { type: 'string' }
355
+ },
356
+ required: ['id']
357
+ }
358
+ },
359
+ {
360
+ toolName: 'unclaim_task',
361
+ description: 'Unclaim a previously claimed task',
362
+ graphqlOperation: 'unclaimTask',
363
+ operationType: 'mutation',
364
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
365
+ inputSchema: {
366
+ type: 'object',
367
+ properties: {
368
+ id: { type: 'string' }
369
+ },
370
+ required: ['id']
371
+ }
372
+ },
373
+ {
374
+ toolName: 'complete_task',
375
+ description: 'Mark a task as complete with implementation details',
376
+ graphqlOperation: 'completeTask',
377
+ operationType: 'mutation',
378
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
379
+ inputSchema: {
380
+ type: 'object',
381
+ properties: {
382
+ id: { type: 'string' },
383
+ implementationSummary: { type: 'string' }
384
+ },
385
+ required: ['id']
386
+ }
387
+ }
388
+ ]
389
+ },
390
+ {
391
+ name: 'User Management',
392
+ description: 'Tools for user authentication and management',
393
+ tools: [
394
+ {
395
+ toolName: 'register_worker',
396
+ description: 'Register a new worker (human or AI) with the system',
397
+ graphqlOperation: 'register',
398
+ operationType: 'mutation',
399
+ requiredPermissions: [],
400
+ inputSchema: {
401
+ type: 'object',
402
+ properties: {
403
+ email: { type: 'string', format: 'email' },
404
+ password: { type: 'string', minLength: 8 },
405
+ firstName: { type: 'string' },
406
+ lastName: { type: 'string' },
407
+ role: { type: 'string', enum: ['VIEW', 'WORKER', 'PRODUCT', 'ADMIN'] }
408
+ },
409
+ required: ['email', 'password']
410
+ }
411
+ },
412
+ {
413
+ toolName: 'list_workers',
414
+ description: 'List all registered workers',
415
+ graphqlOperation: 'users',
416
+ operationType: 'query',
417
+ requiredPermissions: ['ADMIN'],
418
+ inputSchema: {
419
+ type: 'object',
420
+ properties: {
421
+ activeOnly: { type: 'boolean', default: true },
422
+ type: { type: 'string', enum: ['HUMAN', 'AI'] },
423
+ capability: { type: 'string' }
424
+ }
425
+ }
426
+ }
427
+ ]
428
+ },
429
+ {
430
+ name: 'Dependencies',
431
+ description: 'Tools for managing story and task dependencies',
432
+ tools: [
433
+ {
434
+ toolName: 'create_story_dependency',
435
+ description: 'Create a dependency between two stories',
436
+ graphqlOperation: 'createStoryDependency',
437
+ operationType: 'mutation',
438
+ requiredPermissions: ['WORKER', 'PRODUCT', 'ADMIN'],
439
+ inputSchema: {
440
+ type: 'object',
441
+ properties: {
442
+ storyId: { type: 'string' },
443
+ dependsOnStoryId: { type: 'string' }
444
+ },
445
+ required: ['storyId', 'dependsOnStoryId']
446
+ }
447
+ },
448
+ {
449
+ toolName: 'get_dependency_graph',
450
+ description: 'Get the complete dependency graph for a project',
451
+ graphqlOperation: 'project',
452
+ operationType: 'query',
453
+ requiredPermissions: ['VIEW'],
454
+ inputSchema: {
455
+ type: 'object',
456
+ properties: {
457
+ projectId: { type: 'string' }
458
+ },
459
+ required: ['projectId']
460
+ }
461
+ }
462
+ ]
463
+ },
464
+ {
465
+ name: 'Work Management',
466
+ description: 'Tools for finding and allocating available work',
467
+ tools: [
468
+ {
469
+ toolName: 'get_available_stories',
470
+ description: 'Find stories available for claiming',
471
+ graphqlOperation: 'stories',
472
+ operationType: 'query',
473
+ requiredPermissions: ['VIEW'],
474
+ inputSchema: {
475
+ type: 'object',
476
+ properties: {
477
+ limit: { type: 'number', default: 20, maximum: 100 },
478
+ offset: { type: 'number', default: 0 },
479
+ areas: { type: 'array', items: { type: 'string' } },
480
+ search: {
481
+ type: 'object',
482
+ properties: {
483
+ state: { type: 'string', enum: ['pending'] },
484
+ assignedTo: { type: 'null' }
485
+ }
486
+ }
487
+ }
488
+ }
489
+ },
490
+ {
491
+ toolName: 'get_available_tasks',
492
+ description: 'Find tasks available for claiming',
493
+ graphqlOperation: 'tasks',
494
+ operationType: 'query',
495
+ requiredPermissions: ['VIEW'],
496
+ inputSchema: {
497
+ type: 'object',
498
+ properties: {
499
+ limit: { type: 'number', default: 20, maximum: 100 },
500
+ offset: { type: 'number', default: 0 },
501
+ areas: { type: 'array', items: { type: 'string' } },
502
+ search: {
503
+ type: 'object',
504
+ properties: {
505
+ status: { type: 'string', enum: ['pending'] },
506
+ assignedTo: { type: 'null' }
507
+ }
508
+ }
509
+ }
510
+ }
511
+ }
512
+ ]
513
+ }
514
+ ];
515
+ /**
516
+ * Get MCP tool mapping by tool name
517
+ */
518
+ export function getMCPToolMapping(toolName) {
519
+ for (const category of MCP_TOOL_MAPPINGS) {
520
+ const tool = category.tools.find(t => t.toolName === toolName);
521
+ if (tool)
522
+ return tool;
523
+ }
524
+ return undefined;
525
+ }
526
+ /**
527
+ * Get all MCP tool names
528
+ */
529
+ export function getAllMCPToolNames() {
530
+ return MCP_TOOL_MAPPINGS.flatMap(category => category.tools.map(tool => tool.toolName));
531
+ }
532
+ /**
533
+ * Get tools by GraphQL operation
534
+ */
535
+ export function getToolsByGraphQLOperation(operationName) {
536
+ return MCP_TOOL_MAPPINGS.flatMap(category => category.tools.filter(tool => tool.graphqlOperation === operationName));
537
+ }
538
+ /**
539
+ * Get tools by category
540
+ */
541
+ export function getToolsByCategory(categoryName) {
542
+ const category = MCP_TOOL_MAPPINGS.find(c => c.name === categoryName);
543
+ return category ? category.tools : [];
544
+ }
545
+ /**
546
+ * Validate that a tool operation matches its GraphQL schema
547
+ */
548
+ export function validateToolOperation(toolName, input) {
549
+ const mapping = getMCPToolMapping(toolName);
550
+ if (!mapping) {
551
+ return { valid: false, errors: [`Unknown tool: ${toolName}`] };
552
+ }
553
+ // Basic validation - in a real implementation, this would use a JSON schema validator
554
+ const errors = [];
555
+ if (mapping.inputSchema?.required) {
556
+ for (const requiredField of mapping.inputSchema.required) {
557
+ if (!(requiredField in input)) {
558
+ errors.push(`Missing required field: ${requiredField}`);
559
+ }
560
+ }
561
+ }
562
+ return { valid: errors.length === 0, errors };
563
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Schema Validation System
3
+ *
4
+ * This module provides comprehensive validation for GraphQL schema consistency
5
+ * and MCP tool compatibility across all TasqHub components.
6
+ */
7
+ import { GraphQLSchema } from 'graphql';
8
+ export interface SchemaValidationResult {
9
+ valid: boolean;
10
+ errors: SchemaValidationError[];
11
+ warnings: SchemaValidationWarning[];
12
+ }
13
+ export interface SchemaValidationError {
14
+ type: 'MISSING_OPERATION' | 'TYPE_MISMATCH' | 'BREAKING_CHANGE' | 'INVALID_MAPPING';
15
+ message: string;
16
+ toolName?: string;
17
+ operationName?: string;
18
+ fieldPath?: string;
19
+ severity: 'error' | 'warning';
20
+ }
21
+ export interface SchemaValidationWarning {
22
+ type: 'DEPRECATED_FIELD' | 'UNUSED_OPERATION' | 'PERFORMANCE_CONCERN';
23
+ message: string;
24
+ suggestion?: string;
25
+ }
26
+ export interface SchemaCompatibilityCheck {
27
+ compatible: boolean;
28
+ breakingChanges: string[];
29
+ safeChanges: string[];
30
+ deprecations: string[];
31
+ }
32
+ /**
33
+ * Main schema validator class
34
+ */
35
+ export declare class SchemaValidator {
36
+ private schema;
37
+ private introspection;
38
+ constructor(schema?: GraphQLSchema);
39
+ /**
40
+ * Set the GraphQL schema to validate against
41
+ */
42
+ setSchema(schema: GraphQLSchema): void;
43
+ /**
44
+ * Validate all MCP tool mappings against the current schema
45
+ */
46
+ validateMCPMappings(): SchemaValidationResult;
47
+ /**
48
+ * Validate a single MCP tool mapping
49
+ */
50
+ private validateSingleTool;
51
+ /**
52
+ * Find a GraphQL operation in the schema
53
+ */
54
+ private findGraphQLOperation;
55
+ /**
56
+ * Validate input schema compatibility
57
+ */
58
+ private validateInputSchema;
59
+ /**
60
+ * Get all GraphQL operations from the schema
61
+ */
62
+ private getAllGraphQLOperations;
63
+ /**
64
+ * Check compatibility between two schemas (for migration validation)
65
+ */
66
+ static compareSchemas(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): SchemaCompatibilityCheck;
67
+ /**
68
+ * Helper to extract operations from introspection
69
+ */
70
+ private static getOperationsFromIntrospection;
71
+ /**
72
+ * Validate a specific MCP tool operation
73
+ */
74
+ validateToolOperation(toolName: string, input: any): {
75
+ valid: boolean;
76
+ errors: string[];
77
+ };
78
+ }
79
+ /**
80
+ * Utility function to create a schema validator from a GraphQL schema file
81
+ */
82
+ export declare function createSchemaValidatorFromFile(schemaPath: string): Promise<SchemaValidator>;
83
+ /**
84
+ * Utility function to validate schema consistency across components
85
+ */
86
+ export declare function validateCrossComponentConsistency(schemas: {
87
+ backend: GraphQLSchema;
88
+ frontend?: any;
89
+ mcpServer?: any;
90
+ aiToolsService?: any;
91
+ }): SchemaValidationResult;