Skip to content

Commit 8c38bf8

Browse files
committed
add workflow prompt for creating issue and assigning to copilot
1 parent 0291916 commit 8c38bf8

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

pkg/github/tools.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
6666
).AddPrompts(
6767
toolsets.NewServerPrompt(AssignCodingAgentPrompt(t)),
6868
toolsets.NewServerPrompt(IssueInvestigationWorkflowPrompt(t)),
69+
toolsets.NewServerPrompt(IssueToFixWorkflowPrompt(t)),
6970
)
7071
users := toolsets.NewToolset("users", "GitHub User related tools").
7172
AddReadTools(

pkg/github/workflow_prompts.go

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,70 @@ func IssueInvestigationWorkflowPrompt(t translations.TranslationHelperFunc) (too
135135
}, nil
136136
}
137137
}
138+
139+
// IssueToFixWorkflowPrompt provides a guided workflow for creating an issue and then generating a PR to fix it
140+
func IssueToFixWorkflowPrompt(t translations.TranslationHelperFunc) (tool mcp.Prompt, handler server.PromptHandlerFunc) {
141+
return mcp.NewPrompt("IssueToFixWorkflow",
142+
mcp.WithPromptDescription(t("PROMPT_ISSUE_TO_FIX_WORKFLOW_DESCRIPTION", "Create an issue for a problem and then generate a pull request to fix it")),
143+
mcp.WithArgument("owner", mcp.ArgumentDescription("Repository owner"), mcp.RequiredArgument()),
144+
mcp.WithArgument("repo", mcp.ArgumentDescription("Repository name"), mcp.RequiredArgument()),
145+
mcp.WithArgument("title", mcp.ArgumentDescription("Issue title"), mcp.RequiredArgument()),
146+
mcp.WithArgument("description", mcp.ArgumentDescription("Issue description"), mcp.RequiredArgument()),
147+
mcp.WithArgument("labels", mcp.ArgumentDescription("Comma-separated list of labels to apply (optional)")),
148+
mcp.WithArgument("assignees", mcp.ArgumentDescription("Comma-separated list of assignees (optional)")),
149+
), func(_ context.Context, request mcp.GetPromptRequest) (*mcp.GetPromptResult, error) {
150+
owner := request.Params.Arguments["owner"]
151+
repo := request.Params.Arguments["repo"]
152+
title := request.Params.Arguments["title"]
153+
description := request.Params.Arguments["description"]
154+
155+
labels := ""
156+
if l, exists := request.Params.Arguments["labels"]; exists {
157+
labels = fmt.Sprintf("%v", l)
158+
}
159+
160+
assignees := ""
161+
if a, exists := request.Params.Arguments["assignees"]; exists {
162+
assignees = fmt.Sprintf("%v", a)
163+
}
164+
165+
messages := []mcp.PromptMessage{
166+
{
167+
Role: "system",
168+
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."),
169+
},
170+
{
171+
Role: "user",
172+
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",
173+
title, owner, repo, description,
174+
func() string {
175+
if labels != "" {
176+
return fmt.Sprintf("\n\nLabels to apply: %s", labels)
177+
}
178+
return ""
179+
}(),
180+
func() string {
181+
if assignees != "" {
182+
return fmt.Sprintf("\nAssignees: %s", assignees)
183+
}
184+
return ""
185+
}())),
186+
},
187+
{
188+
Role: "assistant",
189+
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)),
190+
},
191+
{
192+
Role: "user",
193+
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"),
194+
},
195+
{
196+
Role: "assistant",
197+
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."),
198+
},
199+
}
200+
return &mcp.GetPromptResult{
201+
Messages: messages,
202+
}, nil
203+
}
204+
}

0 commit comments

Comments
 (0)