| 58 | func (p *CodeCommentProvider) Tool() Tool { return CodeComment } |
| 59 | |
| 60 | func (p *CodeCommentProvider) Execute(_ context.Context, args map[string]any) (string, error) { |
| 61 | if p.Collector == nil { |
| 62 | return "Error: comment collector is not configured", nil |
| 63 | } |
| 64 | |
| 65 | comments, errMsg := ParseComments(args) |
| 66 | if errMsg != "" { |
| 67 | return errMsg, nil |
| 68 | } |
| 69 | if len(comments) == 0 { |
| 70 | return CommentNoneUsableMsg, nil |
| 71 | } |
| 72 | |
| 73 | for i := range comments { |
| 74 | p.Collector.Add(comments[i]) |
| 75 | } |
| 76 | return CommentSucceed, nil |
| 77 | } |
| 78 | |
| 79 | // ParseCommentsWithPath is like ParseComments but uses defaultPath as a fallback |
| 80 | // when individual comment objects omit the path field. |