(ctx context.Context, client *githubv4.Client, args map[string]any)
| 857 | } |
| 858 | |
| 859 | func updateDiscussionComment(ctx context.Context, client *githubv4.Client, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 860 | commentNodeID, err := requiredCommentNodeID(args) |
| 861 | if err != nil { |
| 862 | return utils.NewToolResultError(err.Error()), nil, nil |
| 863 | } |
| 864 | body, err := RequiredParam[string](args, "body") |
| 865 | if err != nil { |
| 866 | return utils.NewToolResultError(err.Error()), nil, nil |
| 867 | } |
| 868 | |
| 869 | input := githubv4.UpdateDiscussionCommentInput{ |
| 870 | CommentID: githubv4.ID(commentNodeID), |
| 871 | Body: githubv4.String(body), |
| 872 | } |
| 873 | |
| 874 | var mutation struct { |
| 875 | UpdateDiscussionComment struct { |
| 876 | Comment struct { |
| 877 | ID githubv4.ID |
| 878 | URL githubv4.String `graphql:"url"` |
| 879 | } |
| 880 | } `graphql:"updateDiscussionComment(input: $input)"` |
| 881 | } |
| 882 | |
| 883 | if err := client.Mutate(ctx, &mutation, input, nil); err != nil { |
| 884 | return utils.NewToolResultError(err.Error()), nil, nil |
| 885 | } |
| 886 | |
| 887 | comment := mutation.UpdateDiscussionComment.Comment |
| 888 | out, err := json.Marshal(MinimalResponse{ |
| 889 | ID: fmt.Sprintf("%v", comment.ID), |
| 890 | URL: string(comment.URL), |
| 891 | }) |
| 892 | if err != nil { |
| 893 | return nil, nil, fmt.Errorf("failed to marshal comment: %w", err) |
| 894 | } |
| 895 | |
| 896 | return utils.NewToolResultText(string(out)), nil, nil |
| 897 | } |
| 898 | |
| 899 | func deleteDiscussionComment(ctx context.Context, client *githubv4.Client, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 900 | commentNodeID, err := requiredCommentNodeID(args) |
no test coverage detected