SubIssueWrite creates a tool to add a sub-issue to a parent issue.
(t translations.TranslationHelperFunc)
| 1299 | |
| 1300 | // SubIssueWrite creates a tool to add a sub-issue to a parent issue. |
| 1301 | func SubIssueWrite(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 1302 | st := NewTool( |
| 1303 | ToolsetMetadataIssues, |
| 1304 | mcp.Tool{ |
| 1305 | Name: "sub_issue_write", |
| 1306 | Description: t("TOOL_SUB_ISSUE_WRITE_DESCRIPTION", "Add a sub-issue to a parent issue in a GitHub repository."), |
| 1307 | Annotations: &mcp.ToolAnnotations{ |
| 1308 | Title: t("TOOL_SUB_ISSUE_WRITE_USER_TITLE", "Change sub-issue"), |
| 1309 | ReadOnlyHint: false, |
| 1310 | }, |
| 1311 | InputSchema: &jsonschema.Schema{ |
| 1312 | Type: "object", |
| 1313 | Properties: map[string]*jsonschema.Schema{ |
| 1314 | "method": { |
| 1315 | Type: "string", |
| 1316 | Description: `The action to perform on a single sub-issue |
| 1317 | Options are: |
| 1318 | - 'add' - add a sub-issue to a parent issue in a GitHub repository. |
| 1319 | - 'remove' - remove a sub-issue from a parent issue in a GitHub repository. |
| 1320 | - 'reprioritize' - change the order of sub-issues within a parent issue in a GitHub repository. Use either 'after_id' or 'before_id' to specify the new position. |
| 1321 | `, |
| 1322 | }, |
| 1323 | "owner": { |
| 1324 | Type: "string", |
| 1325 | Description: "Repository owner", |
| 1326 | }, |
| 1327 | "repo": { |
| 1328 | Type: "string", |
| 1329 | Description: "Repository name", |
| 1330 | }, |
| 1331 | "issue_number": { |
| 1332 | Type: "number", |
| 1333 | Description: "The number of the parent issue", |
| 1334 | }, |
| 1335 | "sub_issue_id": { |
| 1336 | Type: "number", |
| 1337 | Description: "The ID of the sub-issue to add. ID is not the same as issue number", |
| 1338 | }, |
| 1339 | "replace_parent": { |
| 1340 | Type: "boolean", |
| 1341 | Description: "When true, replaces the sub-issue's current parent issue. Use with 'add' method only.", |
| 1342 | }, |
| 1343 | "after_id": { |
| 1344 | Type: "number", |
| 1345 | Description: "The ID of the sub-issue to be prioritized after (either after_id OR before_id should be specified)", |
| 1346 | }, |
| 1347 | "before_id": { |
| 1348 | Type: "number", |
| 1349 | Description: "The ID of the sub-issue to be prioritized before (either after_id OR before_id should be specified)", |
| 1350 | }, |
| 1351 | }, |
| 1352 | Required: []string{"method", "owner", "repo", "issue_number", "sub_issue_id"}, |
| 1353 | }, |
| 1354 | }, |
| 1355 | []scopes.Scope{scopes.Repo}, |
| 1356 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 1357 | method, err := RequiredParam[string](args, "method") |
| 1358 | if err != nil { |