Skip to content

Commit 771d7b4

Browse files
Add initial support for multi-tool workflows (#685)
* initial workflows * fixing tabs * remove unused SecurityAlertWorkflowPrompt and RepositorySetupWorkflowPrompt * add workflow prompt for creating issue and assigning to copilot * Update pkg/github/workflow_prompts.go Co-authored-by: Copilot <[email protected]> * remove notif triage * remove code inv workflow tool * rm another --------- Co-authored-by: Copilot <[email protected]>
1 parent 89e3afd commit 771d7b4

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed

pkg/github/tools.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
6363
toolsets.NewServerTool(AddSubIssue(getClient, t)),
6464
toolsets.NewServerTool(RemoveSubIssue(getClient, t)),
6565
toolsets.NewServerTool(ReprioritizeSubIssue(getClient, t)),
66-
).AddPrompts(toolsets.NewServerPrompt(AssignCodingAgentPrompt(t)))
66+
).AddPrompts(
67+
toolsets.NewServerPrompt(AssignCodingAgentPrompt(t)),
68+
toolsets.NewServerPrompt(IssueToFixWorkflowPrompt(t)),
69+
)
6770
users := toolsets.NewToolset("users", "GitHub User related tools").
6871
AddReadTools(
6972
toolsets.NewServerTool(SearchUsers(getClient, t)),

pkg/github/workflow_prompts.go

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package github
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
"github.com/github/github-mcp-server/pkg/translations"
8+
"github.com/mark3labs/mcp-go/mcp"
9+
"github.com/mark3labs/mcp-go/server"
10+
)
11+
12+
// IssueToFixWorkflowPrompt provides a guided workflow for creating an issue and then generating a PR to fix it
13+
func IssueToFixWorkflowPrompt(t translations.TranslationHelperFunc) (tool mcp.Prompt, handler server.PromptHandlerFunc) {
14+
return mcp.NewPrompt("IssueToFixWorkflow",
15+
mcp.WithPromptDescription(t("PROMPT_ISSUE_TO_FIX_WORKFLOW_DESCRIPTION", "Create an issue for a problem and then generate a pull request to fix it")),
16+
mcp.WithArgument("owner", mcp.ArgumentDescription("Repository owner"), mcp.RequiredArgument()),
17+
mcp.WithArgument("repo", mcp.ArgumentDescription("Repository name"), mcp.RequiredArgument()),
18+
mcp.WithArgument("title", mcp.ArgumentDescription("Issue title"), mcp.RequiredArgument()),
19+
mcp.WithArgument("description", mcp.ArgumentDescription("Issue description"), mcp.RequiredArgument()),
20+
mcp.WithArgument("labels", mcp.ArgumentDescription("Comma-separated list of labels to apply (optional)")),
21+
mcp.WithArgument("assignees", mcp.ArgumentDescription("Comma-separated list of assignees (optional)")),
22+
), func(_ context.Context, request mcp.GetPromptRequest) (*mcp.GetPromptResult, error) {
23+
owner := request.Params.Arguments["owner"]
24+
repo := request.Params.Arguments["repo"]
25+
title := request.Params.Arguments["title"]
26+
description := request.Params.Arguments["description"]
27+
28+
labels := ""
29+
if l, exists := request.Params.Arguments["labels"]; exists {
30+
labels = fmt.Sprintf("%v", l)
31+
}
32+
33+
assignees := ""
34+
if a, exists := request.Params.Arguments["assignees"]; exists {
35+
assignees = fmt.Sprintf("%v", a)
36+
}
37+
38+
messages := []mcp.PromptMessage{
39+
{
40+
Role: "system",
41+
Content: mcp.NewTextContent("You are a development workflow assistant helping to create GitHub issues and generate corresponding pull requests to fix them. You should: 1) Create a well-structured issue with clear problem description, 2) Assign it to Copilot coding agent to generate a solution, and 3) Monitor the PR creation process."),
42+
},
43+
{
44+
Role: "user",
45+
Content: mcp.NewTextContent(fmt.Sprintf("I need to create an issue titled '%s' in %s/%s and then have a PR generated to fix it. The issue description is: %s%s%s",
46+
title, owner, repo, description,
47+
func() string {
48+
if labels != "" {
49+
return fmt.Sprintf("\n\nLabels to apply: %s", labels)
50+
}
51+
return ""
52+
}(),
53+
func() string {
54+
if assignees != "" {
55+
return fmt.Sprintf("\nAssignees: %s", assignees)
56+
}
57+
return ""
58+
}())),
59+
},
60+
{
61+
Role: "assistant",
62+
Content: mcp.NewTextContent(fmt.Sprintf("I'll help you create the issue '%s' in %s/%s and then coordinate with Copilot to generate a fix. Let me start by creating the issue with the provided details.", title, owner, repo)),
63+
},
64+
{
65+
Role: "user",
66+
Content: mcp.NewTextContent("Perfect! Please:\n1. Create the issue with the title, description, labels, and assignees\n2. Once created, assign it to Copilot coding agent to generate a solution\n3. Monitor the process and let me know when the PR is ready for review"),
67+
},
68+
{
69+
Role: "assistant",
70+
Content: mcp.NewTextContent("Excellent plan! Here's what I'll do:\n\n1. ✅ Create the issue with all specified details\n2. 🤖 Assign to Copilot coding agent for automated fix\n3. 📋 Monitor progress and notify when PR is created\n4. 🔍 Provide PR details for your review\n\nLet me start by creating the issue."),
71+
},
72+
}
73+
return &mcp.GetPromptResult{
74+
Messages: messages,
75+
}, nil
76+
}
77+
}

0 commit comments

Comments
 (0)