Skip to content

Commit 1690c70

Browse files
committed
Remove unused toolset instructions and simplify test cases for clarity
1 parent 0cd74fc commit 1690c70

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

pkg/github/instructions.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ func GenerateInstructions(enabledToolsets []string) string {
1818
}
1919
}
2020

21-
// Cross-toolset conditional instructions
22-
if contains(enabledToolsets, "issues") && contains(enabledToolsets, "pull_requests") {
23-
instructions = append(instructions, "Link issues to PRs using 'closes #123' or 'fixes #123' in PR descriptions.")
24-
}
25-
2621
// Base instruction with context management
2722
baseInstruction := "The GitHub MCP Server provides GitHub API tools. GitHub API responses can overflow context windows. Strategy: 1) Always prefer 'search_*' tools over 'list_*' tools when possible - search tools return filtered results, 2) Process large datasets in batches rather than all at once, 3) For summarization tasks, fetch minimal data first, then drill down into specifics, 4) When analyzing multiple items (issues, PRs, etc), process in groups of 5-10 to manage context."
2823

@@ -37,24 +32,17 @@ func getToolsetInstructions(toolset string) string {
3732
switch toolset {
3833
case "pull_requests":
3934
return "PR review workflow: Use 'create_pending_pull_request_review' → 'add_comment_to_pending_review' → 'submit_pending_pull_request_review' for complex reviews with line-specific comments."
40-
case "actions":
41-
return "CI/CD debugging: Use 'get_job_logs' with 'failed_only=true' and 'return_content=true' for immediate log analysis. Use 'rerun_failed_jobs' instead of 'rerun_workflow_run' to save resources."
4235
case "issues":
4336
return "Issue workflow: Check 'list_issue_types' first for organizations to use proper issue types. Use 'search_issues' before creating new issues to avoid duplicates. Always set 'state_reason' when closing issues."
44-
case "repos":
45-
return "File operations: Use 'get_file_contents' to check if file exists before 'create_or_update_file'. Always specify 'sha' parameter when updating existing files. Use 'push_files' for multiple file operations in single commit."
4637
case "notifications":
4738
return "Notifications: Filter by 'participating' for issues/PRs you're involved in. Use 'mark_all_notifications_read' with repository filters to avoid marking unrelated notifications."
48-
case "gists":
49-
return "Gists: Use 'list_gists' with 'since' parameter to find recent gists. Specify 'public=false' for private gists in 'create_gist'."
5039
case "discussions":
5140
return "Discussions: Use 'list_discussion_categories' to understand available categories before creating discussions. Filter by category for better organization."
5241
default:
5342
return ""
5443
}
5544
}
5645

57-
5846
// contains checks if a slice contains a specific string
5947
func contains(slice []string, item string) bool {
6048
for _, s := range slice {
@@ -63,4 +51,4 @@ func contains(slice []string, item string) bool {
6351
}
6452
}
6553
return false
66-
}
54+
}

pkg/github/instructions_test.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ func TestGenerateInstructions(t *testing.T) {
3838
"submit_pending_pull_request_review",
3939
},
4040
},
41-
{
42-
name: "actions toolset",
43-
enabledToolsets: []string{"actions"},
44-
expectedContains: []string{
45-
"get_job_logs",
46-
"failed_only=true",
47-
"rerun_failed_jobs",
48-
},
49-
},
5041
{
5142
name: "cross-toolset instructions",
5243
enabledToolsets: []string{"context", "pull_requests"},
@@ -59,10 +50,9 @@ func TestGenerateInstructions(t *testing.T) {
5950
name: "issues and pull_requests combination",
6051
enabledToolsets: []string{"issues", "pull_requests"},
6152
expectedContains: []string{
62-
"closes #123",
63-
"fixes #123",
6453
"search_issues",
6554
"list_issue_types",
55+
"create_pending_pull_request_review",
6656
},
6757
},
6858
}
@@ -96,18 +86,10 @@ func TestGetToolsetInstructions(t *testing.T) {
9686
toolset: "pull_requests",
9787
expected: "create_pending_pull_request_review",
9888
},
99-
{
100-
toolset: "actions",
101-
expected: "get_job_logs",
102-
},
10389
{
10490
toolset: "issues",
10591
expected: "list_issue_types",
10692
},
107-
{
108-
toolset: "repos",
109-
expected: "get_file_contents",
110-
},
11193
{
11294
toolset: "nonexistent",
11395
expected: "",
@@ -129,4 +111,3 @@ func TestGetToolsetInstructions(t *testing.T) {
129111
})
130112
}
131113
}
132-

0 commit comments

Comments
 (0)