-
Notifications
You must be signed in to change notification settings - Fork 176
New Tool: List Event Grid Subscription #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
tools/Azure.Mcp.Tools.EventGrid/src/Commands/Subscription/SubscriptionListCommand.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Commands/Subscription/SubscriptionListCommand.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Options/EventGridOptionDefinitions.cs
Outdated
Show resolved
Hide resolved
222acc9
to
f7160c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new EventGrid subscription listing tool to the Azure MCP Server, enabling users to discover and filter Event Grid subscriptions across their Azure resources.
- Adds
azmcp_eventgrid_subscription_list
command with comprehensive filtering capabilities - Implements subscription retrieval from both custom topics and system topics
- Provides detailed subscription information including endpoints, filters, and retry policies
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
SubscriptionListCommandTests.cs | New unit test file with comprehensive test coverage for subscription listing scenarios |
SubscriptionListCommand.cs | New command implementation for listing Event Grid subscriptions with filtering options |
EventGridService.cs | Extended service with subscription retrieval logic for custom and system topics |
IEventGridService.cs | Added interface method for subscription operations |
EventGridSubscriptionInfo.cs | New model representing Event Grid subscription data |
SubscriptionListOptions.cs | New options class for subscription list command parameters |
EventGridOptionDefinitions.cs | Added topic name and location option definitions |
Various documentation files | Updated with new command information and examples |
tools/Azure.Mcp.Tools.EventGrid/src/Services/EventGridService.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Services/EventGridService.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Services/EventGridService.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Services/EventGridService.cs
Outdated
Show resolved
Hide resolved
627226d
to
f44b964
Compare
tools/Azure.Mcp.Tools.EventGrid/src/Commands/Subscription/SubscriptionListCommand.cs
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Services/EventGridService.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Services/EventGridService.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Services/EventGridService.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Services/EventGridService.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Services/EventGridService.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.EventGrid/src/Options/EventGridOptionDefinitions.cs
Outdated
Show resolved
Hide resolved
command.Validators.Clear(); | ||
|
||
// Custom validation: Either --topic or --subscription (or env var) is required | ||
command.Validators.Add(commandResult => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have similar parsing in other places in this code. Let's figure out a way to refactor this so we don't have AZURE_SUBSCRIPTION_ID parsing in multiple places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that SubscriptionCommand.cs(Core) and SubscriptionListCommand.cs(EventGrid) was using this method parsing. I created a helper method in SubscriptionCommand.cs, and called that in both the places.
I also saw that we were calling
var originalValue = Environment.GetEnvironmentVariable("AZURE_SUBSCRIPTION_ID");
and
Environment.SetEnvironmentVariable("AZURE_SUBSCRIPTION_ID", "env-subs");
in a few of our test file.
So, I created a getter/setter method in EnvironmentVariableHelpers.cs to set/get the Azure Subscription ID, and called this get/set method in the rest of our code.
bff5307
to
76083a0
Compare
What does this PR do?
This PR introduces a new tool azmcp-eventgrid-subscription-list that allows users to list all Event Grid subscripts within a given subscription/topic. It's also possible to filter based on resource group and location.
“List all Event Grid subscriptions in my subscription”
GitHub issue number?
#299
Pre-merge Checklist
CHANGELOG.md
for product changes (features, bug fixes, UI/UX, updated dependencies
).\eng\common\spelling\Invoke-Cspell.ps1
README.md
documentation/docs/azmcp-commands.md
/docs/e2eTestPrompts.md
ToolDescriptionEvaluator
and obtained a score of0.4
or more and a top 3 ranking for all related test promptscrypto mining, spam, data exfiltration, etc.
)/azp run azure - mcp
to run Live Test Pipeline