feat: add cluster filter to list_alert_rules MCP tool (#4288)#4302
Conversation
|
Thank you for your interest in contributing to the Harvest project! We require contributors to sign our Corporate contributor license agreement (CCLA), and we don"t have the user(s) @AvijitBhattacharjee on file. In order for us to review and merge your code, please follow the instructions in step 6 of creating a pull request. |
4670a2b to
6cf0758
Compare
|
Thank you for your interest in contributing to the Harvest project! We require contributors to sign our Corporate contributor license agreement (CCLA), and we don"t have the user(s) @AvijitBhattacharjee on file. In order for us to review and merge your code, please follow the instructions in step 6 of creating a pull request. |
|
@AvijitBhattacharjee Thanks for the contribution. Could you refill the CCLA form as your username in the filled form has a space as |
@rahulguptajss I have resubmitted the form with AvijitBhattacharjee. Kindly check and please proceed for this PR. Thanks. |
Thanks @AvijitBhattacharjee . It looks good now. |
|
Thanks @Hardikl for the approval. Please let me know how many approval needed to merge and who can merge the PR? I think I will not have the merge access. |
6cf0758 to
af42ba5
Compare
|
@rahulguptajss @Hardikl now I have modified the PR title and the check passed. @Hardikl Thanks for the approval. It seems there are few workflows requires approval from a maintainer. Kindly check. |
|
Thanks for the contribution @AvijitBhattacharjee We've merged your changes, and they are available in the latest nightly build. |
|
Hi Sir,
I am really glad to make my first open source contribution in NetApp. I am
really grateful to the reviewers for merging my changes. I would like to
contribute more.
Thanks again.
Regards,
Avijit Bhattacharjee
https://www.linkedin.com/in/avijit-bhattacharjee--/
…On Mon, Jun 1, 2026 at 11:56 PM Chris Grindstaff ***@***.***> wrote:
*cgrinds* left a comment (NetApp/harvest#4302)
<#4302 (comment)>
Thanks for the contribution @AvijitBhattacharjee
<https://github.com/AvijitBhattacharjee> We've merged your changes, and
they are available in the latest nightly build
<https://github.com/NetApp/harvest/releases/tag/nightly>.
—
Reply to this email directly, view it on GitHub
<#4302?email_source=notifications&email_token=ALWS3UPP6H5F7NCQQJDFSQT45XDHFA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINJZGUZTMMJSHA4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4595361288>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALWS3UOPMH6XW635LXSMKML45XDHFAVCNFSM6AAAAACZKB44HKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DKOJVGM3DCMRYHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|







Title: feat(mcp): add cluster and cluster_match filter to list_alert_rules
Closes #4288
Summary
Adds optional cluster and cluster_match parameters to the list_alert_rules MCP tool, allowing users to scope results to a specific cluster instead of always returning every rule from alert_rules.yml and ems_alert_rules.yml.
Changes
mcp/pkg/mcptypes/types.go
Added ListAlertRulesRequest struct with cluster (exact match) and cluster_match (regex) fields, consistent with GetActiveAlertsRequest and InfrastructureHealthRequest.
mcp/cmd/server/main.go
Updated ListAlertRules handler signature from struct{} to mcptypes.ListAlertRulesRequest
Added input validation (rejects " and \ in cluster values) matching the pattern used by GetActiveAlerts and InfrastructureHealth
Added filterRulesByCluster — filters []rules.RuleInfo by checking the rule's expr (substring match) and labels["cluster"] (exact or regex match)
Added ruleMatchesCluster — core matching logic handling exact cluster name and compiled regex cases
Added filter annotation in response output when filtering is active
Updated Total Rules count to reflect filtered results
mcp/cmd/descriptions/descriptions.go
Added ListAlertRulesDesc constant with full documentation of the new parameters, replacing the previous inline string in createMCPServer()