Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pr: 2131
changes:
- section: "Breaking Changes"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it is a breaking change?

description: "Improved descriptions of the `extension_azqr`, `extension_cli_generate`, and `extension_cli_install` tools, as well as the base Azure rules around them fed to agents for better tool selection."
6 changes: 3 additions & 3 deletions servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ This file contains prompts used for end-to-end testing to ensure each tool is in

| Tool Name | Test Prompt |
|:----------|:----------|
| extension_cli_generate | Create a Storage account with name <storage_account_name> using Azure CLI |
| extension_cli_generate | What's the Azure CLI command for getting a storage account's details? |
| extension_cli_generate | List all virtual machines in my subscription using Azure CLI |
| extension_cli_generate | Show me the details of the storage account <account_name> with Azure CLI commands |
| extension_cli_install | <Ask the MCP host to uninstall az cli on your machine and run test prompts for extension_cli_generate> |
| extension_cli_generate | Show me the details of the storage account <account_name> using Azure CLI commands |
| extension_cli_install | \<Ask the MCP host to uninstall az cli on your machine and run test prompts for extension_cli_generate> |
| extension_cli_install | How to install azd |
| extension_cli_install | What is Azure Functions Core tools and how to install it |

Expand Down
21 changes: 6 additions & 15 deletions servers/Azure.Mcp.Server/src/Resources/azure-rules.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
Azure MCP server usage rules:
- Use Azure Tools: When handling requests related to Azure, always use your tools.
- Use Azure Code Gen Best Practices: When generating code for Azure or any Azure services, running terminal commands for Azure,
or performing operations related to Azure, invoke your `bestpractices` tool if available.
- Use Azure Deployment Best Practices: When deploying to Azure or preparing applications for deployment to Azure,
invoke your `bestpractices` tool if available.
- If a user wants to use, install, or generate commands for the Azure CLI (az), Azure Developer CLI (azd), Azure Functions Core Tools CLI (func), or Azure Quick Review CLI (azqr), use your `extension` tools first.
- Use Azure Code Gen Best Practices: When generating code for Azure or any Azure services, running terminal commands for Azure, or performing operations related to Azure, invoke your `bestpractices` tool if available.
- Use Azure Deployment Best Practices: When deploying to Azure or preparing applications for deployment to Azure, invoke your `bestpractices` tool if available.
- Only call your `bestpractices` tool when you are sure the user is discussing Azure; do not call it otherwise.
- Use Azure AI App Code Generation Best Practices: When generating code for AI applications, AI agents, workflows,
or chatbots, invoke your `get_azure_bestpractices_ai_app` command (under `get_azure_bestpractices` tool) if tool available.
Call this tool first before creating any plans, todos or code.
Only call this command when the user is discussing AI app development with Microsoft Foundry, Azure, Microsoft
agent framework SDK, or without specifying any technology. Do NOT call it when the user specifies other technology
or when performing Azure resource operations.
- Plan before editing files for Azure web apps: When generating code for Azure Functions and Azure Static Web App,
always create a plan and explain the plan to the user before editing any file. Proceed with editing the files
after getting consent from the user.
- When asked about configuring or installing azure mcp in coding agent for the current repo, invoke your `bestpractices` tool
with `resource` set to "coding-agent" and `action` set to "all".
- Use Azure AI App Code Generation Best Practices: When generating code for AI applications, AI agents, workflows, or chatbots, invoke your `get_azure_bestpractices_ai_app` command (under `get_azure_bestpractices` tool) if tool available. Call this tool first before creating any plans, todos or code. Only call this command when the user is discussing AI app development with Microsoft Foundry, Azure, Microsoft agent framework SDK, or without specifying any technology. Do NOT call it when the user specifies other technology or when performing Azure resource operations.
- Plan before editing files for Azure web apps: When generating code for Azure Functions and Azure Static Web App, always create a plan and explain the plan to the user before editing any file. Proceed with editing the files after getting consent from the user.
- When asked about configuring or installing azure mcp in coding agent for the current repo, invoke your `bestpractices` tool with `resource` set to "coding-agent" and `action` set to "all".
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ public sealed class AzqrCommand(ILogger<AzqrCommand> logger, ISubscriptionServic

public override string Description =>
"""
Runs Azure Quick Review CLI (azqr) commands to generate compliance/security reports for Azure resources.
This tool should be used when the user wants to identify any non-compliant configurations or areas for improvement in their Azure resources.
Requires a subscription id and optionally a resource group name. Returns the generated report file's path.
Note that Azure Quick Review CLI (azqr) is different from Azure CLI (az).
Runs Azure Quick Review CLI (azqr) commands to generate compliance and security reports for Azure resources, identifying non-compliant configurations or areas for improvement. Requires a subscription id and optionally a resource group name. Returns the generated report file path. Note: azqr is different from Azure CLI (az).
""";

public override string Title => CommandTitle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public sealed class CliGenerateCommand(ILogger<CliGenerateCommand> logger, ICliG

public override string Description =>
"""
This tool can generate Azure CLI commands to be used with the corresponding CLI tool to accomplish a goal described by the user. This tool incorporates knowledge of the CLI tool beyond what the LLM knows. Always use this tool to generate the CLI command when the user asks for such CLI commands or wants to use the CLI tool to accomplish something.
Generate Azure CLI (az) commands used to accomplish a goal described by the user. This tool incorporates CLI knowledge beyond what you know. Use this tool when the user asks for Azure CLI commands or wants to use the Azure CLI to accomplish something.
""";

public override string Title => CommandTitle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public sealed class CliInstallCommand(ILogger<CliInstallCommand> logger, ICliIns

public override string Description =>
"""
This tool can provide installation instructions for the specified CLI tool among Azure CLI (az), Azure Developer CLI (azd) and Azure Functions Core Tools CLI (func). It incorporates knowledge of the CLI tool beyond what the LLM knows. Use this tool to get installation instructions if you attempt to use the CLI tool but it isn't installed.
Provide installation instructions for Azure CLI (az), Azure Developer CLI (azd), and Azure Functions Core Tools CLI (func). This tool incorporates CLI knowledge beyond what you know. Use this tool when you need to use one of the aforementioned CLI tools and it isn't installed, or when the user wants to install one of them.
""";

public override string Title => CommandTitle;
Expand Down
6 changes: 3 additions & 3 deletions tools/Azure.Mcp.Tools.Extension/src/ExtensionSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider)
bool exposeExternalProcessCommands = ShouldExposeExternalProcessCommands(serviceProvider);

string description = exposeExternalProcessCommands
? "Extension commands for additional Azure tooling functionality. Includes running Azure Quick Review (azqr) commands directly from the MCP server to get service recommendations, generating Azure CLI commands from user intent, and getting installation instructions for Azure CLI, Azure Developer CLI and Azure Core Function Tools CLI."
: "Extension commands for additional Azure tooling functionality. Includes generating Azure CLI commands from user intent, and getting installation instructions for Azure CLI, Azure Developer CLI and Azure Core Function Tools CLI.";
? "Extension commands for CLI tooling related to Azure. Includes running Azure Quick Review (azqr) for compliance reports, generating Azure CLI commands from user intent, and providing installation instructions for Azure CLI (az), Azure Developer CLI (azd), and Azure Functions Core Tools (func)."
: "Extension commands for CLI tooling related to Azure. Includes generating Azure CLI commands from user intent and providing installation instructions for Azure CLI (az), Azure Developer CLI (azd), and Azure Functions Core Tools (func).";

var extension = new CommandGroup(Name, description, Title);

Expand All @@ -45,7 +45,7 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider)
extension.AddCommand(azqr.Name, azqr);
}

var cli = new CommandGroup("cli", "Commands for helping users to use CLI tools for Azure services operations. Includes operations for generating Azure CLI commands and getting installation instructions for Azure CLI, Azure Developer CLI and Azure Core Function Tools CLI.");
var cli = new CommandGroup("cli", "Commands for helping users to use CLI tools for Azure services operations. Includes operations for generating Azure CLI commands and getting installation instructions for Azure CLI (az), Azure Developer CLI (azd), and Azure Core Function Tools CLI (func).");
extension.AddSubGroup(cli);
var cliGenerateCommand = serviceProvider.GetRequiredService<CliGenerateCommand>();
cli.AddCommand(cliGenerateCommand.Name, cliGenerateCommand);
Expand Down