GranularRemoveSubIssue creates a tool to remove a sub-issue.
(t translations.TranslationHelperFunc)
| 753 | |
| 754 | // GranularRemoveSubIssue creates a tool to remove a sub-issue. |
| 755 | func GranularRemoveSubIssue(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 756 | st := NewTool( |
| 757 | ToolsetMetadataIssues, |
| 758 | mcp.Tool{ |
| 759 | Name: "remove_sub_issue", |
| 760 | Description: t("TOOL_REMOVE_SUB_ISSUE_DESCRIPTION", "Remove a sub-issue from a parent issue."), |
| 761 | Annotations: &mcp.ToolAnnotations{ |
| 762 | Title: t("TOOL_REMOVE_SUB_ISSUE_USER_TITLE", "Remove Sub-Issue"), |
| 763 | ReadOnlyHint: false, |
| 764 | DestructiveHint: jsonschema.Ptr(true), |
| 765 | OpenWorldHint: jsonschema.Ptr(true), |
| 766 | }, |
| 767 | InputSchema: &jsonschema.Schema{ |
| 768 | Type: "object", |
| 769 | Properties: map[string]*jsonschema.Schema{ |
| 770 | "owner": { |
| 771 | Type: "string", |
| 772 | Description: "Repository owner (username or organization)", |
| 773 | }, |
| 774 | "repo": { |
| 775 | Type: "string", |
| 776 | Description: "Repository name", |
| 777 | }, |
| 778 | "issue_number": { |
| 779 | Type: "number", |
| 780 | Description: "The parent issue number", |
| 781 | Minimum: jsonschema.Ptr(1.0), |
| 782 | }, |
| 783 | "sub_issue_id": { |
| 784 | Type: "number", |
| 785 | Description: "The ID of the sub-issue to remove. ID is not the same as issue number", |
| 786 | }, |
| 787 | }, |
| 788 | Required: []string{"owner", "repo", "issue_number", "sub_issue_id"}, |
| 789 | }, |
| 790 | }, |
| 791 | []scopes.Scope{scopes.Repo}, |
| 792 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 793 | owner, err := RequiredParam[string](args, "owner") |
| 794 | if err != nil { |
| 795 | return utils.NewToolResultError(err.Error()), nil, nil |
| 796 | } |
| 797 | repo, err := RequiredParam[string](args, "repo") |
| 798 | if err != nil { |
| 799 | return utils.NewToolResultError(err.Error()), nil, nil |
| 800 | } |
| 801 | issueNumber, err := RequiredInt(args, "issue_number") |
| 802 | if err != nil { |
| 803 | return utils.NewToolResultError(err.Error()), nil, nil |
| 804 | } |
| 805 | subIssueID, err := RequiredInt(args, "sub_issue_id") |
| 806 | if err != nil { |
| 807 | return utils.NewToolResultError(err.Error()), nil, nil |
| 808 | } |
| 809 | |
| 810 | client, err := deps.GetClient(ctx) |
| 811 | if err != nil { |
| 812 | return utils.NewToolResultErrorFromErr("failed to get GitHub client", err), nil, nil |
no test coverage detected