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