Skip to content

Add isDefault field to subscription_list response and guide AI subscription selection#1974

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-issue-1079
Draft

Add isDefault field to subscription_list response and guide AI subscription selection#1974
Copilot wants to merge 3 commits intomainfrom
copilot/fix-issue-1079

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

The subscription_list tool description claimed to return isDefault but SubscriptionData from the Azure SDK has no such field. AI agents would pick the first subscription arbitrarily instead of using the default or asking the user.

Changes

  • New SubscriptionInfo model — replaces raw SubscriptionData in the response with a projection that includes isDefault, set by matching against AZURE_SUBSCRIPTION_ID env var
  • Default-first sorting — subscriptions with isDefault=true are returned first
  • Updated tool description — instructs agents to prefer the default subscription and ask the user when no default is set with multiple subscriptions
  • AOT serialization — registered SubscriptionInfo in SubscriptionJsonContext
  • Tests — 6 new unit tests covering default detection, sorting, and edge cases

Response shape

{
  "subscriptions": [
    { "subscriptionId": "...", "displayName": "My Sub", "state": "Enabled", "tenantId": "...", "isDefault": true },
    { "subscriptionId": "...", "displayName": "Other Sub", "state": "Enabled", "tenantId": "...", "isDefault": false }
  ]
}

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits March 10, 2026 00:01
…cription to guide AI agent behavior

The subscription_list tool now:
- Returns a SubscriptionInfo model with isDefault field indicating the default subscription
  (based on AZURE_SUBSCRIPTION_ID environment variable)
- Sorts subscriptions so the default appears first in the list
- Updated description instructs AI agents to prefer the default subscription or ask the
  user when no default is set and multiple subscriptions exist

Fixes #1079

Co-authored-by: ArthurMa1978 <20514459+ArthurMa1978@users.noreply.github.com>
Co-authored-by: ArthurMa1978 <20514459+ArthurMa1978@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with mcp repository according to issue 1079 Add isDefault field to subscription_list response and guide AI subscription selection Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants