-
Notifications
You must be signed in to change notification settings - Fork 752
Add list_integrations and get_integration_docs MCP tools to CLI #13231
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
Merged
mitchdenny
merged 16 commits into
main
from
copilot/add-cli-tools-list-integrations-get-aspire-docs
Dec 5, 2025
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6e1c3a0
Initial plan
Copilot 671d491
Add list_integrations and get_aspire_docs MCP tools
Copilot 9184ea3
Add unit tests for list_integrations and get_aspire_docs MCP tools
Copilot fd68e77
Fix HttpClient usage to avoid port exhaustion
Copilot d0816ce
Address code review feedback: use semantic versioning and configure H…
Copilot 913594a
Optimize version parsing to avoid redundant operations
Copilot 51d198c
Address PR feedback: use Aspire branding, add schema for integrations…
Copilot ad3edc0
Add using statement to JsonDocument in tests
Copilot 9b1fde7
Improve tool schemas with better descriptions and explain how to add …
Copilot 3614708
Replace GetAspireDocsTool with WithAgentContent and get_resource_cont…
Copilot c09b1d9
Set annotation behavior to Replace for AgentContentAnnotation
Copilot 8ac275f
Add some boilerplate postgres content.
9ccf80f
Compile error
2589ac1
WIP
6ed99c4
Remove AgentContent APIs and GetResourceDocsTool, add GetIntegrationD…
Copilot 244698c
Make get_integration_docs not rely on the apphost being alive.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Text.Json; | ||
| using ModelContextProtocol.Protocol; | ||
|
|
||
| namespace Aspire.Cli.Mcp; | ||
|
|
||
| /// <summary> | ||
| /// MCP tool for getting documentation for a specific Aspire hosting integration. | ||
| /// </summary> | ||
| internal sealed class GetIntegrationDocsTool : CliMcpTool | ||
| { | ||
| public override string Name => "get_integration_docs"; | ||
|
|
||
| public override string Description => "Gets documentation for a specific Aspire hosting integration package. Use this tool to get detailed information about how to use an integration within the AppHost."; | ||
|
|
||
| public override JsonElement GetInputSchema() | ||
| { | ||
| return JsonDocument.Parse(""" | ||
| { | ||
| "type": "object", | ||
| "properties": { | ||
| "packageId": { | ||
| "type": "string", | ||
| "description": "The NuGet package ID of the integration (e.g., 'Aspire.Hosting.Redis')." | ||
| }, | ||
| "packageVersion": { | ||
| "type": "string", | ||
| "description": "The version of the package (e.g., '9.0.0')." | ||
| } | ||
| }, | ||
| "required": ["packageId", "packageVersion"], | ||
| "additionalProperties": false, | ||
| "description": "Gets documentation for a specific Aspire hosting integration. Requires the package ID and version." | ||
| } | ||
| """).RootElement; | ||
| } | ||
|
|
||
| public override ValueTask<CallToolResult> CallToolAsync(ModelContextProtocol.Client.McpClient mcpClient, IReadOnlyDictionary<string, JsonElement>? arguments, CancellationToken cancellationToken) | ||
| { | ||
| // This tool does not use the MCP client as it operates locally | ||
| _ = mcpClient; | ||
| _ = cancellationToken; | ||
|
|
||
| if (arguments == null) | ||
| { | ||
| return ValueTask.FromResult(new CallToolResult | ||
| { | ||
| IsError = true, | ||
| Content = [new TextContentBlock { Text = "Arguments are required." }] | ||
| }); | ||
| } | ||
|
|
||
| if (!arguments.TryGetValue("packageId", out var packageIdElement)) | ||
| { | ||
| return ValueTask.FromResult(new CallToolResult | ||
| { | ||
| IsError = true, | ||
| Content = [new TextContentBlock { Text = "The 'packageId' parameter is required." }] | ||
| }); | ||
| } | ||
|
|
||
| var packageId = packageIdElement.GetString(); | ||
| if (string.IsNullOrEmpty(packageId)) | ||
| { | ||
| return ValueTask.FromResult(new CallToolResult | ||
| { | ||
| IsError = true, | ||
| Content = [new TextContentBlock { Text = "The 'packageId' parameter cannot be empty." }] | ||
| }); | ||
| } | ||
|
|
||
| if (!arguments.TryGetValue("packageVersion", out var packageVersionElement)) | ||
| { | ||
| return ValueTask.FromResult(new CallToolResult | ||
| { | ||
| IsError = true, | ||
| Content = [new TextContentBlock { Text = "The 'packageVersion' parameter is required." }] | ||
| }); | ||
| } | ||
|
|
||
| var packageVersion = packageVersionElement.GetString(); | ||
| if (string.IsNullOrEmpty(packageVersion)) | ||
| { | ||
| return ValueTask.FromResult(new CallToolResult | ||
| { | ||
| IsError = true, | ||
| Content = [new TextContentBlock { Text = "The 'packageVersion' parameter cannot be empty." }] | ||
| }); | ||
| } | ||
|
|
||
| var content = $""" | ||
| Instructions for the {packageId} integration can be downloaded from: | ||
|
|
||
| https://www.nuget.org/packages/{packageId}/{packageVersion} | ||
|
|
||
| Review this documentation for instructions on how to use this package within the apphost. Refer to linked documentation for additional information. | ||
| """; | ||
|
|
||
| return ValueTask.FromResult(new CallToolResult | ||
| { | ||
| Content = [new TextContentBlock { Text = content }] | ||
| }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Missing test coverage for
GetIntegrationDocsTool. WhileListIntegrationsToolhas comprehensive tests, theGetIntegrationDocsToollacks any test coverage.Consider adding tests similar to
ListIntegrationsToolTests.csthat verify: