-
Notifications
You must be signed in to change notification settings - Fork 454
Expand file tree
/
Copy pathgithub-mcp-tools-report.lock.yml
More file actions
6122 lines (5963 loc) · 306 KB
/
Copy pathgithub-mcp-tools-report.lock.yml
File metadata and controls
6122 lines (5963 loc) · 306 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# ___ _ _
# / _ \ | | (_)
# | |_| | __ _ ___ _ __ | |_ _ ___
# | _ |/ _` |/ _ \ '_ \| __| |/ __|
# | | | | (_| | __/ | | | |_| | (__
# \_| |_/\__, |\___|_| |_|\__|_|\___|
# __/ |
# _ _ |___/ __ _
# | | | | / _| |
# | | | | ___ | |_| | _____ ____
# | |/\| |/ _ \| _| |/ _ \ \ /\ / / ___|
# \ /\ / (_) | | | | (_) \ V V /\__ \
# \/ \/ \___/|_| |_|\___/ \_/\_/ |___/
#
# This file was automatically generated by gh-aw. DO NOT EDIT.
# To update this file, edit the corresponding .md file and run:
# gh aw compile
# For more information: https://github.com/githubnext/gh-aw/blob/main/.github/instructions/github-agentic-workflows.instructions.md
#
# Generates a comprehensive report of available MCP server tools and their capabilities for GitHub integration
#
# Resolved workflow manifest:
# Imports:
# - shared/reporting.md
#
# Job Dependency Graph:
# ```mermaid
# graph LR
# activation["activation"]
# agent["agent"]
# conclusion["conclusion"]
# create_discussion["create_discussion"]
# create_pull_request["create_pull_request"]
# detection["detection"]
# activation --> agent
# agent --> conclusion
# activation --> conclusion
# create_discussion --> conclusion
# create_pull_request --> conclusion
# agent --> create_discussion
# detection --> create_discussion
# agent --> create_pull_request
# activation --> create_pull_request
# detection --> create_pull_request
# agent --> detection
# ```
#
# Original Prompt:
# ```markdown
# ## Report Formatting
#
# Structure your report with an overview followed by detailed content:
#
# 1. **Content Overview**: Start with 1-2 paragraphs that summarize the key findings, highlights, or main points of your report. This should give readers a quick understanding of what the report contains without needing to expand the details.
#
# 2. **Detailed Content**: Place the rest of your report inside HTML `<details>` and `<summary>` tags to allow readers to expand and view the full information. **IMPORTANT**: Always wrap the summary text in `<b>` tags to make it bold.
#
# **Example format:**
#
# `````markdown
# Brief overview paragraph 1 introducing the report and its main findings.
#
# Optional overview paragraph 2 with additional context or highlights.
#
# <details>
# <summary><b>Full Report Details</b></summary>
#
# ## Detailed Analysis
#
# Full report content with all sections, tables, and detailed information goes here.
#
# ### Section 1
# [Content]
#
# ### Section 2
# [Content]
#
# </details>
# `````
#
# ## Reporting Workflow Run Information
#
# When analyzing workflow run logs or reporting information from GitHub Actions runs:
#
# ### 1. Workflow Run ID Formatting
#
# **Always render workflow run IDs as clickable URLs** when mentioning them in your report. The workflow run data includes a `url` field that provides the full GitHub Actions run page URL.
#
# **Format:**
#
# `````markdown
# [§12345](https://github.com/owner/repo/actions/runs/12345)
# `````
#
# **Example:**
#
# `````markdown
# Analysis based on [§456789](https://github.com/githubnext/gh-aw/actions/runs/456789)
# `````
#
# ### 2. Document References for Workflow Runs
#
# When your analysis is based on information mined from one or more workflow runs, **include up to 3 workflow run URLs as document references** at the end of your report.
#
# **Format:**
#
# `````markdown
# ---
#
# **References:**
# - [§12345](https://github.com/owner/repo/actions/runs/12345)
# - [§12346](https://github.com/owner/repo/actions/runs/12346)
# - [§12347](https://github.com/owner/repo/actions/runs/12347)
# `````
#
# **Guidelines:**
#
# - Include **maximum 3 references** to keep reports concise
# - Choose the most relevant or representative runs (e.g., failed runs, high-cost runs, or runs with significant findings)
# - Always use the actual URL from the workflow run data (specifically, use the `url` field from `RunData` or the `RunURL` field from `ErrorSummary`)
# - If analyzing more than 3 runs, select the most important ones for references
#
# ## Footer Attribution
#
# **Do NOT add footer lines** like `> AI generated by...` to your comment. The system automatically appends attribution after your content to prevent duplicates.
#
# # GitHub MCP Remote Server Tools Report Generator
#
# You are the GitHub MCP Remote Server Tools Report Generator - an agent that documents the available functions in the GitHub MCP remote server.
#
# ## Mission
#
# Generate a comprehensive report of all tools/functions available in the GitHub MCP remote server by self-inspecting the available tools and creating detailed documentation.
#
# ## Current Context
#
# - **Repository**: ${{ github.repository }}
# - **Report Date**: Today's date
# - **MCP Server**: GitHub MCP Remote (mode: remote, toolsets: all)
#
# ## Report Generation Process
#
# ### Phase 1: Tool Discovery and Comparison
#
# 1. **Load Previous Tools List** (if available):
# - Check if `/tmp/gh-aw/cache-memory/github-mcp-tools.json` exists from the previous run
# - If it exists, read and parse the previous tools list
# - This will be used for comparison to detect changes
#
# 2. **Systematically Explore All Toolsets**:
# - You have access to the GitHub MCP server in remote mode with all toolsets enabled
# - **IMPORTANT**: Systematically explore EACH of the following toolsets individually:
# - `context` - GitHub Actions context and environment
# - `repos` - Repository operations
# - `issues` - Issue management
# - `pull_requests` - Pull request operations
# - `actions` - GitHub Actions workflows
# - `code_security` - Code scanning alerts
# - `dependabot` - Dependabot alerts
# - `discussions` - GitHub Discussions
# - `experiments` - Experimental features
# - `gists` - Gist operations
# - `labels` - Label management
# - `notifications` - Notification management
# - `orgs` - Organization operations
# - `projects` - GitHub Projects
# - `secret_protection` - Secret scanning
# - `security_advisories` - Security advisories
# - `stargazers` - Repository stars
# - `users` - User information
# - For EACH toolset, identify all tools that belong to it
# - Create a comprehensive mapping of tools to their respective toolsets
# - Note: The tools available to you ARE the tools from the GitHub MCP remote server
#
# 3. **Detect Inconsistencies Across Toolsets**:
# - Check for duplicate tools across different toolsets
# - Identify tools that might belong to multiple toolsets
# - Note any tools that don't clearly fit into any specific toolset
# - Flag any naming inconsistencies or patterns that deviate from expected conventions
# - Validate that all discovered tools are properly categorized
#
# 4. **Load Current JSON Mapping from Repository**:
# - Read the file `pkg/workflow/data/github_toolsets_permissions.json` from the repository
# - This file contains the current toolset->tools mapping used by the compiler
# - Parse the JSON to extract the expected tools for each toolset
# - This will be used to detect discrepancies between the compiler's understanding and the actual MCP server
#
# 5. **Compare MCP Server Tools with JSON Mapping**:
# - For EACH toolset, compare the tools you discovered from the MCP server with the tools listed in the JSON mapping
# - Identify **missing tools**: Tools in the JSON mapping but not found in the MCP server
# - Identify **extra tools**: Tools found in the MCP server but not in the JSON mapping
# - Identify **moved tools**: Tools that appear in different toolsets between JSON and MCP
# - This comparison is CRITICAL for maintaining accuracy
#
# 6. **Compare with Previous Tools** (if previous data exists):
# - Identify **new tools** that were added since the last run
# - Identify **removed tools** that existed before but are now missing
# - Identify tools that remain **unchanged**
# - Identify tools that **moved between toolsets**
# - Calculate statistics on the changes
#
# ### Phase 2: Update JSON Mapping (if needed)
#
# **CRITICAL**: If you discovered any discrepancies between the MCP server tools and the JSON mapping in Phase 1, you MUST update the JSON file.
#
# 1. **Determine if Update is Needed**:
# - If there are missing tools, extra tools, or moved tools identified in Phase 1 step 5
# - If the JSON mapping is accurate, skip to Phase 3
#
# 2. **Update the JSON File**:
# - Edit `pkg/workflow/data/github_toolsets_permissions.json`
# - For each toolset with discrepancies:
# - **Add missing tools**: Add tools found in MCP server but not in JSON
# - **Remove extra tools**: Remove tools in JSON but not found in MCP server
# - **Move tools**: Update tool placement to match MCP server organization
# - Preserve the JSON structure and formatting
# - Ensure all toolsets remain in alphabetical order
# - Ensure all tools within each toolset remain in alphabetical order
#
# 3. **Create Pull Request with Changes**:
# - **CRITICAL**: If you updated the JSON file, you MUST create a pull request with your changes:
# 1. Create a local branch with a descriptive name (e.g., `update-github-mcp-tools-mapping`)
# 2. Add and commit the updated `pkg/workflow/data/github_toolsets_permissions.json` file
# 3. **Use the create-pull-request tool from safe-outputs** to create the PR with:
# - A clear title describing the changes (e.g., "Update GitHub MCP toolsets mapping with latest tools")
# - A detailed body explaining what was added, removed, or moved between toolsets
# - The configured title prefix `[mcp-tools]`, labels, and reviewers will be applied automatically
# - **IMPORTANT**: After creating the PR, continue with the documentation update in Phase 3
#
# ### Phase 3: Tool Documentation
#
# For each discovered tool, document:
#
# 1. **Tool Name**: The exact function name
# 2. **Toolset**: Which toolset category it belongs to (context, repos, issues, pull_requests, actions, code_security, dependabot, discussions, experiments, gists, labels, notifications, orgs, projects, secret_protection, security_advisories, stargazers, users)
# 3. **Purpose**: What the tool does (1-2 sentence description)
# 4. **Parameters**: Key parameters it accepts (if you can determine them)
# 5. **Example Use Case**: A brief example of when you would use this tool
#
# ### Phase 4: Generate Comprehensive Report
#
# Create a detailed markdown report with the following structure:
#
# ```markdown
# # GitHub MCP Remote Server Tools Report
#
# **Generated**: [DATE]
# **MCP Mode**: Remote
# **Toolsets**: All
# **Previous Report**: [DATE or "None" if first run]
#
# ## Executive Summary
#
# - **Total Tools Discovered**: [NUMBER]
# - **Toolset Categories**: [NUMBER]
# - **Report Date**: [DATE]
# - **Changes Since Last Report**: [If previous data exists, show changes summary]
# - **New Tools**: [NUMBER]
# - **Removed Tools**: [NUMBER]
# - **Unchanged Tools**: [NUMBER]
#
# ## Inconsistency Detection
#
# ### Toolset Integrity Checks
#
# Report any inconsistencies discovered during the systematic exploration:
#
# - **Duplicate Tools**: List any tools that appear in multiple toolsets
# - **Miscategorized Tools**: Tools that might belong to a different toolset based on their functionality
# - **Naming Inconsistencies**: Tools that don't follow expected naming patterns
# - **Orphaned Tools**: Tools that don't clearly fit into any specific toolset
# - **Missing Expected Tools**: Common operations that might be missing from certain toolsets
#
# [If no inconsistencies found: "✅ All tools are properly categorized with no detected inconsistencies."]
#
# ## JSON Mapping Comparison
#
# ### Discrepancies Between MCP Server and JSON Mapping
#
# Report on the comparison between the MCP server tools and the `pkg/workflow/data/github_toolsets_permissions.json` file:
#
# **Summary**:
# - **Total Discrepancies**: [NUMBER]
# - **Missing Tools** (in JSON but not in MCP): [NUMBER]
# - **Extra Tools** (in MCP but not in JSON): [NUMBER]
# - **Moved Tools** (different toolset): [NUMBER]
#
# [If discrepancies found, create detailed tables below. If no discrepancies, show: "✅ JSON mapping is accurate and matches the MCP server."]
#
# ### Missing Tools (in JSON but not in MCP)
#
# | Toolset | Tool Name | Status |
# |---------|-----------|--------|
# | [toolset] | [tool] | Not found in MCP server |
#
# ### Extra Tools (in MCP but not in JSON)
#
# | Toolset | Tool Name | Action Taken |
# |---------|-----------|--------------|
# | [toolset] | [tool] | Added to JSON mapping |
#
# ### Moved Tools
#
# | Tool Name | JSON Toolset | MCP Toolset | Action Taken |
# |-----------|--------------|-------------|--------------|
# | [tool] | [old] | [new] | Updated in JSON mapping |
#
# **Action**: [If discrepancies were found and fixed, state: "Created pull request with updated JSON mapping." Otherwise: "No updates needed."]
#
# ## Changes Since Last Report
#
# [Only include this section if previous data exists]
#
# ### New Tools Added ✨
#
# List any tools that were added since the last report, organized by toolsets:
#
# | Toolset | Tool Name | Purpose |
# |---------|-----------|---------|
# | [toolset] | [tool] | [description] |
#
# ### Removed Tools 🗑️
#
# List any tools that were removed since the last report:
#
# | Toolset | Tool Name | Purpose (from previous report) |
# |---------|-----------|--------------------------------|
# | [toolset] | [tool] | [description] |
#
# ### Tools Moved Between Toolsets 🔄
#
# List any tools that changed their toolset categorization:
#
# | Tool Name | Previous Toolset | Current Toolset | Notes |
# |-----------|------------------|-----------------|-------|
# | [tool] | [old toolset] | [new toolset] | [reason] |
#
# [If no changes: "No tools were added, removed, or moved since the last report."]
#
# ## Tools by Toolset
#
# Organize tools into their respective toolset categories. For each toolset that has tools, create a section with a table listing all tools.
#
# **Example format for each toolsets:**
#
# ### [Toolset Name] Toolset
# Brief description of the toolset.
#
# | Tool Name | Purpose | Key Parameters |
# |-----------|---------|----------------|
# | [tool] | [description] | [params] |
#
# **All available toolsets**: context, repos, issues, pull_requests, actions, code_security, dependabot, discussions, experiments, gists, labels, notifications, orgs, projects, secret_protection, security_advisories, stargazers, users
#
# ## Recommended Default Toolsets
#
# Based on the analysis of available tools and their usage patterns, the following toolsets are recommended as defaults when no toolset is specified:
#
# **Recommended Defaults**: [List recommended toolsets here, e.g., `context`, `repos`, `issues`, `pull_requests`, `users`]
#
# **Rationale**:
# - [Explain why each toolset should be included in defaults]
# - [Consider frequency of use, fundamental functionality, minimal security exposure]
# - [Note any changes from current defaults and why]
#
# **Specialized Toolsets** (enable explicitly when needed):
# - List toolsets that should not be in defaults and when to use them
#
# ## Toolset Configuration Reference
#
# When configuring the GitHub MCP server in agentic workflows, you can enable specific toolsets:
#
# ```yaml
# tools:
# github:
# mode: "remote" # or "local"
# toolsets: [all] # or specific toolsets like [repos, issues, pull_requests]
# ```
#
# **Available toolset options**:
# - `context` - GitHub Actions context and environment
# - `repos` - Repository operations
# - `issues` - Issue management
# - `pull_requests` - Pull request operations
# - `actions` - GitHub Actions workflows
# - `code_security` - Code scanning alerts
# - `dependabot` - Dependabot alerts
# - `discussions` - GitHub Discussions
# - `experiments` - Experimental features
# - `gists` - Gist operations
# - `labels` - Label management
# - `notifications` - Notification management
# - `orgs` - Organization operations
# - `projects` - GitHub Projects
# - `secret_protection` - Secret scanning
# - `security_advisories` - Security advisories
# - `stargazers` - Repository stars
# - `users` - User information
# - `all` - Enable all toolsets
#
# ## Notes and Observations
#
# [Include any interesting findings, patterns, or recommendations discovered during the tool enumeration]
#
# ## Methodology
#
# - **Discovery Method**: Self-inspection of available tools in the GitHub MCP remote server
# - **MCP Configuration**: Remote mode with all toolsets enabled
# - **Categorization**: Based on GitHub API domains and functionality
# - **Documentation**: Derived from tool names, descriptions, and usage patterns
# ```
#
# ## Important Guidelines
#
# ### Accuracy
# - **Be Thorough**: Discover and document ALL available tools
# - **Be Precise**: Use exact tool names and accurate descriptions
# - **Be Organized**: Group tools logically by toolset
# - **Be Helpful**: Provide clear, actionable documentation
#
# ### Report Quality
# - **Clear Structure**: Use tables and sections for readability
# - **Complete Coverage**: Don't miss any tools or toolsets
# - **Useful Reference**: Make the report helpful for developers
#
# ### Tool Discovery
# - **Systematic Approach**: Methodically enumerate tools for EACH toolset individually
# - **Complete Coverage**: Explore all 18 toolsets without skipping any
# - **Categorization**: Accurately assign tools to toolsets based on functionality
# - **Description**: Provide clear, concise purpose statements
# - **Parameters**: Document key parameters when identifiable
# - **Inconsistency Detection**: Actively look for duplicates, miscategorization, and naming issues
#
# ## Success Criteria
#
# A successful report:
# - ✅ Loads previous tools list from cache if available
# - ✅ Loads current JSON mapping from `pkg/workflow/data/github_toolsets_permissions.json`
# - ✅ Systematically explores EACH of the 19 individual toolsets (including `search`)
# - ✅ Documents all tools available in the GitHub MCP remote server
# - ✅ Detects and reports any inconsistencies across toolsets (duplicates, miscategorization, naming issues)
# - ✅ **Compares MCP server tools with JSON mapping** and identifies discrepancies
# - ✅ **Updates JSON mapping file** if discrepancies are found
# - ✅ **Creates pull request** with updated JSON mapping if changes were made
# - ✅ Compares with previous run and identifies changes (new/removed/moved tools)
# - ✅ Saves current tools list to cache for next run
# - ✅ **Creates/updates `.github/instructions/github-mcp-server.instructions.md`** with comprehensive documentation
# - ✅ **Identifies and documents recommended default toolsets** with rationale
# - ✅ **Updates default toolsets** in documentation files (github-agentic-workflows.instructions.md)
# - ✅ Organizes tools by their appropriate toolset categories
# - ✅ Provides clear descriptions and usage information
# - ✅ Is formatted as a well-structured markdown document
# - ✅ Is published as a GitHub discussion in the "audits" category for easy access and reference
# - ✅ Includes change tracking and diff information when previous data exists
# - ✅ Validates toolset integrity and reports any detected issues
#
# ## Output Requirements
#
# Your output MUST:
# 1. Load the previous tools list from `/tmp/gh-aw/cache-memory/github-mcp-tools.json` if it exists
# 2. **Load the current JSON mapping from `pkg/workflow/data/github_toolsets_permissions.json`**
# 3. Systematically explore EACH of the 19 toolsets individually to discover all current tools (including `search`)
# 4. Detect and document any inconsistencies:
# - Duplicate tools across toolsets
# - Miscategorized tools
# - Naming inconsistencies
# - Orphaned tools
# 5. **Compare MCP server tools with JSON mapping** and identify:
# - Missing tools (in JSON but not in MCP)
# - Extra tools (in MCP but not in JSON)
# - Moved tools (different toolset placement)
# 6. **Update the JSON mapping file** if discrepancies are found:
# - Edit `pkg/workflow/data/github_toolsets_permissions.json`
# - Add missing tools, remove extra entries, fix moved tools
# - Preserve JSON structure and alphabetical ordering
# - **Create a pull request using the create-pull-request tool from safe-outputs** with your changes (branch, commit, then call the tool)
# 7. Compare current tools with previous tools (if available) and identify:
# - New tools added
# - Removed tools
# - Tools that moved between toolsets
# 8. Save the current tools list to `/tmp/gh-aw/cache-memory/github-mcp-tools.json` for the next run
# - Use a structured JSON format with tool names, toolsets, and descriptions
# - Include timestamp and metadata
# 9. **Update `.github/instructions/github-mcp-server.instructions.md`** with comprehensive documentation:
# - Document all available tools organized by toolset
# - Include tool descriptions, parameters, and usage examples
# - Provide configuration reference for remote vs local mode
# - Include header authentication details (Bearer token)
# - Document X-MCP-Readonly header for read-only mode
# - **Include recommended default toolsets** based on analysis:
# - Identify the most commonly needed toolsets for typical workflows
# - Consider toolsets that provide core functionality (context, repos, issues, pull_requests, users)
# - Document the rationale for these defaults
# - Note which toolsets are specialized and should be enabled explicitly
# - Include best practices for toolset selection
# - Format the documentation according to the repository's documentation standards
# 10. **Update default toolsets documentation** in:
# - `.github/instructions/github-agentic-workflows.instructions.md` (line 126)
# - Use the recommended default toolsets identified in step 9
# - Ensure consistency across all documentation files
# 11. Create a GitHub discussion with the complete tools report
# 12. Use the report template structure provided above
# 13. Include the JSON mapping comparison section with detailed findings
# 14. Include the inconsistency detection section with findings
# 15. Include the changes summary section if previous data exists
# 16. Include ALL discovered tools organized by toolset
# 17. Provide accurate tool names, descriptions, and parameters
# 18. Be formatted for readability with proper markdown tables
#
# **Cache File Format** (`/tmp/gh-aw/cache-memory/github-mcp-tools.json`):
# ```json
# {
# "timestamp": "2024-01-15T06:00:00Z",
# "total_tools": 42,
# "toolsets": {
# "repos": [
# {"name": "get_repository", "purpose": "Get repository details"},
# {"name": "list_commits", "purpose": "List repository commits"}
# ],
# "issues": [
# {"name": "issue_read", "purpose": "Read issue details and comments"},
# {"name": "list_issues", "purpose": "List repository issues"}
# ]
# }
# }
# ```
#
# Begin your tool discovery now. Follow these steps:
#
# 1. **Load previous data**: Check for `/tmp/gh-aw/cache-memory/github-mcp-tools.json` and load it if it exists
# 2. **Load JSON mapping**: Read `pkg/workflow/data/github_toolsets_permissions.json` to get the current expected tool mappings
# 3. **Systematically explore each toolset**: For EACH of the 19 toolsets, identify all tools that belong to it:
# - context
# - repos
# - issues
# - pull_requests
# - actions
# - code_security
# - dependabot
# - discussions
# - experiments
# - gists
# - labels
# - notifications
# - orgs
# - projects
# - secret_protection
# - security_advisories
# - stargazers
# - users
# - search
# 4. **Compare with JSON mapping**: For each toolset, compare MCP server tools with JSON mapping to identify discrepancies
# 5. **Update JSON mapping if needed**: If discrepancies are found:
# - Edit `pkg/workflow/data/github_toolsets_permissions.json` to fix them
# - Create a branch and commit your changes
# - **Use the create-pull-request tool from safe-outputs** to create a PR with your updates
# 6. **Detect inconsistencies**: Check for duplicates, miscategorization, naming issues, and orphaned tools
# 7. **Compare and analyze**: If previous data exists, compare current tools with previous tools to identify changes (new/removed/moved)
# 8. **Analyze and recommend default toolsets**:
# - Analyze which toolsets provide the most fundamental functionality
# - Consider which tools are most commonly needed across different workflow types
# - Evaluate the current defaults: `context`, `repos`, `issues`, `pull_requests`, `users`
# - Determine if these defaults should be updated based on actual tool availability and usage patterns
# - Document your rationale for the recommended defaults
# 9. **Create comprehensive documentation file**: Create/update `.github/instructions/github-mcp-server.instructions.md` with:
# - Overview of GitHub MCP server (remote vs local mode)
# - Complete list of available tools organized by toolset
# - Tool descriptions, parameters, and return values
# - Configuration examples for both modes
# - Authentication details (Bearer token, X-MCP-Readonly header)
# - **Recommended default toolsets section** with:
# - List of recommended defaults
# - Rationale for each toolset included in defaults
# - Explanation of when to enable other toolsets
# - Best practices for toolset selection
# 7. **Update documentation references**: Update the default toolsets list in:
# - `.github/instructions/github-agentic-workflows.instructions.md` (search for "Default toolsets (if not specified)")
# 8. **Document**: Categorize tools appropriately and create comprehensive documentation
# 9. **Save for next run**: Save the current tools list to `/tmp/gh-aw/cache-memory/github-mcp-tools.json`
# 10. **Generate report**: Create the final markdown report including change tracking and inconsistency detection
# 11. **Publish**: Create a GitHub discussion with the complete tools report
# ```
#
# Pinned GitHub Actions:
# - actions/cache@v4 (0057852bfaa89a56745cba8c7296529d2fc39830)
# https://github.com/actions/cache/commit/0057852bfaa89a56745cba8c7296529d2fc39830
# - actions/checkout@v5 (93cb6efe18208431cddfb8368fd83d5badbf9bfd)
# https://github.com/actions/checkout/commit/93cb6efe18208431cddfb8368fd83d5badbf9bfd
# - actions/download-artifact@v6 (018cc2cf5baa6db3ef3c5f8a56943fffe632ef53)
# https://github.com/actions/download-artifact/commit/018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
# - actions/github-script@v8 (ed597411d8f924073f98dfc5c65a23a2325f34cd)
# https://github.com/actions/github-script/commit/ed597411d8f924073f98dfc5c65a23a2325f34cd
# - actions/setup-node@v6 (2028fbc5c25fe9cf00d9f06a71cc4710d4507903)
# https://github.com/actions/setup-node/commit/2028fbc5c25fe9cf00d9f06a71cc4710d4507903
# - actions/upload-artifact@v5 (330a01c490aca151604b8cf639adc76d48f6c5d4)
# https://github.com/actions/upload-artifact/commit/330a01c490aca151604b8cf639adc76d48f6c5d4
name: "GitHub MCP Remote Server Tools Report Generator"
"on":
schedule:
- cron: "0 12 * * 0"
workflow_dispatch: null
permissions:
actions: read
contents: read
discussions: read
issues: read
pull-requests: read
repository-projects: read
security-events: read
concurrency:
group: "gh-aw-${{ github.workflow }}"
run-name: "GitHub MCP Remote Server Tools Report Generator"
jobs:
activation:
runs-on: ubuntu-slim
permissions:
contents: read
outputs:
comment_id: ""
comment_repo: ""
steps:
- name: Check workflow file timestamps
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
env:
GH_AW_WORKFLOW_FILE: "github-mcp-tools-report.lock.yml"
with:
script: |
async function main() {
const workflowFile = process.env.GH_AW_WORKFLOW_FILE;
if (!workflowFile) {
core.setFailed("Configuration error: GH_AW_WORKFLOW_FILE not available.");
return;
}
const workflowBasename = workflowFile.replace(".lock.yml", "");
const workflowMdPath = `.github/workflows/${workflowBasename}.md`;
const lockFilePath = `.github/workflows/${workflowFile}`;
core.info(`Checking workflow timestamps using GitHub API:`);
core.info(` Source: ${workflowMdPath}`);
core.info(` Lock file: ${lockFilePath}`);
const { owner, repo } = context.repo;
const ref = context.sha;
async function getLastCommitForFile(path) {
try {
const response = await github.rest.repos.listCommits({
owner,
repo,
path,
per_page: 1,
sha: ref,
});
if (response.data && response.data.length > 0) {
const commit = response.data[0];
return {
sha: commit.sha,
date: commit.commit.committer.date,
message: commit.commit.message,
};
}
return null;
} catch (error) {
core.info(`Could not fetch commit for ${path}: ${error.message}`);
return null;
}
}
const workflowCommit = await getLastCommitForFile(workflowMdPath);
const lockCommit = await getLastCommitForFile(lockFilePath);
if (!workflowCommit) {
core.info(`Source file does not exist: ${workflowMdPath}`);
}
if (!lockCommit) {
core.info(`Lock file does not exist: ${lockFilePath}`);
}
if (!workflowCommit || !lockCommit) {
core.info("Skipping timestamp check - one or both files not found");
return;
}
const workflowDate = new Date(workflowCommit.date);
const lockDate = new Date(lockCommit.date);
core.info(` Source last commit: ${workflowDate.toISOString()} (${workflowCommit.sha.substring(0, 7)})`);
core.info(` Lock last commit: ${lockDate.toISOString()} (${lockCommit.sha.substring(0, 7)})`);
if (workflowDate > lockDate) {
const warningMessage = `WARNING: Lock file '${lockFilePath}' is outdated! The workflow file '${workflowMdPath}' has been modified more recently. Run 'gh aw compile' to regenerate the lock file.`;
core.error(warningMessage);
const workflowTimestamp = workflowDate.toISOString();
const lockTimestamp = lockDate.toISOString();
let summary = core.summary
.addRaw("### ⚠️ Workflow Lock File Warning\n\n")
.addRaw("**WARNING**: Lock file is outdated and needs to be regenerated.\n\n")
.addRaw("**Files:**\n")
.addRaw(`- Source: \`${workflowMdPath}\`\n`)
.addRaw(` - Last commit: ${workflowTimestamp}\n`)
.addRaw(
` - Commit SHA: [\`${workflowCommit.sha.substring(0, 7)}\`](https://github.com/${owner}/${repo}/commit/${workflowCommit.sha})\n`
)
.addRaw(`- Lock: \`${lockFilePath}\`\n`)
.addRaw(` - Last commit: ${lockTimestamp}\n`)
.addRaw(` - Commit SHA: [\`${lockCommit.sha.substring(0, 7)}\`](https://github.com/${owner}/${repo}/commit/${lockCommit.sha})\n\n`)
.addRaw("**Action Required:** Run `gh aw compile` to regenerate the lock file.\n\n");
await summary.write();
} else if (workflowCommit.sha === lockCommit.sha) {
core.info("✅ Lock file is up to date (same commit)");
} else {
core.info("✅ Lock file is up to date");
}
}
main().catch(error => {
core.setFailed(error instanceof Error ? error.message : String(error));
});
agent:
needs: activation
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
discussions: read
issues: read
pull-requests: read
repository-projects: read
security-events: read
concurrency:
group: "gh-aw-claude-${{ github.workflow }}"
env:
GH_AW_SAFE_OUTPUTS: /tmp/gh-aw/safeoutputs/outputs.jsonl
outputs:
has_patch: ${{ steps.collect_output.outputs.has_patch }}
output: ${{ steps.collect_output.outputs.output }}
output_types: ${{ steps.collect_output.outputs.output_types }}
steps:
- name: Checkout repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
persist-credentials: false
- name: Create gh-aw temp directory
run: |
mkdir -p /tmp/gh-aw/agent
echo "Created /tmp/gh-aw/agent directory for agentic workflow temporary files"
# Cache memory file share configuration from frontmatter processed below
- name: Create cache-memory directory
run: |
mkdir -p /tmp/gh-aw/cache-memory
echo "Cache memory directory created at /tmp/gh-aw/cache-memory"
echo "This folder provides persistent file storage across workflow runs"
echo "LLMs and agentic tools can freely read and write files in this directory"
- name: Cache memory file share data
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
key: memory-${{ github.workflow }}-${{ github.run_id }}
path: /tmp/gh-aw/cache-memory
restore-keys: |
memory-${{ github.workflow }}-
memory-
- name: Upload cache-memory data as artifact
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
with:
name: cache-memory
path: /tmp/gh-aw/cache-memory
- name: Configure Git credentials
env:
REPO_NAME: ${{ github.repository }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# Re-authenticate git with GitHub token
SERVER_URL="${{ github.server_url }}"
SERVER_URL="${SERVER_URL#https://}"
git remote set-url origin "https://x-access-token:${{ github.token }}@${SERVER_URL}/${REPO_NAME}.git"
echo "Git configured with standard GitHub Actions identity"
- name: Checkout PR branch
if: |
github.event.pull_request
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
with:
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
script: |
async function main() {
const eventName = context.eventName;
const pullRequest = context.payload.pull_request;
if (!pullRequest) {
core.info("No pull request context available, skipping checkout");
return;
}
core.info(`Event: ${eventName}`);
core.info(`Pull Request #${pullRequest.number}`);
try {
if (eventName === "pull_request") {
const branchName = pullRequest.head.ref;
core.info(`Checking out PR branch: ${branchName}`);
await exec.exec("git", ["fetch", "origin", branchName]);
await exec.exec("git", ["checkout", branchName]);
core.info(`✅ Successfully checked out branch: ${branchName}`);
} else {
const prNumber = pullRequest.number;
core.info(`Checking out PR #${prNumber} using gh pr checkout`);
await exec.exec("gh", ["pr", "checkout", prNumber.toString()]);
core.info(`✅ Successfully checked out PR #${prNumber}`);
}
} catch (error) {
core.setFailed(`Failed to checkout PR branch: ${error instanceof Error ? error.message : String(error)}`);
}
}
main().catch(error => {
core.setFailed(error instanceof Error ? error.message : String(error));
});
- name: Validate CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY secret
run: |
if [ -z "$CLAUDE_CODE_OAUTH_TOKEN" ] && [ -z "$ANTHROPIC_API_KEY" ]; then
echo "Error: Neither CLAUDE_CODE_OAUTH_TOKEN nor ANTHROPIC_API_KEY secret is set"
echo "The Claude Code engine requires either CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY secret to be configured."
echo "Please configure one of these secrets in your repository settings."
echo "Documentation: https://githubnext.github.io/gh-aw/reference/engines/#anthropic-claude-code"
exit 1
fi
if [ -n "$CLAUDE_CODE_OAUTH_TOKEN" ]; then
echo "CLAUDE_CODE_OAUTH_TOKEN secret is configured"
else
echo "ANTHROPIC_API_KEY secret is configured (using as fallback for CLAUDE_CODE_OAUTH_TOKEN)"
fi
env:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version: '24'
- name: Install Claude Code CLI
run: npm install -g @anthropic-ai/claude-code@2.0.54
- name: Generate Claude Settings
run: |
mkdir -p /tmp/gh-aw/.claude
cat > /tmp/gh-aw/.claude/settings.json << 'EOF'
{
"hooks": {
"PreToolUse": [
{
"matcher": "WebFetch|WebSearch",
"hooks": [
{
"type": "command",
"command": ".claude/hooks/network_permissions.py"
}
]
}
]
}
}
EOF
- name: Generate Network Permissions Hook
run: |
mkdir -p .claude/hooks
cat > .claude/hooks/network_permissions.py << 'EOF'
#!/usr/bin/env python3
"""
Network permissions validator for Claude Code engine.
Generated by gh-aw from workflow-level network configuration.
"""
import json
import sys
import urllib.parse
import re
# Domain allow-list (populated during generation)
# JSON string is safely parsed using json.loads() to eliminate quoting vulnerabilities
ALLOWED_DOMAINS = json.loads('''["crl3.digicert.com","crl4.digicert.com","ocsp.digicert.com","ts-crl.ws.symantec.com","ts-ocsp.ws.symantec.com","crl.geotrust.com","ocsp.geotrust.com","crl.thawte.com","ocsp.thawte.com","crl.verisign.com","ocsp.verisign.com","crl.globalsign.com","ocsp.globalsign.com","crls.ssl.com","ocsp.ssl.com","crl.identrust.com","ocsp.identrust.com","crl.sectigo.com","ocsp.sectigo.com","crl.usertrust.com","ocsp.usertrust.com","s.symcb.com","s.symcd.com","json-schema.org","json.schemastore.org","archive.ubuntu.com","security.ubuntu.com","ppa.launchpad.net","keyserver.ubuntu.com","azure.archive.ubuntu.com","api.snapcraft.io","packagecloud.io","packages.cloud.google.com","packages.microsoft.com"]''')
def extract_domain(url_or_query):
"""Extract domain from URL or search query."""
if not url_or_query:
return None
if url_or_query.startswith(('http://', 'https://')):
return urllib.parse.urlparse(url_or_query).netloc.lower()
# Check for domain patterns in search queries
match = re.search(r'site:([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})', url_or_query)
if match:
return match.group(1).lower()
return None
def is_domain_allowed(domain):
"""Check if domain is allowed."""
if not domain:
# If no domain detected, allow only if not under deny-all policy
return bool(ALLOWED_DOMAINS) # False if empty list (deny-all), True if has domains
# Empty allowed domains means deny all
if not ALLOWED_DOMAINS:
return False
for pattern in ALLOWED_DOMAINS:
regex = pattern.replace('.', r'\.').replace('*', '.*')
if re.match(f'^{regex}$', domain):
return True
return False
# Main logic
try:
data = json.load(sys.stdin)
tool_name = data.get('tool_name', '')
tool_input = data.get('tool_input', {})
if tool_name not in ['WebFetch', 'WebSearch']:
sys.exit(0) # Allow other tools
target = tool_input.get('url') or tool_input.get('query', '')
domain = extract_domain(target)
# For WebSearch, apply domain restrictions consistently
# If no domain detected in search query, check if restrictions are in place
if tool_name == 'WebSearch' and not domain:
# Since this hook is only generated when network permissions are configured,
# empty ALLOWED_DOMAINS means deny-all policy
if not ALLOWED_DOMAINS: # Empty list means deny all
print(f"Network access blocked: deny-all policy in effect", file=sys.stderr)
print(f"No domains are allowed for WebSearch", file=sys.stderr)
sys.exit(2) # Block under deny-all policy
else:
print(f"Network access blocked for web-search: no specific domain detected", file=sys.stderr)
print(f"Allowed domains: {', '.join(ALLOWED_DOMAINS)}", file=sys.stderr)
sys.exit(2) # Block general searches when domain allowlist is configured
if not is_domain_allowed(domain):
print(f"Network access blocked for domain: {domain}", file=sys.stderr)
print(f"Allowed domains: {', '.join(ALLOWED_DOMAINS)}", file=sys.stderr)
sys.exit(2) # Block with feedback to Claude
sys.exit(0) # Allow
except Exception as e:
print(f"Network validation error: {e}", file=sys.stderr)
sys.exit(2) # Block on errors
EOF
chmod +x .claude/hooks/network_permissions.py
- name: Setup Safe Outputs Collector MCP
run: |
mkdir -p /tmp/gh-aw/safeoutputs
cat > /tmp/gh-aw/safeoutputs/config.json << 'EOF'
{"create_discussion":{"max":1},"create_pull_request":{},"missing_tool":{"max":0},"noop":{"max":1}}
EOF
cat > /tmp/gh-aw/safeoutputs/tools.json << 'EOF'
[{"description":"Create a GitHub discussion for announcements, Q\u0026A, reports, status updates, or community conversations. Use this for content that benefits from threaded replies, doesn't require task tracking, or serves as documentation. For actionable work items that need assignment and status tracking, use create_issue instead.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Discussion content in Markdown. Do NOT repeat the title as a heading since it already appears as the discussion's h1. Include all relevant context, findings, or questions.","type":"string"},"category":{"description":"Discussion category by name (e.g., 'General'), slug (e.g., 'general'), or ID. If omitted, uses the first available category. Category must exist in the repository.","type":"string"},"title":{"description":"Concise discussion title summarizing the topic. The title appears as the main heading, so keep it brief and descriptive.","type":"string"}},"required":["title","body"],"type":"object"},"name":"create_discussion"},{"description":"Create a new GitHub pull request to propose code changes. Use this after making file edits to submit them for review and merging. The PR will be created from the current branch with your committed changes. For code review comments on an existing PR, use create_pull_request_review_comment instead.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Detailed PR description in Markdown. Include what changes were made, why, testing notes, and any breaking changes. Do NOT repeat the title as a heading.","type":"string"},"branch":{"description":"Source branch name containing the changes. If omitted, uses the current working branch.","type":"string"},"labels":{"description":"Labels to categorize the PR (e.g., 'enhancement', 'bugfix'). Labels must exist in the repository.","items":{"type":"string"},"type":"array"},"title":{"description":"Concise PR title describing the changes. Follow repository conventions (e.g., conventional commits). The title appears as the main heading.","type":"string"}},"required":["title","body"],"type":"object"},"name":"create_pull_request"},{"description":"Report that a tool or capability needed to complete the task is not available. Use this when you cannot accomplish what was requested because the required functionality is missing or access is restricted.","inputSchema":{"additionalProperties":false,"properties":{"alternatives":{"description":"Any workarounds, manual steps, or alternative approaches the user could take (max 256 characters).","type":"string"},"reason":{"description":"Explanation of why this tool is needed to complete the task (max 256 characters).","type":"string"},"tool":{"description":"Name or description of the missing tool or capability (max 128 characters). Be specific about what functionality is needed.","type":"string"}},"required":["tool","reason"],"type":"object"},"name":"missing_tool"},{"description":"Log a transparency message when no significant actions are needed. Use this to confirm workflow completion and provide visibility when analysis is complete but no changes or outputs are required (e.g., 'No issues found', 'All checks passed'). This ensures the workflow produces human-visible output even when no other actions are taken.","inputSchema":{"additionalProperties":false,"properties":{"message":{"description":"Status or completion message to log. Should explain what was analyzed and the outcome (e.g., 'Code review complete - no issues found', 'Analysis complete - all tests passing').","type":"string"}},"required":["message"],"type":"object"},"name":"noop"}]
EOF
cat > /tmp/gh-aw/safeoutputs/mcp-server.cjs << 'EOF'
const fs = require("fs");
const path = require("path");
const crypto = require("crypto");
const { execSync } = require("child_process");
function normalizeBranchName(branchName) {
if (!branchName || typeof branchName !== "string" || branchName.trim() === "") {
return branchName;
}
let normalized = branchName.replace(/[^a-zA-Z0-9\-_/.]+/g, "-");
normalized = normalized.replace(/-+/g, "-");
normalized = normalized.replace(/^-+|-+$/g, "");
if (normalized.length > 128) {
normalized = normalized.substring(0, 128);
}
normalized = normalized.replace(/-+$/, "");
normalized = normalized.toLowerCase();
return normalized;
}
function estimateTokens(text) {
if (!text) return 0;
return Math.ceil(text.length / 4);
}
function generateCompactSchema(content) {
try {
const parsed = JSON.parse(content);
if (Array.isArray(parsed)) {
if (parsed.length === 0) {
return "[]";
}
const firstItem = parsed[0];
if (typeof firstItem === "object" && firstItem !== null) {
const keys = Object.keys(firstItem);
return `[{${keys.join(", ")}}] (${parsed.length} items)`;
}
return `[${typeof firstItem}] (${parsed.length} items)`;
} else if (typeof parsed === "object" && parsed !== null) {
const keys = Object.keys(parsed);
if (keys.length > 10) {
return `{${keys.slice(0, 10).join(", ")}, ...} (${keys.length} keys)`;
}
return `{${keys.join(", ")}}`;
}
return `${typeof parsed}`;
} catch {
return "text content";
}