-
Notifications
You must be signed in to change notification settings - Fork 763
Add ExcludeFromMcp() resource extension
#12515
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
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12515Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12515" |
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 functionality to opt out resources from AI features in the Aspire Dashboard. The implementation introduces a new AIOptOut property that allows resources to exclude their data (console logs and telemetry) from AI tools and assistants.
Key changes:
- Introduced
AIOptOutAnnotationandWithOptOutAI()extension method for marking resources - Added filtering logic in MCP tools to exclude opted-out resources from AI data retrieval
- Created
IsResourceAIOptOut()helper method andTryConvertToBool()utility for property checking
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Hosting/ApplicationModel/AIOptOutAnnotation.cs | New annotation class to mark resources for AI opt-out |
| src/Aspire.Hosting/ResourceBuilderExtensions.cs | Added WithOptOutAI() extension method for resource configuration |
| src/Aspire.Hosting/ApplicationModel/ResourceNotificationService.cs | Publishes AI opt-out property to dashboard when annotation is present |
| src/Shared/Model/KnownProperties.cs | Defined AIOptOut property constant |
| src/Aspire.Dashboard/Utils/ValueExtensions.cs | Added TryConvertToBool() helper method for boolean conversion |
| src/Aspire.Dashboard/Model/Assistant/AIHelpers.cs | Added IsResourceAIOptOut() helper to check resource opt-out status |
| src/Aspire.Dashboard/Mcp/AspireTelemetryMcpTools.cs | Filters traces and logs from opted-out resources |
| src/Aspire.Dashboard/Mcp/AspireResourceMcpTools.cs | Filters resources and prevents access to console logs for opted-out resources |
| tests/Aspire.Dashboard.Tests/Mcp/AspireTelemetryMcpToolsTests.cs | Test coverage for opt-out filtering in telemetry tools |
| tests/Aspire.Dashboard.Tests/Mcp/AspireResourceMcpToolsTests.cs | Test coverage for opt-out filtering in resource tools |
f4d364c to
cd3aaa5
Compare
WithExcludeFromMcp() resource extension
bb5ebe8 to
fc6b815
Compare
WithExcludeFromMcp() resource extensionExcludeFromMcp() resource extension
fc6b815 to
cf667e6
Compare
|
/backport to release/13.0 |
|
Started backporting to release/13.0: https://github.com/dotnet/aspire/actions/runs/18987184161 |
Description
This PR adds a way for resources to opt-out of being included in AI results. When opted out, a resource won't be returned with
list_resources, won't be a target ofexecute_resource_command, and no telemetry/consoles logs will be returned for it.For example, adding
frontendBuilder.WithOptOutAI()will exclude the frontend resource from all AI results.Fixes #12504
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate