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

[pull] main from github:main#71

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

Merged
pull merged 2 commits intocodingwatching:mainfromgithub:main
Jun 24, 2025
Merged
Show file tree
Hide file tree
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
39 changes: 39 additions & 0 deletionspkg/github/issues.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -931,3 +931,42 @@ func parseISOTimestamp(timestamp string) (time.Time, error) {
// Return error with supported formats
return time.Time{}, fmt.Errorf("invalid ISO 8601 timestamp: %s (supported formats: YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DD)", timestamp)
}

func AssignCodingAgentPrompt(t translations.TranslationHelperFunc) (tool mcp.Prompt, handler server.PromptHandlerFunc) {
return mcp.NewPrompt("AssignCodingAgent",
mcp.WithPromptDescription(t("PROMPT_ASSIGN_CODING_AGENT_DESCRIPTION", "Assign GitHub Coding Agent to multiple tasks in a GitHub repository.")),
mcp.WithArgument("repo", mcp.ArgumentDescription("The repository to assign tasks in (owner/repo)."), mcp.RequiredArgument()),
), func(ctx context.Context, request mcp.GetPromptRequest) (*mcp.GetPromptResult, error) {
repo := request.Params.Arguments["repo"]

messages := []mcp.PromptMessage{
{
Role: "system",
Content: mcp.NewTextContent("You are a personal assistant for GitHub the Copilot GitHub Coding Agent. Your task is to help the user assign tasks to the Coding Agent based on their open GitHub issues. You can use `assign_copilot_to_issue` tool to assign the Coding Agent to issues that are suitable for autonomous work, and `search_issues` tool to find issues that match the user's criteria. You can also use `list_issues` to get a list of issues in the repository."),
},
{
Role: "user",
Content: mcp.NewTextContent(fmt.Sprintf("Please go and get a list of the most recent 10 issues from the %s GitHub repository", repo)),
},
{
Role: "assistant",
Content: mcp.NewTextContent(fmt.Sprintf("Sure! I will get a list of the 10 most recent issues for the repo %s.", repo)),
},
{
Role: "user",
Content: mcp.NewTextContent("For each issue, please check if it is a clearly defined coding task with acceptance criteria and a low to medium complexity to identify issues that are suitable for an AI Coding Agent to work on. Then assign each of the identified issues to Copilot."),
},
{
Role: "assistant",
Content: mcp.NewTextContent("Certainly! Let me carefully check which ones are clearly scoped issues that are good to assign to the coding agent, and I will summarize and assign them now."),
},
{
Role: "user",
Content: mcp.NewTextContent("Great, if you are unsure if an issue is good to assign, ask me first, rather than assigning copilot. If you are certain the issue is clear and suitable you can assign it to Copilot without asking."),
},
}
return &mcp.GetPromptResult{
Messages: messages,
}, nil
}
}
2 changes: 1 addition & 1 deletionpkg/github/repositories.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -241,7 +241,7 @@ func ListBranches(getClient GetClientFn, t translations.TranslationHelperFunc) (
// CreateOrUpdateFile creates a tool to create or update a file in a GitHub repository.
func CreateOrUpdateFile(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("create_or_update_file",
mcp.WithDescription(t("TOOL_CREATE_OR_UPDATE_FILE_DESCRIPTION", "Create or update a single file in a GitHub repository. If updating, you must provide the SHA of the file you want to update.")),
mcp.WithDescription(t("TOOL_CREATE_OR_UPDATE_FILE_DESCRIPTION", "Create or update a single file in a GitHub repository. If updating, you must provide the SHA of the file you want to update. Use this tool to create or update a file in a GitHub repository remotely; do not use it for local file operations.")),
mcp.WithToolAnnotation(mcp.ToolAnnotation{
Title: t("TOOL_CREATE_OR_UPDATE_FILE_USER_TITLE", "Create or update file"),
ReadOnlyHint: ToBoolPtr(false),
Expand Down
2 changes: 1 addition & 1 deletionpkg/github/tools.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,7 +59,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
toolsets.NewServerTool(AddIssueComment(getClient, t)),
toolsets.NewServerTool(UpdateIssue(getClient, t)),
toolsets.NewServerTool(AssignCopilotToIssue(getGQLClient, t)),
)
).AddPrompts(toolsets.NewServerPrompt(AssignCodingAgentPrompt(t)))
users := toolsets.NewToolset("users", "GitHub User related tools").
AddReadTools(
toolsets.NewServerTool(SearchUsers(getClient, t)),
Expand Down
30 changes: 30 additions & 0 deletionspkg/toolsets/toolsets.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,12 +40,25 @@ func NewServerResourceTemplate(resourceTemplate mcp.ResourceTemplate, handler se
}
}

func NewServerPrompt(prompt mcp.Prompt, handler server.PromptHandlerFunc) ServerPrompt {
return ServerPrompt{
Prompt: prompt,
Handler: handler,
}
}

// ServerResourceTemplate represents a resource template that can be registered with the MCP server.
type ServerResourceTemplate struct {
resourceTemplate mcp.ResourceTemplate
handler server.ResourceTemplateHandlerFunc
}

// ServerPrompt represents a prompt that can be registered with the MCP server.
type ServerPrompt struct {
Prompt mcp.Prompt
Handler server.PromptHandlerFunc
}

// Toolset represents a collection of MCP functionality that can be enabled or disabled as a group.
type Toolset struct {
Name string
Expand All@@ -57,6 +70,8 @@ type Toolset struct {
// resources are not tools, but the community seems to be moving towards namespaces as a broader concept
// and in order to have multiple servers running concurrently, we want to avoid overlapping resources too.
resourceTemplates []ServerResourceTemplate
// prompts are also not tools but are namespaced similarly
prompts []ServerPrompt
}

func (t *Toolset) GetActiveTools() []server.ServerTool {
Expand DownExpand Up@@ -95,6 +110,11 @@ func (t *Toolset) AddResourceTemplates(templates ...ServerResourceTemplate) *Too
return t
}

func (t *Toolset) AddPrompts(prompts ...ServerPrompt) *Toolset {
t.prompts = append(t.prompts, prompts...)
return t
}

func (t *Toolset) GetActiveResourceTemplates() []ServerResourceTemplate {
if !t.Enabled {
return nil
Expand All@@ -115,6 +135,15 @@ func (t *Toolset) RegisterResourcesTemplates(s *server.MCPServer) {
}
}

func (t *Toolset) RegisterPrompts(s *server.MCPServer) {
if !t.Enabled {
return
}
for _, prompt := range t.prompts {
s.AddPrompt(prompt.Prompt, prompt.Handler)
}
}

func (t *Toolset) SetReadOnly() {
// Set the toolset to read-only
t.readOnly = true
Expand DownExpand Up@@ -225,6 +254,7 @@ func (tg *ToolsetGroup) RegisterAll(s *server.MCPServer) {
for _, toolset := range tg.Toolsets {
toolset.RegisterTools(s)
toolset.RegisterResourcesTemplates(s)
toolset.RegisterPrompts(s)
}
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp