| 51 | func (p *CodeCommentProvider) Tool() Tool { return CodeComment } |
| 52 | |
| 53 | func (p *CodeCommentProvider) Execute(_ context.Context, args map[string]any) (string, error) { |
| 54 | if p.Collector == nil { |
| 55 | return "Error: comment collector is not configured", nil |
| 56 | } |
| 57 | |
| 58 | comments, errMsg := ParseComments(args) |
| 59 | if errMsg != "" { |
| 60 | return errMsg, nil |
| 61 | } |
| 62 | |
| 63 | for i := range comments { |
| 64 | p.Collector.Add(comments[i]) |
| 65 | } |
| 66 | return CommentSucceed, nil |
| 67 | } |
| 68 | |
| 69 | // ParseComments extracts LlmComment entries from tool call arguments without writing |
| 70 | // to the Collector. Returns parsed comments and an error message (empty on success). |