| 152 | } |
| 153 | |
| 154 | func AssignCopilotToIssue(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 155 | description := mvpDescription{ |
| 156 | summary: "Assign Copilot to a specific issue in a GitHub repository.", |
| 157 | outcomes: []string{ |
| 158 | "a Pull Request created with source code changes to resolve the issue", |
| 159 | }, |
| 160 | referenceLinks: []string{ |
| 161 | "https://docs.github.com/en/copilot/using-github-copilot/using-copilot-coding-agent-to-work-on-tasks/about-assigning-tasks-to-copilot", |
| 162 | }, |
| 163 | } |
| 164 | |
| 165 | return NewTool( |
| 166 | ToolsetMetadataCopilot, |
| 167 | mcp.Tool{ |
| 168 | Name: "assign_copilot_to_issue", |
| 169 | Description: t("TOOL_ASSIGN_COPILOT_TO_ISSUE_DESCRIPTION", description.String()), |
| 170 | Icons: octicons.Icons("copilot"), |
| 171 | Annotations: &mcp.ToolAnnotations{ |
| 172 | Title: t("TOOL_ASSIGN_COPILOT_TO_ISSUE_USER_TITLE", "Assign Copilot to issue"), |
| 173 | ReadOnlyHint: false, |
| 174 | IdempotentHint: true, |
| 175 | }, |
| 176 | InputSchema: &jsonschema.Schema{ |
| 177 | Type: "object", |
| 178 | Properties: map[string]*jsonschema.Schema{ |
| 179 | "owner": { |
| 180 | Type: "string", |
| 181 | Description: "Repository owner", |
| 182 | }, |
| 183 | "repo": { |
| 184 | Type: "string", |
| 185 | Description: "Repository name", |
| 186 | }, |
| 187 | "issue_number": { |
| 188 | Type: "number", |
| 189 | Description: "Issue number", |
| 190 | }, |
| 191 | "base_ref": { |
| 192 | Type: "string", |
| 193 | Description: "Git reference (e.g., branch) that the agent will start its work from. If not specified, defaults to the repository's default branch", |
| 194 | }, |
| 195 | "custom_instructions": { |
| 196 | Type: "string", |
| 197 | Description: "Optional custom instructions to guide the agent beyond the issue body. Use this to provide additional context, constraints, or guidance that is not captured in the issue description", |
| 198 | }, |
| 199 | }, |
| 200 | Required: []string{"owner", "repo", "issue_number"}, |
| 201 | }, |
| 202 | }, |
| 203 | []scopes.Scope{scopes.Repo}, |
| 204 | func(ctx context.Context, deps ToolDependencies, request *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 205 | var params struct { |
| 206 | Owner string `mapstructure:"owner"` |
| 207 | Repo string `mapstructure:"repo"` |
| 208 | IssueNumber int32 `mapstructure:"issue_number"` |
| 209 | BaseRef string `mapstructure:"base_ref"` |
| 210 | CustomInstructions string `mapstructure:"custom_instructions"` |
| 211 | } |