GranularAddSubIssue creates a tool to add a sub-issue.
(t translations.TranslationHelperFunc)
| 679 | |
| 680 | // GranularAddSubIssue creates a tool to add a sub-issue. |
| 681 | func GranularAddSubIssue(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 682 | st := NewTool( |
| 683 | ToolsetMetadataIssues, |
| 684 | mcp.Tool{ |
| 685 | Name: "add_sub_issue", |
| 686 | Description: t("TOOL_ADD_SUB_ISSUE_DESCRIPTION", "Add a sub-issue to a parent issue."), |
| 687 | Annotations: &mcp.ToolAnnotations{ |
| 688 | Title: t("TOOL_ADD_SUB_ISSUE_USER_TITLE", "Add Sub-Issue"), |
| 689 | ReadOnlyHint: false, |
| 690 | DestructiveHint: jsonschema.Ptr(false), |
| 691 | OpenWorldHint: jsonschema.Ptr(true), |
| 692 | }, |
| 693 | InputSchema: &jsonschema.Schema{ |
| 694 | Type: "object", |
| 695 | Properties: map[string]*jsonschema.Schema{ |
| 696 | "owner": { |
| 697 | Type: "string", |
| 698 | Description: "Repository owner (username or organization)", |
| 699 | }, |
| 700 | "repo": { |
| 701 | Type: "string", |
| 702 | Description: "Repository name", |
| 703 | }, |
| 704 | "issue_number": { |
| 705 | Type: "number", |
| 706 | Description: "The parent issue number", |
| 707 | Minimum: jsonschema.Ptr(1.0), |
| 708 | }, |
| 709 | "sub_issue_id": { |
| 710 | Type: "number", |
| 711 | Description: "The ID of the sub-issue to add. ID is not the same as issue number", |
| 712 | }, |
| 713 | "replace_parent": { |
| 714 | Type: "boolean", |
| 715 | Description: "If true, reparent the sub-issue if it already has a parent", |
| 716 | }, |
| 717 | }, |
| 718 | Required: []string{"owner", "repo", "issue_number", "sub_issue_id"}, |
| 719 | }, |
| 720 | }, |
| 721 | []scopes.Scope{scopes.Repo}, |
| 722 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 723 | owner, err := RequiredParam[string](args, "owner") |
| 724 | if err != nil { |
| 725 | return utils.NewToolResultError(err.Error()), nil, nil |
| 726 | } |
| 727 | repo, err := RequiredParam[string](args, "repo") |
| 728 | if err != nil { |
| 729 | return utils.NewToolResultError(err.Error()), nil, nil |
| 730 | } |
| 731 | issueNumber, err := RequiredInt(args, "issue_number") |
| 732 | if err != nil { |
| 733 | return utils.NewToolResultError(err.Error()), nil, nil |
| 734 | } |
| 735 | subIssueID, err := RequiredInt(args, "sub_issue_id") |
| 736 | if err != nil { |
| 737 | return utils.NewToolResultError(err.Error()), nil, nil |
| 738 | } |
no test coverage detected