@aaronsb/jira-cloud-mcp 0.1.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.
@@ -0,0 +1,1185 @@
1
+ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
2
+ import { toolSchemas } from '../schemas/tool-schemas.js';
3
+ /**
4
+ * Sets up tool resource handlers for the Jira MCP server
5
+ * @returns Object containing tool resource handlers
6
+ */
7
+ export function setupToolResourceHandlers() {
8
+ return {
9
+ /**
10
+ * Lists available tool resources
11
+ */
12
+ async listToolResources() {
13
+ const resources = Object.keys(toolSchemas)
14
+ // Filter out deprecated tools
15
+ .filter(key => key !== 'search_jira_issues')
16
+ .map(toolName => ({
17
+ uri: `jira://tools/${toolName}/documentation`,
18
+ name: `${formatToolName(toolName)} Documentation`,
19
+ mimeType: 'application/json',
20
+ description: `Comprehensive documentation for the ${formatToolName(toolName)} tool`
21
+ }));
22
+ return {
23
+ resources
24
+ };
25
+ },
26
+ /**
27
+ * Handles tool resource read requests
28
+ */
29
+ async readToolResource(uri) {
30
+ console.error(`Reading tool resource: ${uri}`);
31
+ try {
32
+ // Handle tool documentation resources
33
+ const toolMatch = uri.match(/^jira:\/\/tools\/([^/]+)\/documentation$/);
34
+ if (toolMatch) {
35
+ const toolName = toolMatch[1];
36
+ return await getToolDocumentation(toolName);
37
+ }
38
+ throw new McpError(ErrorCode.InvalidRequest, `Unknown tool resource: ${uri}`);
39
+ }
40
+ catch (error) {
41
+ console.error(`Error reading tool resource ${uri}:`, error);
42
+ if (error instanceof McpError) {
43
+ throw error;
44
+ }
45
+ throw new McpError(ErrorCode.InternalError, `Error reading tool resource: ${error.message}`);
46
+ }
47
+ }
48
+ };
49
+ }
50
+ /**
51
+ * Formats a tool name for display
52
+ */
53
+ function formatToolName(toolName) {
54
+ return toolName
55
+ .split('_')
56
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
57
+ .join(' ');
58
+ }
59
+ /**
60
+ * Gets comprehensive documentation for a specific tool
61
+ */
62
+ async function getToolDocumentation(toolName) {
63
+ // Check if the tool exists
64
+ if (!(toolName in toolSchemas)) {
65
+ throw new McpError(ErrorCode.InvalidRequest, `Tool not found: ${toolName}`);
66
+ }
67
+ // Get the tool schema
68
+ const schema = toolSchemas[toolName];
69
+ // Generate documentation based on the tool
70
+ let documentation;
71
+ switch (toolName) {
72
+ case 'manage_jira_issue':
73
+ documentation = generateIssueToolDocumentation(schema);
74
+ break;
75
+ case 'manage_jira_board':
76
+ documentation = generateBoardToolDocumentation(schema);
77
+ break;
78
+ case 'manage_jira_sprint':
79
+ documentation = generateSprintToolDocumentation(schema);
80
+ break;
81
+ case 'manage_jira_filter':
82
+ documentation = generateFilterToolDocumentation(schema);
83
+ break;
84
+ case 'manage_jira_project':
85
+ documentation = generateProjectToolDocumentation(schema);
86
+ break;
87
+ default:
88
+ documentation = generateGenericToolDocumentation(toolName, schema);
89
+ }
90
+ return {
91
+ contents: [
92
+ {
93
+ uri: `jira://tools/${toolName}/documentation`,
94
+ mimeType: 'application/json',
95
+ text: JSON.stringify(documentation, null, 2)
96
+ }
97
+ ]
98
+ };
99
+ }
100
+ /**
101
+ * Generates documentation for the manage_jira_issue tool
102
+ */
103
+ function generateIssueToolDocumentation(schema) {
104
+ return {
105
+ name: "Issue Management",
106
+ description: schema.description,
107
+ operations: {
108
+ get: {
109
+ description: "Retrieves issue details",
110
+ required_parameters: ["issueKey"],
111
+ optional_parameters: ["expand"],
112
+ expand_options: ["comments", "transitions", "attachments", "related_issues", "history"],
113
+ examples: [
114
+ {
115
+ description: "Get basic issue details",
116
+ code: {
117
+ operation: "get",
118
+ issueKey: "PROJ-123"
119
+ }
120
+ },
121
+ {
122
+ description: "Get issue with comments and attachments",
123
+ code: {
124
+ operation: "get",
125
+ issueKey: "PROJ-123",
126
+ expand: ["comments", "attachments"]
127
+ }
128
+ }
129
+ ]
130
+ },
131
+ create: {
132
+ description: "Creates a new issue",
133
+ required_parameters: ["projectKey", "summary", "issueType"],
134
+ optional_parameters: ["description", "assignee", "priority", "labels", "customFields"],
135
+ examples: [
136
+ {
137
+ description: "Create a basic issue",
138
+ code: {
139
+ operation: "create",
140
+ projectKey: "PROJ",
141
+ summary: "New feature request",
142
+ issueType: "Story"
143
+ }
144
+ },
145
+ {
146
+ description: "Create a detailed bug report",
147
+ code: {
148
+ operation: "create",
149
+ projectKey: "PROJ",
150
+ summary: "Search functionality not working",
151
+ issueType: "Bug",
152
+ description: "The search function returns no results when using special characters.",
153
+ priority: "High",
154
+ labels: ["search", "frontend"],
155
+ customFields: {
156
+ "steps_to_reproduce": "1. Go to search page\n2. Enter search with '%'\n3. Submit search"
157
+ }
158
+ }
159
+ }
160
+ ]
161
+ },
162
+ update: {
163
+ description: "Updates an existing issue",
164
+ required_parameters: ["issueKey"],
165
+ optional_parameters: ["summary", "description", "assignee", "priority", "labels", "customFields"],
166
+ examples: [
167
+ {
168
+ description: "Update issue summary",
169
+ code: {
170
+ operation: "update",
171
+ issueKey: "PROJ-123",
172
+ summary: "Updated feature request"
173
+ }
174
+ },
175
+ {
176
+ description: "Add worklog to issue",
177
+ code: {
178
+ operation: "update",
179
+ issueKey: "PROJ-123",
180
+ customFields: {
181
+ "worklog": {
182
+ "timeSpent": "3h 30m",
183
+ "comment": "Implemented feature X",
184
+ "started": "2025-04-09T09:00:00.000Z"
185
+ }
186
+ }
187
+ }
188
+ }
189
+ ]
190
+ },
191
+ delete: {
192
+ description: "Deletes an issue",
193
+ required_parameters: ["issueKey"],
194
+ examples: [
195
+ {
196
+ description: "Delete an issue",
197
+ code: {
198
+ operation: "delete",
199
+ issueKey: "PROJ-123"
200
+ }
201
+ }
202
+ ]
203
+ },
204
+ transition: {
205
+ description: "Transitions an issue to a new status",
206
+ required_parameters: ["issueKey", "transitionId"],
207
+ optional_parameters: ["comment"],
208
+ examples: [
209
+ {
210
+ description: "Transition issue to 'In Progress'",
211
+ code: {
212
+ operation: "transition",
213
+ issueKey: "PROJ-123",
214
+ transitionId: "11"
215
+ }
216
+ },
217
+ {
218
+ description: "Transition issue with comment",
219
+ code: {
220
+ operation: "transition",
221
+ issueKey: "PROJ-123",
222
+ transitionId: "21",
223
+ comment: "Closing this issue as it's been completed and tested."
224
+ }
225
+ }
226
+ ]
227
+ },
228
+ comment: {
229
+ description: "Adds a comment to an issue",
230
+ required_parameters: ["issueKey", "comment"],
231
+ examples: [
232
+ {
233
+ description: "Add a comment to an issue",
234
+ code: {
235
+ operation: "comment",
236
+ issueKey: "PROJ-123",
237
+ comment: "This has been reviewed and looks good."
238
+ }
239
+ }
240
+ ]
241
+ },
242
+ link: {
243
+ description: "Creates a link between two issues",
244
+ required_parameters: ["issueKey", "linkedIssueKey", "linkType"],
245
+ examples: [
246
+ {
247
+ description: "Link issue as blocking another",
248
+ code: {
249
+ operation: "link",
250
+ issueKey: "PROJ-123",
251
+ linkedIssueKey: "PROJ-456",
252
+ linkType: "blocks"
253
+ }
254
+ },
255
+ {
256
+ description: "Link issue to an epic",
257
+ code: {
258
+ operation: "link",
259
+ issueKey: "PROJ-123",
260
+ linkedIssueKey: "PROJ-100",
261
+ linkType: "is part of"
262
+ }
263
+ }
264
+ ]
265
+ }
266
+ },
267
+ common_use_cases: [
268
+ {
269
+ title: "Tracking work logs",
270
+ description: "To track time spent on issues:",
271
+ steps: [
272
+ {
273
+ description: "Add a work log to an issue",
274
+ code: {
275
+ operation: "update",
276
+ issueKey: "PROJ-123",
277
+ customFields: {
278
+ "worklog": {
279
+ "timeSpent": "3h 30m",
280
+ "comment": "Implemented feature X",
281
+ "started": "2025-04-09T09:00:00.000Z"
282
+ }
283
+ }
284
+ }
285
+ },
286
+ {
287
+ description: "View work logs for an issue",
288
+ code: {
289
+ operation: "get",
290
+ issueKey: "PROJ-123",
291
+ expand: ["worklog"]
292
+ }
293
+ }
294
+ ]
295
+ },
296
+ {
297
+ title: "Working with attachments",
298
+ description: "To manage attachments on issues:",
299
+ steps: [
300
+ {
301
+ description: "View attachments on an issue",
302
+ code: {
303
+ operation: "get",
304
+ issueKey: "PROJ-123",
305
+ expand: ["attachments"]
306
+ }
307
+ }
308
+ ]
309
+ },
310
+ {
311
+ title: "Epic management",
312
+ description: "To manage epics and their issues:",
313
+ steps: [
314
+ {
315
+ description: "Link an issue to an epic",
316
+ code: {
317
+ operation: "link",
318
+ issueKey: "PROJ-123",
319
+ linkedIssueKey: "PROJ-100",
320
+ linkType: "is part of"
321
+ }
322
+ },
323
+ {
324
+ description: "Find all issues in an epic",
325
+ tool: "manage_jira_filter",
326
+ code: {
327
+ operation: "execute_jql",
328
+ jql: "\"Epic Link\" = PROJ-100"
329
+ }
330
+ }
331
+ ]
332
+ }
333
+ ],
334
+ related_resources: [
335
+ {
336
+ name: "Project Overview",
337
+ uri: "jira://projects/{projectKey}/overview",
338
+ description: "Get detailed information about a project"
339
+ },
340
+ {
341
+ name: "Issue Link Types",
342
+ uri: "jira://issue-link-types",
343
+ description: "List of all available issue link types"
344
+ }
345
+ ]
346
+ };
347
+ }
348
+ /**
349
+ * Generates documentation for the manage_jira_board tool
350
+ */
351
+ function generateBoardToolDocumentation(schema) {
352
+ return {
353
+ name: "Board Management",
354
+ description: schema.description,
355
+ operations: {
356
+ get: {
357
+ description: "Retrieves board details",
358
+ required_parameters: ["boardId"],
359
+ optional_parameters: ["expand"],
360
+ expand_options: ["sprints", "issues", "configuration"],
361
+ examples: [
362
+ {
363
+ description: "Get basic board details",
364
+ code: {
365
+ operation: "get",
366
+ boardId: 123
367
+ }
368
+ },
369
+ {
370
+ description: "Get board with sprints",
371
+ code: {
372
+ operation: "get",
373
+ boardId: 123,
374
+ expand: ["sprints"]
375
+ }
376
+ }
377
+ ]
378
+ },
379
+ list: {
380
+ description: "Lists all available boards",
381
+ required_parameters: [],
382
+ optional_parameters: ["maxResults", "startAt"],
383
+ examples: [
384
+ {
385
+ description: "List all boards",
386
+ code: {
387
+ operation: "list"
388
+ }
389
+ },
390
+ {
391
+ description: "List boards with pagination",
392
+ code: {
393
+ operation: "list",
394
+ startAt: 10,
395
+ maxResults: 20
396
+ }
397
+ }
398
+ ]
399
+ },
400
+ create: {
401
+ description: "Creates a new board",
402
+ required_parameters: ["name", "type", "projectKey"],
403
+ examples: [
404
+ {
405
+ description: "Create a scrum board",
406
+ code: {
407
+ operation: "create",
408
+ name: "Development Board",
409
+ type: "scrum",
410
+ projectKey: "PROJ"
411
+ }
412
+ },
413
+ {
414
+ description: "Create a kanban board",
415
+ code: {
416
+ operation: "create",
417
+ name: "Support Board",
418
+ type: "kanban",
419
+ projectKey: "PROJ"
420
+ }
421
+ }
422
+ ]
423
+ },
424
+ update: {
425
+ description: "Updates a board",
426
+ required_parameters: ["boardId", "name"],
427
+ examples: [
428
+ {
429
+ description: "Update board name",
430
+ code: {
431
+ operation: "update",
432
+ boardId: 123,
433
+ name: "Updated Board Name"
434
+ }
435
+ }
436
+ ]
437
+ },
438
+ delete: {
439
+ description: "Deletes a board",
440
+ required_parameters: ["boardId"],
441
+ examples: [
442
+ {
443
+ description: "Delete a board",
444
+ code: {
445
+ operation: "delete",
446
+ boardId: 123
447
+ }
448
+ }
449
+ ]
450
+ },
451
+ get_configuration: {
452
+ description: "Gets board configuration",
453
+ required_parameters: ["boardId"],
454
+ examples: [
455
+ {
456
+ description: "Get board configuration",
457
+ code: {
458
+ operation: "get_configuration",
459
+ boardId: 123
460
+ }
461
+ }
462
+ ]
463
+ }
464
+ },
465
+ common_use_cases: [
466
+ {
467
+ title: "Setting up a new project board",
468
+ description: "To create and configure a new board for a project:",
469
+ steps: [
470
+ {
471
+ description: "Create a new scrum board",
472
+ code: {
473
+ operation: "create",
474
+ name: "Development Board",
475
+ type: "scrum",
476
+ projectKey: "PROJ"
477
+ }
478
+ },
479
+ {
480
+ description: "Get the board configuration",
481
+ code: {
482
+ operation: "get_configuration",
483
+ boardId: 123
484
+ }
485
+ }
486
+ ]
487
+ },
488
+ {
489
+ title: "Working with board sprints",
490
+ description: "To manage sprints on a board:",
491
+ steps: [
492
+ {
493
+ description: "Get board with sprints",
494
+ code: {
495
+ operation: "get",
496
+ boardId: 123,
497
+ expand: ["sprints"]
498
+ }
499
+ },
500
+ {
501
+ description: "Create a new sprint",
502
+ tool: "manage_jira_sprint",
503
+ code: {
504
+ operation: "create",
505
+ boardId: 123,
506
+ name: "Sprint 1",
507
+ goal: "Complete core features"
508
+ }
509
+ }
510
+ ]
511
+ }
512
+ ],
513
+ related_resources: [
514
+ {
515
+ name: "Board Overview",
516
+ uri: "jira://boards/{boardId}/overview",
517
+ description: "Get detailed information about a board"
518
+ }
519
+ ]
520
+ };
521
+ }
522
+ /**
523
+ * Generates documentation for the manage_jira_sprint tool
524
+ */
525
+ function generateSprintToolDocumentation(schema) {
526
+ return {
527
+ name: "Sprint Management",
528
+ description: schema.description,
529
+ operations: {
530
+ get: {
531
+ description: "Retrieves sprint details",
532
+ required_parameters: ["sprintId"],
533
+ optional_parameters: ["expand"],
534
+ expand_options: ["issues", "report", "board"],
535
+ examples: [
536
+ {
537
+ description: "Get basic sprint details",
538
+ code: {
539
+ operation: "get",
540
+ sprintId: 123
541
+ }
542
+ },
543
+ {
544
+ description: "Get sprint with issues",
545
+ code: {
546
+ operation: "get",
547
+ sprintId: 123,
548
+ expand: ["issues"]
549
+ }
550
+ }
551
+ ]
552
+ },
553
+ list: {
554
+ description: "Lists sprints for a board",
555
+ required_parameters: ["boardId"],
556
+ optional_parameters: ["state", "maxResults", "startAt"],
557
+ examples: [
558
+ {
559
+ description: "List all sprints for a board",
560
+ code: {
561
+ operation: "list",
562
+ boardId: 123
563
+ }
564
+ },
565
+ {
566
+ description: "List active sprints for a board",
567
+ code: {
568
+ operation: "list",
569
+ boardId: 123,
570
+ state: "active"
571
+ }
572
+ }
573
+ ]
574
+ },
575
+ create: {
576
+ description: "Creates a new sprint",
577
+ required_parameters: ["name", "boardId"],
578
+ optional_parameters: ["startDate", "endDate", "goal"],
579
+ examples: [
580
+ {
581
+ description: "Create a basic sprint",
582
+ code: {
583
+ operation: "create",
584
+ name: "Sprint 1",
585
+ boardId: 123
586
+ }
587
+ },
588
+ {
589
+ description: "Create a sprint with dates and goal",
590
+ code: {
591
+ operation: "create",
592
+ name: "Sprint 2",
593
+ boardId: 123,
594
+ startDate: "2025-04-10T00:00:00.000Z",
595
+ endDate: "2025-04-24T00:00:00.000Z",
596
+ goal: "Complete user authentication features"
597
+ }
598
+ }
599
+ ]
600
+ },
601
+ update: {
602
+ description: "Updates a sprint",
603
+ required_parameters: ["sprintId"],
604
+ optional_parameters: ["name", "goal", "state"],
605
+ examples: [
606
+ {
607
+ description: "Update sprint name and goal",
608
+ code: {
609
+ operation: "update",
610
+ sprintId: 123,
611
+ name: "Sprint 1 - Revised",
612
+ goal: "Updated sprint goal"
613
+ }
614
+ },
615
+ {
616
+ description: "Start a sprint",
617
+ code: {
618
+ operation: "update",
619
+ sprintId: 123,
620
+ state: "active"
621
+ }
622
+ },
623
+ {
624
+ description: "Close a sprint",
625
+ code: {
626
+ operation: "update",
627
+ sprintId: 123,
628
+ state: "closed"
629
+ }
630
+ }
631
+ ]
632
+ },
633
+ delete: {
634
+ description: "Deletes a sprint",
635
+ required_parameters: ["sprintId"],
636
+ examples: [
637
+ {
638
+ description: "Delete a sprint",
639
+ code: {
640
+ operation: "delete",
641
+ sprintId: 123
642
+ }
643
+ }
644
+ ]
645
+ },
646
+ manage_issues: {
647
+ description: "Adds/removes issues from a sprint",
648
+ required_parameters: ["sprintId"],
649
+ optional_parameters: ["add", "remove"],
650
+ examples: [
651
+ {
652
+ description: "Add issues to a sprint",
653
+ code: {
654
+ operation: "manage_issues",
655
+ sprintId: 123,
656
+ add: ["PROJ-123", "PROJ-124", "PROJ-125"]
657
+ }
658
+ },
659
+ {
660
+ description: "Remove issues from a sprint",
661
+ code: {
662
+ operation: "manage_issues",
663
+ sprintId: 123,
664
+ remove: ["PROJ-126", "PROJ-127"]
665
+ }
666
+ },
667
+ {
668
+ description: "Add and remove issues in one operation",
669
+ code: {
670
+ operation: "manage_issues",
671
+ sprintId: 123,
672
+ add: ["PROJ-128", "PROJ-129"],
673
+ remove: ["PROJ-130"]
674
+ }
675
+ }
676
+ ]
677
+ }
678
+ },
679
+ common_use_cases: [
680
+ {
681
+ title: "Sprint planning",
682
+ description: "To plan and start a new sprint:",
683
+ steps: [
684
+ {
685
+ description: "Create a new sprint",
686
+ code: {
687
+ operation: "create",
688
+ name: "Sprint 1",
689
+ boardId: 123,
690
+ goal: "Complete core features"
691
+ }
692
+ },
693
+ {
694
+ description: "Add issues to the sprint",
695
+ code: {
696
+ operation: "manage_issues",
697
+ sprintId: 456,
698
+ add: ["PROJ-123", "PROJ-124", "PROJ-125"]
699
+ }
700
+ },
701
+ {
702
+ description: "Start the sprint",
703
+ code: {
704
+ operation: "update",
705
+ sprintId: 456,
706
+ state: "active"
707
+ }
708
+ }
709
+ ]
710
+ },
711
+ {
712
+ title: "Sprint review and closure",
713
+ description: "To review and close a completed sprint:",
714
+ steps: [
715
+ {
716
+ description: "Get sprint with issues",
717
+ code: {
718
+ operation: "get",
719
+ sprintId: 456,
720
+ expand: ["issues"]
721
+ }
722
+ },
723
+ {
724
+ description: "Close the sprint",
725
+ code: {
726
+ operation: "update",
727
+ sprintId: 456,
728
+ state: "closed"
729
+ }
730
+ }
731
+ ]
732
+ }
733
+ ],
734
+ related_resources: [
735
+ {
736
+ name: "Board Overview",
737
+ uri: "jira://boards/{boardId}/overview",
738
+ description: "Get detailed information about a board including its sprints"
739
+ }
740
+ ]
741
+ };
742
+ }
743
+ /**
744
+ * Generates documentation for the manage_jira_filter tool
745
+ */
746
+ function generateFilterToolDocumentation(schema) {
747
+ return {
748
+ name: "Filter Management",
749
+ description: schema.description,
750
+ operations: {
751
+ get: {
752
+ description: "Retrieves filter details",
753
+ required_parameters: ["filterId"],
754
+ optional_parameters: ["expand"],
755
+ expand_options: ["jql", "description", "permissions", "issue_count"],
756
+ examples: [
757
+ {
758
+ description: "Get basic filter details",
759
+ code: {
760
+ operation: "get",
761
+ filterId: "12345"
762
+ }
763
+ },
764
+ {
765
+ description: "Get filter with JQL and permissions",
766
+ code: {
767
+ operation: "get",
768
+ filterId: "12345",
769
+ expand: ["jql", "permissions"]
770
+ }
771
+ }
772
+ ]
773
+ },
774
+ create: {
775
+ description: "Creates a new filter",
776
+ required_parameters: ["name", "jql"],
777
+ optional_parameters: ["description", "favourite", "sharePermissions"],
778
+ examples: [
779
+ {
780
+ description: "Create a basic filter",
781
+ code: {
782
+ operation: "create",
783
+ name: "My Issues",
784
+ jql: "assignee = currentUser() AND status != Done"
785
+ }
786
+ },
787
+ {
788
+ description: "Create a shared filter",
789
+ code: {
790
+ operation: "create",
791
+ name: "Team Bugs",
792
+ jql: "project = PROJ AND issuetype = Bug AND status = Open",
793
+ description: "All open bugs for our project",
794
+ favourite: true,
795
+ sharePermissions: [
796
+ {
797
+ type: "group",
798
+ group: "developers"
799
+ }
800
+ ]
801
+ }
802
+ }
803
+ ]
804
+ },
805
+ update: {
806
+ description: "Updates a filter",
807
+ required_parameters: ["filterId"],
808
+ optional_parameters: ["name", "jql", "description", "favourite", "sharePermissions"],
809
+ examples: [
810
+ {
811
+ description: "Update filter name and JQL",
812
+ code: {
813
+ operation: "update",
814
+ filterId: "12345",
815
+ name: "Updated Filter Name",
816
+ jql: "project = PROJ AND status = 'In Progress'"
817
+ }
818
+ },
819
+ {
820
+ description: "Update filter sharing",
821
+ code: {
822
+ operation: "update",
823
+ filterId: "12345",
824
+ sharePermissions: [
825
+ {
826
+ type: "global"
827
+ }
828
+ ]
829
+ }
830
+ }
831
+ ]
832
+ },
833
+ delete: {
834
+ description: "Deletes a filter",
835
+ required_parameters: ["filterId"],
836
+ examples: [
837
+ {
838
+ description: "Delete a filter",
839
+ code: {
840
+ operation: "delete",
841
+ filterId: "12345"
842
+ }
843
+ }
844
+ ]
845
+ },
846
+ list: {
847
+ description: "Lists all filters",
848
+ required_parameters: [],
849
+ optional_parameters: ["maxResults", "startAt"],
850
+ examples: [
851
+ {
852
+ description: "List all filters",
853
+ code: {
854
+ operation: "list"
855
+ }
856
+ },
857
+ {
858
+ description: "List filters with pagination",
859
+ code: {
860
+ operation: "list",
861
+ startAt: 10,
862
+ maxResults: 20
863
+ }
864
+ }
865
+ ]
866
+ },
867
+ execute_filter: {
868
+ description: "Runs a saved filter",
869
+ required_parameters: ["filterId"],
870
+ optional_parameters: ["maxResults", "startAt", "expand"],
871
+ examples: [
872
+ {
873
+ description: "Execute a filter",
874
+ code: {
875
+ operation: "execute_filter",
876
+ filterId: "12345"
877
+ }
878
+ },
879
+ {
880
+ description: "Execute a filter with expanded issue details",
881
+ code: {
882
+ operation: "execute_filter",
883
+ filterId: "12345",
884
+ maxResults: 100,
885
+ expand: ["issue_details"]
886
+ }
887
+ }
888
+ ]
889
+ },
890
+ execute_jql: {
891
+ description: "Runs a JQL query",
892
+ required_parameters: ["jql"],
893
+ optional_parameters: ["maxResults", "startAt", "expand"],
894
+ examples: [
895
+ {
896
+ description: "Execute a simple JQL query",
897
+ code: {
898
+ operation: "execute_jql",
899
+ jql: "project = PROJ AND status = 'In Progress'"
900
+ }
901
+ },
902
+ {
903
+ description: "Execute a complex JQL query with expanded issue details",
904
+ code: {
905
+ operation: "execute_jql",
906
+ jql: "project = PROJ AND issuetype = Bug AND priority in (High, Highest) ORDER BY created DESC",
907
+ maxResults: 50,
908
+ expand: ["issue_details", "transitions"]
909
+ }
910
+ }
911
+ ]
912
+ }
913
+ },
914
+ common_use_cases: [
915
+ {
916
+ title: "Creating and sharing team filters",
917
+ description: "To create and share filters for team use:",
918
+ steps: [
919
+ {
920
+ description: "Create a team filter",
921
+ code: {
922
+ operation: "create",
923
+ name: "Team Backlog",
924
+ jql: "project = PROJ AND status = 'To Do' ORDER BY priority DESC",
925
+ description: "All backlog items for our team",
926
+ sharePermissions: [
927
+ {
928
+ type: "group",
929
+ group: "developers"
930
+ }
931
+ ]
932
+ }
933
+ },
934
+ {
935
+ description: "Execute the filter to verify results",
936
+ code: {
937
+ operation: "execute_filter",
938
+ filterId: "12345"
939
+ }
940
+ }
941
+ ]
942
+ },
943
+ {
944
+ title: "Advanced JQL queries",
945
+ description: "Examples of advanced JQL queries for specific use cases:",
946
+ steps: [
947
+ {
948
+ description: "Find recently updated issues",
949
+ code: {
950
+ operation: "execute_jql",
951
+ jql: "project = PROJ AND updated >= -7d ORDER BY updated DESC"
952
+ }
953
+ },
954
+ {
955
+ description: "Find issues with status changes",
956
+ code: {
957
+ operation: "execute_jql",
958
+ jql: "project = PROJ AND status CHANGED DURING (startOfWeek(), endOfWeek())"
959
+ }
960
+ },
961
+ {
962
+ description: "Find issues assigned to a team",
963
+ code: {
964
+ operation: "execute_jql",
965
+ jql: "project = PROJ AND assignee IN membersOf('developers')"
966
+ }
967
+ }
968
+ ]
969
+ }
970
+ ],
971
+ related_resources: [
972
+ {
973
+ name: "Issue Link Types",
974
+ uri: "jira://issue-link-types",
975
+ description: "List of all available issue link types for use in JQL queries"
976
+ }
977
+ ]
978
+ };
979
+ }
980
+ /**
981
+ * Generates documentation for the manage_jira_project tool
982
+ */
983
+ function generateProjectToolDocumentation(schema) {
984
+ return {
985
+ name: "Project Management",
986
+ description: schema.description,
987
+ operations: {
988
+ get: {
989
+ description: "Retrieves project details",
990
+ required_parameters: ["projectKey"],
991
+ optional_parameters: ["expand"],
992
+ expand_options: ["boards", "components", "versions", "recent_issues"],
993
+ examples: [
994
+ {
995
+ description: "Get basic project details",
996
+ code: {
997
+ operation: "get",
998
+ projectKey: "PROJ"
999
+ }
1000
+ },
1001
+ {
1002
+ description: "Get project with boards and components",
1003
+ code: {
1004
+ operation: "get",
1005
+ projectKey: "PROJ",
1006
+ expand: ["boards", "components"]
1007
+ }
1008
+ }
1009
+ ]
1010
+ },
1011
+ create: {
1012
+ description: "Creates a new project",
1013
+ required_parameters: ["key", "name"],
1014
+ optional_parameters: ["description", "lead"],
1015
+ examples: [
1016
+ {
1017
+ description: "Create a basic project",
1018
+ code: {
1019
+ operation: "create",
1020
+ key: "NEW",
1021
+ name: "New Project"
1022
+ }
1023
+ },
1024
+ {
1025
+ description: "Create a project with description and lead",
1026
+ code: {
1027
+ operation: "create",
1028
+ key: "FEAT",
1029
+ name: "Feature Development",
1030
+ description: "Project for new feature development",
1031
+ lead: "jsmith"
1032
+ }
1033
+ }
1034
+ ]
1035
+ },
1036
+ update: {
1037
+ description: "Updates a project",
1038
+ required_parameters: ["projectKey"],
1039
+ optional_parameters: ["name", "description", "lead"],
1040
+ examples: [
1041
+ {
1042
+ description: "Update project name",
1043
+ code: {
1044
+ operation: "update",
1045
+ projectKey: "PROJ",
1046
+ name: "Updated Project Name"
1047
+ }
1048
+ },
1049
+ {
1050
+ description: "Update project lead and description",
1051
+ code: {
1052
+ operation: "update",
1053
+ projectKey: "PROJ",
1054
+ description: "Updated project description",
1055
+ lead: "newlead"
1056
+ }
1057
+ }
1058
+ ]
1059
+ },
1060
+ delete: {
1061
+ description: "Deletes a project",
1062
+ required_parameters: ["projectKey"],
1063
+ examples: [
1064
+ {
1065
+ description: "Delete a project",
1066
+ code: {
1067
+ operation: "delete",
1068
+ projectKey: "PROJ"
1069
+ }
1070
+ }
1071
+ ]
1072
+ },
1073
+ list: {
1074
+ description: "Lists all projects",
1075
+ required_parameters: [],
1076
+ optional_parameters: ["maxResults", "startAt"],
1077
+ examples: [
1078
+ {
1079
+ description: "List all projects",
1080
+ code: {
1081
+ operation: "list"
1082
+ }
1083
+ },
1084
+ {
1085
+ description: "List projects with pagination",
1086
+ code: {
1087
+ operation: "list",
1088
+ startAt: 10,
1089
+ maxResults: 20
1090
+ }
1091
+ }
1092
+ ]
1093
+ }
1094
+ },
1095
+ common_use_cases: [
1096
+ {
1097
+ title: "Setting up a new project",
1098
+ description: "To create and configure a new project:",
1099
+ steps: [
1100
+ {
1101
+ description: "Create a new project",
1102
+ code: {
1103
+ operation: "create",
1104
+ key: "NEW",
1105
+ name: "New Project",
1106
+ description: "Project for new feature development",
1107
+ lead: "jsmith"
1108
+ }
1109
+ },
1110
+ {
1111
+ description: "Create a board for the project",
1112
+ tool: "manage_jira_board",
1113
+ code: {
1114
+ operation: "create",
1115
+ name: "NEW Board",
1116
+ type: "scrum",
1117
+ projectKey: "NEW"
1118
+ }
1119
+ }
1120
+ ]
1121
+ },
1122
+ {
1123
+ title: "Project reporting",
1124
+ description: "To get project statistics and reports:",
1125
+ steps: [
1126
+ {
1127
+ description: "Get project details with recent issues",
1128
+ code: {
1129
+ operation: "get",
1130
+ projectKey: "PROJ",
1131
+ expand: ["recent_issues"],
1132
+ include_status_counts: true
1133
+ }
1134
+ },
1135
+ {
1136
+ description: "Get all issues in a project",
1137
+ tool: "manage_jira_filter",
1138
+ code: {
1139
+ operation: "execute_jql",
1140
+ jql: "project = PROJ ORDER BY created DESC"
1141
+ }
1142
+ }
1143
+ ]
1144
+ }
1145
+ ],
1146
+ related_resources: [
1147
+ {
1148
+ name: "Project Overview",
1149
+ uri: "jira://projects/{projectKey}/overview",
1150
+ description: "Get detailed information about a project"
1151
+ }
1152
+ ]
1153
+ };
1154
+ }
1155
+ /**
1156
+ * Generates generic documentation for any tool
1157
+ */
1158
+ function generateGenericToolDocumentation(toolName, schema) {
1159
+ // Extract operations from the schema
1160
+ const operations = {};
1161
+ if (schema.inputSchema && schema.inputSchema.properties && schema.inputSchema.properties.operation) {
1162
+ const operationEnum = schema.inputSchema.properties.operation.enum || [];
1163
+ operationEnum.forEach((op) => {
1164
+ operations[op] = {
1165
+ description: `Performs the ${op} operation`,
1166
+ required_parameters: ["operation"],
1167
+ examples: [
1168
+ {
1169
+ description: `Example ${op} operation`,
1170
+ code: {
1171
+ operation: op
1172
+ }
1173
+ }
1174
+ ]
1175
+ };
1176
+ });
1177
+ }
1178
+ return {
1179
+ name: formatToolName(toolName),
1180
+ description: schema.description,
1181
+ operations,
1182
+ common_use_cases: [],
1183
+ related_resources: []
1184
+ };
1185
+ }