Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add multi-tool workflow server instructions specific to local GitHub MCP#1196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
mattdholloway wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromworkflow-templates-server-instructions
Draft
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletionspkg/github/instructions.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
package github

import (
"fmt"
"os"
"slices"
"strings"
Expand All@@ -20,6 +21,11 @@ func GenerateInstructions(enabledToolsets []string) string {
instructions = append(instructions, "Always call 'get_me' first to understand current user permissions and context.")
}

generalInstructions := getGeneralInstructions(enabledToolsets)
if generalInstructions != "" {
instructions = append(instructions, "Here are common scenarios you may encounter followed by name and description of the steps to follow:", generalInstructions)
}

// Individual toolset instructions
for _, toolset := range enabledToolsets {
if inst := getToolsetInstructions(toolset); inst != "" {
Expand DownExpand Up@@ -47,6 +53,52 @@ Tool usage guidance:
return strings.Join(allInstructions, " ")
}

// scenarioDefinition defines a scenario with its instruction text and required toolsets
type scenarioDefinition struct {
instruction string
requiredToolsets []string
}

// getGeneralInstructions returns scenario-based guidance for common development tasks
func getGeneralInstructions(enabledToolsets []string) string {
enabledSet := make(map[string]bool)
for _, ts := range enabledToolsets {
enabledSet[ts] = true
}

scenarios := map[string]scenarioDefinition{
"Reviewing Pull Requests": {
instruction: "Use get_pull_request to fetch PR details and get_pull_request_files to see changes. Use create_pending_pull_request_review to start a review, add_comment_to_pending_review for line-specific feedback, then submit_pending_pull_request_review to publish. Check get_pull_request_status to verify CI/CD checks before approving.",
requiredToolsets: []string{"pull_requests"},
},
}

var parts []string
parts = append(parts, "When helping with development tasks, consider these common scenarios and appropriate tool choices:")

// Filter scenarios based on enabled toolsets
for scenarioName, scenario := range scenarios {
if len(scenario.requiredToolsets) == 0 {
parts = append(parts, fmt.Sprintf("%s: %s", scenarioName, scenario.instruction))
continue
}

hasAllRequiredToolsets := true
for _, required := range scenario.requiredToolsets {
if !enabledSet[required] {
hasAllRequiredToolsets = false
break
}
}

if hasAllRequiredToolsets {
parts = append(parts, fmt.Sprintf("%s: %s", scenarioName, scenario.instruction))
}
}

return strings.Join(parts, " ")
}

// getToolsetInstructions returns specific instructions for individual toolsets
func getToolsetInstructions(toolset string) string {
switch toolset {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp