package tools import ( "context" "encoding/json" "git.d-ma.be/mathias/gitea-mcp/internal/allowlist" "git.d-ma.be/mathias/gitea-mcp/internal/gitea" "git.d-ma.be/mathias/gitea-mcp/internal/registry" ) type IssueListComments struct { c *gitea.Client a *allowlist.Allowlist } func NewIssueListComments(c *gitea.Client, a *allowlist.Allowlist) *IssueListComments { return &IssueListComments{c: c, a: a} } func (t *IssueListComments) Descriptor() registry.ToolDescriptor { return registry.ToolDescriptor{ Name: "issue_list_comments", Description: "List all comments on an issue or pull request. Returns id, body, author, html_url, and timestamps for each comment.", InputSchema: json.RawMessage(`{ "type":"object", "properties":{ "owner":{"type":"string"}, "repo":{"type":"string"}, "number":{"type":"integer","minimum":1} }, "required":["owner","repo","number"] }`), } } type issueListCommentsArgs struct { Owner string `json:"owner"` Repo string `json:"repo"` Number int `json:"number"` } func (t *IssueListComments) Call(ctx context.Context, raw json.RawMessage) (json.RawMessage, error) { var args issueListCommentsArgs if err := parseArgs(raw, &args); err != nil { return nil, err } if err := t.a.Check(args.Owner); err != nil { return nil, err } comments, err := t.c.ListIssueComments(ctx, args.Owner, args.Repo, args.Number) if err != nil { return nil, err } return textOK(comments) }