Skip to content

Commit 0ffc274

Browse files
committed
Migrate Issue workflow prompt
1 parent 7ba9cc7 commit 0ffc274

File tree

1 file changed

+57
-20
lines changed

1 file changed

+57
-20
lines changed

pkg/github/workflow_prompts.go

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,56 @@ import (
55
"fmt"
66

77
"github.com/github/github-mcp-server/pkg/translations"
8-
"github.com/mark3labs/mcp-go/mcp"
9-
"github.com/mark3labs/mcp-go/server"
8+
"github.com/modelcontextprotocol/go-sdk/mcp"
109
)
1110

1211
// 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) {
12+
func IssueToFixWorkflowPrompt(t translations.TranslationHelperFunc) (tool mcp.Prompt, handler mcp.PromptHandler) {
13+
// return mcp.NewPrompt("IssueToFixWorkflow",
14+
// mcp.WithPromptDescription(t("PROMPT_ISSUE_TO_FIX_WORKFLOW_DESCRIPTION", "Create an issue for a problem and then generate a pull request to fix it")),
15+
// mcp.WithArgument("owner", mcp.ArgumentDescription("Repository owner"), mcp.RequiredArgument()),
16+
// mcp.WithArgument("repo", mcp.ArgumentDescription("Repository name"), mcp.RequiredArgument()),
17+
// mcp.WithArgument("title", mcp.ArgumentDescription("Issue title"), mcp.RequiredArgument()),
18+
// mcp.WithArgument("description", mcp.ArgumentDescription("Issue description"), mcp.RequiredArgument()),
19+
// mcp.WithArgument("labels", mcp.ArgumentDescription("Comma-separated list of labels to apply (optional)")),
20+
// mcp.WithArgument("assignees", mcp.ArgumentDescription("Comma-separated list of assignees (optional)")),
21+
return mcp.Prompt{
22+
Name: "issue_to_fix_workflow",
23+
Description: t("PROMPT_ISSUE_TO_FIX_WORKFLOW_DESCRIPTION", "Create an issue for a problem and then generate a pull request to fix it"),
24+
Arguments: []*mcp.PromptArgument{
25+
{
26+
Name: "owner",
27+
Description: "Repository owner",
28+
Required: true,
29+
},
30+
{
31+
Name: "repo",
32+
Description: "Repository name",
33+
Required: true,
34+
},
35+
{
36+
Name: "title",
37+
Description: "Issue title",
38+
Required: true,
39+
},
40+
{
41+
Name: "description",
42+
Description: "Issue description",
43+
Required: true,
44+
},
45+
{
46+
Name: "labels",
47+
Description: "Comma-separated list of labels to apply (optional)",
48+
Required: false,
49+
},
50+
{
51+
Name: "assignees",
52+
Description: "Comma-separated list of assignees (optional)",
53+
Required: false,
54+
},
55+
},
56+
},
57+
func(_ context.Context, request *mcp.GetPromptRequest) (*mcp.GetPromptResult, error) {
2358
owner := request.Params.Arguments["owner"]
2459
repo := request.Params.Arguments["repo"]
2560
title := request.Params.Arguments["title"]
@@ -35,14 +70,16 @@ func IssueToFixWorkflowPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
3570
assignees = fmt.Sprintf("%v", a)
3671
}
3772

38-
messages := []mcp.PromptMessage{
73+
messages := []*mcp.PromptMessage{
3974
{
40-
Role: "user",
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."),
75+
Role: "user",
76+
Content: &mcp.TextContent{
77+
Text: "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.",
78+
},
4279
},
4380
{
4481
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",
82+
Content: &mcp.TextContent{Text: 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",
4683
title, owner, repo, description,
4784
func() string {
4885
if labels != "" {
@@ -55,19 +92,19 @@ func IssueToFixWorkflowPrompt(t translations.TranslationHelperFunc) (tool mcp.Pr
5592
return fmt.Sprintf("\nAssignees: %s", assignees)
5693
}
5794
return ""
58-
}())),
95+
}())},
5996
},
6097
{
6198
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)),
99+
Content: &mcp.TextContent{Text: 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)},
63100
},
64101
{
65102
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"),
103+
Content: &mcp.TextContent{Text: "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"},
67104
},
68105
{
69106
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."),
107+
Content: &mcp.TextContent{Text: "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."},
71108
},
72109
}
73110
return &mcp.GetPromptResult{

0 commit comments

Comments
 (0)