MCPcopy Index your code
hub / github.com/github/github-mcp-server / updateDiscussionComment

Function updateDiscussionComment

pkg/github/discussions.go:859–897  ·  view source on GitHub ↗
(ctx context.Context, client *githubv4.Client, args map[string]any)

Source from the content-addressed store, hash-verified

857}
858
859func 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
899func deleteDiscussionComment(ctx context.Context, client *githubv4.Client, args map[string]any) (*mcp.CallToolResult, any, error) {
900 commentNodeID, err := requiredCommentNodeID(args)

Callers 1

DiscussionCommentWriteFunction · 0.85

Calls 5

NewToolResultErrorFunction · 0.92
NewToolResultTextFunction · 0.92
requiredCommentNodeIDFunction · 0.85
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected