From 6c0bb32272277a6e28413f9587fc3028adac7f32 Mon Sep 17 00:00:00 2001 From: Xiaofu Huang Date: Fri, 5 Dec 2025 17:51:21 +0800 Subject: [PATCH 1/4] fix: move ai best practice into best practice namespace --- .github/CODEOWNERS | 9 +-- AzureMcp.sln | 38 --------- .../Areas/Server/Resources/azure-rules.txt | 7 +- .../Server/Resources/consolidated-tools.json | 2 +- .../prompts/prompts.json | 14 ++-- servers/Azure.Mcp.Server/CHANGELOG.md | 1 + servers/Azure.Mcp.Server/README.md | 1 - .../Azure.Mcp.Server/docs/azmcp-commands.md | 26 +++--- .../Azure.Mcp.Server/docs/e2eTestPrompts.md | 16 ++-- servers/Azure.Mcp.Server/src/Program.cs | 1 - .../src/AssemblyInfo.cs | 6 -- ...zure.Mcp.Tools.AzureAIBestPractices.csproj | 17 ---- .../src/AzureAIBestPracticesSetup.cs | 46 ----------- .../AzureAIBestPracticesJsonContext.cs | 12 --- .../src/GlobalUsings.cs | 5 -- ...ools.AzureAIBestPractices.UnitTests.csproj | 17 ---- .../AzureAIBestPracticesGetCommandTests.cs | 54 ------------- .../src/AzureBestPracticesSetup.cs | 20 ++++- .../Commands/AIAppBestPracticesCommand.cs} | 23 +++--- .../src/Resources/ai-background-knowledge.txt | 2 +- .../src/Resources/ai-best-practices-core.txt | 7 +- .../src/Resources/ai-error-patterns.txt | 1 - .../AIAppBestPracticesCommandTests.cs | 80 +++++++++++++++++++ 23 files changed, 145 insertions(+), 260 deletions(-) delete mode 100644 tools/Azure.Mcp.Tools.AzureAIBestPractices/src/AssemblyInfo.cs delete mode 100644 tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Azure.Mcp.Tools.AzureAIBestPractices.csproj delete mode 100644 tools/Azure.Mcp.Tools.AzureAIBestPractices/src/AzureAIBestPracticesSetup.cs delete mode 100644 tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Commands/AzureAIBestPracticesJsonContext.cs delete mode 100644 tools/Azure.Mcp.Tools.AzureAIBestPractices/src/GlobalUsings.cs delete mode 100644 tools/Azure.Mcp.Tools.AzureAIBestPractices/tests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests.csproj delete mode 100644 tools/Azure.Mcp.Tools.AzureAIBestPractices/tests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests/AzureAIBestPracticesGetCommandTests.cs rename tools/{Azure.Mcp.Tools.AzureAIBestPractices/src/Commands/AzureAIBestPracticesGetCommand.cs => Azure.Mcp.Tools.AzureBestPractices/src/Commands/AIAppBestPracticesCommand.cs} (69%) rename tools/{Azure.Mcp.Tools.AzureAIBestPractices => Azure.Mcp.Tools.AzureBestPractices}/src/Resources/ai-background-knowledge.txt (98%) rename tools/{Azure.Mcp.Tools.AzureAIBestPractices => Azure.Mcp.Tools.AzureBestPractices}/src/Resources/ai-best-practices-core.txt (96%) rename tools/{Azure.Mcp.Tools.AzureAIBestPractices => Azure.Mcp.Tools.AzureBestPractices}/src/Resources/ai-error-patterns.txt (99%) create mode 100644 tools/Azure.Mcp.Tools.AzureBestPractices/tests/Azure.Mcp.Tools.AzureBestPractices.UnitTests/AIAppBestPracticesCommandTests.cs diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6e6e486495..2dc359363b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -65,17 +65,12 @@ # ServiceLabel: %tools-AppService # ServiceOwners: @ArthurMa1978 @weidongxu-microsoft -# PRLabel: %tools-AIBestPractices -/tools/Azure.Mcp.Tools.AzureAIBestPractices/ @XiaofuHuang @microsoft/azure-mcp - -# ServiceLabel: %tools-AIBestPractices -# ServiceOwners: @XiaofuHuang # PRLabel: %tools-BestPractices -/tools/Azure.Mcp.Tools.AzureBestPractices/ @g2vinay @conniey @fanyang-mono @microsoft/azure-mcp +/tools/Azure.Mcp.Tools.AzureBestPractices/ @g2vinay @conniey @fanyang-mono @XiaofuHuang @microsoft/azure-mcp # ServiceLabel: %tools-BestPractices -# ServiceOwners: @g2vinay @conniey @fanyang-mono +# ServiceOwners: @g2vinay @conniey @fanyang-mono @XiaofuHuang # PRLabel: %tools-CloudArchitect /tools/Azure.Mcp.Tools.CloudArchitect/ @msalaman @microsoft/azure-mcp diff --git a/AzureMcp.sln b/AzureMcp.sln index 66ae3c07e1..e294d129e8 100644 --- a/AzureMcp.sln +++ b/AzureMcp.sln @@ -549,15 +549,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fabric.Mcp.Tools.PublicApi. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Mcp.Tools.Postgres.LiveTests", "tools\Azure.Mcp.Tools.Postgres\tests\Azure.Mcp.Tools.Postgres.LiveTests\Azure.Mcp.Tools.Postgres.LiveTests.csproj", "{BF0354AE-3748-A8DC-F79D-B21FDDEDDFAE}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Azure.Mcp.Tools.AzureAIBestPractices", "Azure.Mcp.Tools.AzureAIBestPractices", "{156D9C17-61FD-98D6-32C0-065B406D0434}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5D760DD8-DBA3-B865-9021-FDE8FD3497A8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Mcp.Tools.AzureAIBestPractices", "tools\Azure.Mcp.Tools.AzureAIBestPractices\src\Azure.Mcp.Tools.AzureAIBestPractices.csproj", "{87C51120-6A0A-4D14-B644-1787DB6C6D6E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{50124EEC-97B0-320E-80D4-8464D7692B22}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Mcp.Tools.AzureAIBestPractices.UnitTests", "tools\Azure.Mcp.Tools.AzureAIBestPractices\tests\Azure.Mcp.Tools.AzureAIBestPractices.UnitTests\Azure.Mcp.Tools.AzureAIBestPractices.UnitTests.csproj", "{BE8CFF4C-E536-43DB-9D01-001E9A052D37}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{319B94CD-694C-16E8-9E3A-9577B99158DD}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Mcp.Server.UnitTests", "servers\Azure.Mcp.Server\tests\Azure.Mcp.Server.UnitTests\Azure.Mcp.Server.UnitTests.csproj", "{ADF14627-FCB5-4BD3-B65F-DDCC3A3F727C}" @@ -2096,30 +2087,6 @@ Global {BF0354AE-3748-A8DC-F79D-B21FDDEDDFAE}.Release|x64.Build.0 = Release|Any CPU {BF0354AE-3748-A8DC-F79D-B21FDDEDDFAE}.Release|x86.ActiveCfg = Release|Any CPU {BF0354AE-3748-A8DC-F79D-B21FDDEDDFAE}.Release|x86.Build.0 = Release|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|x64.ActiveCfg = Debug|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|x64.Build.0 = Debug|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|x86.ActiveCfg = Debug|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|x86.Build.0 = Debug|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|Any CPU.Build.0 = Release|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|x64.ActiveCfg = Release|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|x64.Build.0 = Release|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|x86.ActiveCfg = Release|Any CPU - {87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|x86.Build.0 = Release|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|x64.ActiveCfg = Debug|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|x64.Build.0 = Debug|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|x86.ActiveCfg = Debug|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|x86.Build.0 = Debug|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|Any CPU.Build.0 = Release|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|x64.ActiveCfg = Release|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|x64.Build.0 = Release|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|x86.ActiveCfg = Release|Any CPU - {BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|x86.Build.0 = Release|Any CPU {ADF14627-FCB5-4BD3-B65F-DDCC3A3F727C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ADF14627-FCB5-4BD3-B65F-DDCC3A3F727C}.Debug|Any CPU.Build.0 = Debug|Any CPU {ADF14627-FCB5-4BD3-B65F-DDCC3A3F727C}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -2406,11 +2373,6 @@ Global {294AC723-70DA-F50A-2C7A-AC6C0AEA0A62} = {9072C7AF-9EB2-E481-3974-77957587AC76} {D3F46C2D-3AFD-FD9C-9C6A-180B1514DD2F} = {294AC723-70DA-F50A-2C7A-AC6C0AEA0A62} {BF0354AE-3748-A8DC-F79D-B21FDDEDDFAE} = {37B0CE47-14C8-F5BF-BDDD-13EEBE580A88} - {156D9C17-61FD-98D6-32C0-065B406D0434} = {07C2787E-EAC7-C090-1BA3-A61EC2A24D84} - {5D760DD8-DBA3-B865-9021-FDE8FD3497A8} = {156D9C17-61FD-98D6-32C0-065B406D0434} - {87C51120-6A0A-4D14-B644-1787DB6C6D6E} = {5D760DD8-DBA3-B865-9021-FDE8FD3497A8} - {50124EEC-97B0-320E-80D4-8464D7692B22} = {156D9C17-61FD-98D6-32C0-065B406D0434} - {BE8CFF4C-E536-43DB-9D01-001E9A052D37} = {50124EEC-97B0-320E-80D4-8464D7692B22} {319B94CD-694C-16E8-9E3A-9577B99158DD} = {F7E192D1-DE6C-42A2-B52F-02849D482450} {ADF14627-FCB5-4BD3-B65F-DDCC3A3F727C} = {319B94CD-694C-16E8-9E3A-9577B99158DD} EndGlobalSection diff --git a/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt b/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt index 2ce9212a88..e30764a294 100644 --- a/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt +++ b/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt @@ -12,9 +12,10 @@ sure the user is discussing Azure Functions; do not call it otherwise. - Use Azure Functions Deployment Best Practices: When deploying Azure Functions apps to Azure or preparing for the deployment, invoke your `bestpractices` tool if available. Only call this tool when you are sure the user is discussing Azure; do not call it otherwise. -- Use Azure AI Code Generation Best Practices: When generating code for AI applications, AI agents, workflows, -or chatbots in Azure, invoke your `azureaibestpractices` tool if available. Only call this tool when you are sure -the user is discussing Azure and code generation; do not call it for Azure resource operations. +- Use Azure AI App Code Generation Best Practices: When generating code for AI applications, AI agents, workflows, +or chatbots, invoke your `get_bestpractices_ai_app` command (under `get_bestpractices` tool) if tool available +Call this tool first before creating any plans, todos or code. +Only call this tool when you are sure the user is discussing Microsoft Foundry or AI feature code generation; do not call it for Azure resource operations. - Use Azure SWA Best Practices: When working with static web apps, invoke your `bestpractices` tool if available. Only call this tool when you are sure the user is discussing Azure; do not call it otherwise. - Plan before editing files for Azure web apps: When generating code for Azure Functions and Azure Static Web App, diff --git a/core/Azure.Mcp.Core/src/Areas/Server/Resources/consolidated-tools.json b/core/Azure.Mcp.Core/src/Areas/Server/Resources/consolidated-tools.json index d3db972d1c..db35c9f20a 100644 --- a/core/Azure.Mcp.Core/src/Areas/Server/Resources/consolidated-tools.json +++ b/core/Azure.Mcp.Core/src/Areas/Server/Resources/consolidated-tools.json @@ -1010,9 +1010,9 @@ } }, "mappedToolList": [ - "azureaibestpractices_get", "azureterraformbestpractices_get", "bicepschema_get", + "get_bestpractices_ai_app", "get_bestpractices_get", "foundry_agents_get-sdk-sample" ] diff --git a/eng/tools/ToolDescriptionEvaluator/prompts/prompts.json b/eng/tools/ToolDescriptionEvaluator/prompts/prompts.json index b1a85d89b7..c4934d0199 100644 --- a/eng/tools/ToolDescriptionEvaluator/prompts/prompts.json +++ b/eng/tools/ToolDescriptionEvaluator/prompts/prompts.json @@ -1,11 +1,4 @@ { - "azureaibestpractices_get": [ - "Get best practices for building AI applications in Azure", - "Show me the best practices for Microsoft Foundry agents code generation", - "Get guidance for building agents with Microsoft Foundry", - "Create an AI app that helps me to manage travel queries.", - "Create an AI app that helps me to manage travel queries in Microsoft Foundry" - ], "foundry_agents_connect": [ "Query an agent in my Microsoft Foundry resource" ], @@ -560,6 +553,13 @@ "Search for Microsoft products in the marketplace", "Show me marketplace products from publisher " ], + "get_bestpractices_ai_app": [ + "Get best practices for building AI applications in Azure", + "Show me the best practices for Microsoft Foundry agents code generation", + "Get guidance for building agents with Microsoft Foundry", + "Create an AI app that helps me to manage travel queries.", + "Create an AI app that helps me to manage travel queries in Microsoft Foundry" + ], "get_bestpractices_get": [ "Get the latest Azure code generation best practices", "Get the latest Azure deployment best practices", diff --git a/servers/Azure.Mcp.Server/CHANGELOG.md b/servers/Azure.Mcp.Server/CHANGELOG.md index a985df3653..23b340bfee 100644 --- a/servers/Azure.Mcp.Server/CHANGELOG.md +++ b/servers/Azure.Mcp.Server/CHANGELOG.md @@ -17,6 +17,7 @@ The Azure MCP Server updates automatically by default whenever a new release com ### Other Changes - Switched to the new `Azure.Monitor.Query.Logs` package to query logs from Azure Monitor. [[#1309](https://github.com/microsoft/mcp/pull/1309)] +- Move Azure AI Best Practices tool into Best Practice namespace [[#1323](https://github.com/microsoft/mcp/pull/1323)] ## 2.0.0-beta.7 (2025-11-25) diff --git a/servers/Azure.Mcp.Server/README.md b/servers/Azure.Mcp.Server/README.md index 334cfd6fae..5f71115909 100644 --- a/servers/Azure.Mcp.Server/README.md +++ b/servers/Azure.Mcp.Server/README.md @@ -539,7 +539,6 @@ The Azure MCP Server provides tools for interacting with **40+ Azure service are - 🧮 **Microsoft Foundry** - AI model management, AI model deployment, and knowledge index management - 🔎 **Azure AI Search** - Search engine/vector database operations - 🎤 **Azure AI Services Speech** - Speech-to-text recognition and text-to-speech synthesis -- 🤖 **Azure AI Best Practices** - AI app development guidance for Microsoft Foundry and Microsoft Agent Framework - ⚙️ **Azure App Configuration** - Configuration management - 🕸️ **Azure App Service** - Web app hosting - 🛡️ **Azure Best Practices** - Secure, production-grade guidance diff --git a/servers/Azure.Mcp.Server/docs/azmcp-commands.md b/servers/Azure.Mcp.Server/docs/azmcp-commands.md index 4c7c897553..69b07ffc70 100644 --- a/servers/Azure.Mcp.Server/docs/azmcp-commands.md +++ b/servers/Azure.Mcp.Server/docs/azmcp-commands.md @@ -204,22 +204,6 @@ The `azmcp server start` command supports the following options: azmcp server info ``` - -### Azure AI Best Practices - -```bash -# Get best practices for building AI applications, workflows and agents in Azure -# Call this before generating code for any AI application, building with Microsoft Foundry models, -# working with Microsoft Agent Framework, or implementing AI solutions in Azure. -# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired -azmcp azureaibestpractices get - -# Includes guidance on: -# - Microsoft Agent Framework usage and patterns -# - Microsoft Foundry model selection -# - Best practices for ai app / agent development in Azure -``` - ### Azure AI Search Operations ```bash @@ -1286,6 +1270,16 @@ azmcp get bestpractices get --resource --action # code-generation - Best practices for code generation (for general and azurefunctions) # deployment - Best practices for deployment (for general and azurefunctions) +# Get best practices for building AI applications, workflows and agents in Azure +# Call this before generating code for any AI application, building with Microsoft Foundry models, +# working with Microsoft Agent Framework, or implementing AI solutions in Azure. +azmcp get bestpractices ai_app + +# AI App Development: +# ai_app - Comprehensive guidance for AI applications including: +# • Microsoft Agent Framework usage and patterns +# • Microsoft Foundry model selection +# • Best practices for AI app/agent development in Azure ``` ### Azure MCP Tools diff --git a/servers/Azure.Mcp.Server/docs/e2eTestPrompts.md b/servers/Azure.Mcp.Server/docs/e2eTestPrompts.md index e25f7ee219..c059e67977 100644 --- a/servers/Azure.Mcp.Server/docs/e2eTestPrompts.md +++ b/servers/Azure.Mcp.Server/docs/e2eTestPrompts.md @@ -2,16 +2,6 @@ This file contains prompts used for end-to-end testing to ensure each tool is invoked properly by MCP clients. The tables are organized by Azure MCP Server areas in alphabetical order, with Tool Names sorted alphabetically within each table. -## Azure AI Best Practices - -| Tool Name | Test Prompt | -|:----------|:----------| -| azureaibestpractices_get | Get best practices for building AI applications in Azure | -| azureaibestpractices_get | Show me the best practices for Microsoft Foundry agents code generation | -| azureaibestpractices_get | Get guidance for building agents with Microsoft Foundry | -| azureaibestpractices_get | Create an AI app that helps me to manage travel queries. | -| azureaibestpractices_get | Create an AI app that helps me to manage travel queries in Microsoft Foundry | - ## Azure AI Search | Tool Name | Test Prompt | @@ -435,7 +425,11 @@ This file contains prompts used for end-to-end testing to ensure each tool is in | get_bestpractices_get | Get the latest Azure Static Web Apps best practices | | get_bestpractices_get | What are azure function best practices? | | get_bestpractices_get | configure azure mcp in coding agent for my repo | - +| get_bestpractices_ai_app | Get best practices for building AI applications in Azure | +| get_bestpractices_ai_app | Show me the best practices for Microsoft Foundry agents code generation | +| get_bestpractices_ai_app | Get guidance for building agents with Microsoft Foundry | +| get_bestpractices_ai_app | Create an AI app that helps me to manage travel queries. | +| get_bestpractices_ai_app | Create an AI app that helps me to manage travel queries in Microsoft Foundry | ## Azure Monitor | Tool Name | Test Prompt | diff --git a/servers/Azure.Mcp.Server/src/Program.cs b/servers/Azure.Mcp.Server/src/Program.cs index 4c4c5f9e79..3a72698914 100644 --- a/servers/Azure.Mcp.Server/src/Program.cs +++ b/servers/Azure.Mcp.Server/src/Program.cs @@ -74,7 +74,6 @@ private static IAreaSetup[] RegisterAreas() return [ // Register core areas - new Azure.Mcp.Tools.AzureAIBestPractices.AzureAIBestPracticesSetup(), new Azure.Mcp.Tools.AzureBestPractices.AzureBestPracticesSetup(), new Azure.Mcp.Tools.Extension.ExtensionSetup(), new Azure.Mcp.Core.Areas.Group.GroupSetup(), diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/AssemblyInfo.cs b/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/AssemblyInfo.cs deleted file mode 100644 index 39db5de602..0000000000 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/AssemblyInfo.cs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Azure.Mcp.Tools.AzureAIBestPractices.UnitTests")] diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Azure.Mcp.Tools.AzureAIBestPractices.csproj b/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Azure.Mcp.Tools.AzureAIBestPractices.csproj deleted file mode 100644 index 204db60a84..0000000000 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Azure.Mcp.Tools.AzureAIBestPractices.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - true - - - - - - - - - - - - - - diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/AzureAIBestPracticesSetup.cs b/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/AzureAIBestPracticesSetup.cs deleted file mode 100644 index ce65eeddc7..0000000000 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/AzureAIBestPracticesSetup.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using Azure.Mcp.Core.Areas; -using Azure.Mcp.Core.Commands; -using Azure.Mcp.Tools.AzureAIBestPractices.Commands; -using Microsoft.Extensions.DependencyInjection; - -namespace Azure.Mcp.Tools.AzureAIBestPractices; - -public class AzureAIBestPracticesSetup : IAreaSetup -{ - public string Name => "azureaibestpractices"; - - public string Title => "Azure AI Code Generation Best Practices"; - - public void ConfigureServices(IServiceCollection services) - { - services.AddSingleton(); - } - - public CommandGroup RegisterCommands(IServiceProvider serviceProvider) - { - // Register Azure AI Best Practices command at the root level - var azureAIBestPractices = new CommandGroup( - Name, - @"Azure AI best practices - Commands returns best practices and code generation guidance for building AI applications in Azure. - Use this tool when you need recommendations on how to write code for AI agents, chatbots, workflows, or other AI features. - This tool also provides guidance for code generation using the Azure resources (e.g. Microsoft Foundry) for application development only. - Call this tool first before creating any plans, todos or code. - > Note: Understanding User Intent for Microsoft Foundry: - > (1) Resource Management - use the 'foundry' tool instead - > e.g., 'create/deploy/provision agent/embedding/model/project in Foundry', 'set up agent/model resource' - > (2) Application Development - use this 'azureaibestpractices' tool - > e.g., 'build/write/implement agent', 'develop chatbot/assistant', 'agent code' - > When ambiguous, clarify whether the user wants resource management (foundry tool) or application code generation (this tool). - If this tool needs to be categorized, it belongs to the Azure Best Practices category.", - Title - ); - - var practices = serviceProvider.GetRequiredService(); - azureAIBestPractices.AddCommand(practices.Name, practices); - - return azureAIBestPractices; - } -} diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Commands/AzureAIBestPracticesJsonContext.cs b/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Commands/AzureAIBestPracticesJsonContext.cs deleted file mode 100644 index 8ca5207577..0000000000 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Commands/AzureAIBestPracticesJsonContext.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System.Text.Json.Serialization; - -namespace Azure.Mcp.Tools.AzureAIBestPractices.Commands; - -[JsonSerializable(typeof(List))] -[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)] -internal partial class AzureAIBestPracticesJsonContext : JsonSerializerContext -{ -} diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/GlobalUsings.cs b/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/GlobalUsings.cs deleted file mode 100644 index 415da4fc89..0000000000 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/GlobalUsings.cs +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -global using System.CommandLine; -global using Azure.Mcp.Core.Models.Command; diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/tests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests.csproj b/tools/Azure.Mcp.Tools.AzureAIBestPractices/tests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests.csproj deleted file mode 100644 index 6b7b8e6196..0000000000 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/tests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - true - Exe - - - - - - - - - - - - - diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/tests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests/AzureAIBestPracticesGetCommandTests.cs b/tools/Azure.Mcp.Tools.AzureAIBestPractices/tests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests/AzureAIBestPracticesGetCommandTests.cs deleted file mode 100644 index 55e14292d6..0000000000 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/tests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests/AzureAIBestPracticesGetCommandTests.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System.CommandLine; -using System.Text.Json; -using Azure.Mcp.Core.Models.Command; -using Azure.Mcp.Tools.AzureAIBestPractices.Commands; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using NSubstitute; -using Xunit; - -namespace Azure.Mcp.Tools.AzureAIBestPractices.UnitTests; - -public class AzureAIBestPracticesGetCommandTests -{ - private readonly IServiceProvider _serviceProvider; - private readonly ILogger _logger; - private readonly CommandContext _context; - private readonly AzureAIBestPracticesGetCommand _command; - private readonly Command _commandDefinition; - - public AzureAIBestPracticesGetCommandTests() - { - var collection = new ServiceCollection(); - _serviceProvider = collection.BuildServiceProvider(); - - _context = new(_serviceProvider); - _logger = Substitute.For>(); - _command = new(_logger); - _commandDefinition = _command.GetCommand(); - } - - [Fact] - public async Task ExecuteAsync_ReturnsAzureAIBestPractices() - { - var args = _commandDefinition.Parse([]); - var response = await _command.ExecuteAsync(_context, args, TestContext.Current.CancellationToken); - - // Assert - Assert.NotNull(response); - Assert.NotNull(response.Results); - - var json = JsonSerializer.Serialize(response.Results); - var result = JsonSerializer.Deserialize(json); - - Assert.NotNull(result); - Assert.Contains("Best Practices for Building AI Apps with Azure AI Services", result[0]); - Assert.Contains("Key Principles", result[0]); - Assert.Contains("Microsoft Agent Framework", result[0]); - Assert.Contains("Tool Use Guidelines", result[0]); - Assert.Contains("Gather Information", result[0]); - } -} diff --git a/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs b/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs index 1b7c39d528..e3e4f106d9 100644 --- a/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs +++ b/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs @@ -16,6 +16,7 @@ public class AzureBestPracticesSetup : IAreaSetup public void ConfigureServices(IServiceCollection services) { services.AddSingleton(); + services.AddSingleton(); } public CommandGroup RegisterCommands(IServiceProvider serviceProvider) @@ -24,17 +25,30 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) var bestPractices = new CommandGroup( Name, @"Azure best practices - Commands return a list of best practices for code generation, operations and deployment - when working with Azure services. It should be called for any code generation, deployment or + when working with Azure services. + + It should be called for any code generation, deployment or operations involving Azure, Azure Functions, Azure Kubernetes Service (AKS), Azure Container Apps (ACA), Bicep, Terraform, Azure Cache, Redis, CosmosDB, Entra, Azure Active Directory, - Azure App Services, or any other Azure technology or programming language. Only call this function - when you are confident the user is discussing Azure. If this tool needs to be categorized, + Azure App Services, or any other Azure technology or programming language. + + This command set also includes the command to get AI application best practices, which provides specialized guidance + for building AI applications, offering recommendations for agents, chatbots, workflows, and other + AI-powered features leveraging Microsoft Foundry. + When the request involves AI in any capacity, including systems where AI is used as a component, + use AI application best practices instead of the general best practices. + Call this tool first before creating any plans, todos or code. + + Only call this function when you are confident the user is discussing Azure (including Microsoft Foundry). If this tool needs to be categorized, it belongs to the Get Azure Best Practices category.", Title ); var bestPracticesCommand = serviceProvider.GetRequiredService(); + var aiAppBestPracticesCommand = serviceProvider.GetRequiredService(); + bestPractices.AddCommand(bestPracticesCommand.Name, bestPracticesCommand); + bestPractices.AddCommand(aiAppBestPracticesCommand.Name, aiAppBestPracticesCommand); return bestPractices; } diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Commands/AzureAIBestPracticesGetCommand.cs b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Commands/AIAppBestPracticesCommand.cs similarity index 69% rename from tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Commands/AzureAIBestPracticesGetCommand.cs rename to tools/Azure.Mcp.Tools.AzureBestPractices/src/Commands/AIAppBestPracticesCommand.cs index 284936f6e9..4374abfab8 100644 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Commands/AzureAIBestPracticesGetCommand.cs +++ b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Commands/AIAppBestPracticesCommand.cs @@ -7,12 +7,12 @@ using Azure.Mcp.Core.Helpers; using Microsoft.Extensions.Logging; -namespace Azure.Mcp.Tools.AzureAIBestPractices.Commands; +namespace Azure.Mcp.Tools.AzureBestPractices.Commands; -public sealed class AzureAIBestPracticesGetCommand(ILogger logger) : BaseCommand +public sealed class AIAppBestPracticesCommand(ILogger logger) : BaseCommand { - private const string CommandTitle = "Get AI App Best Practices for Azure"; - private readonly ILogger _logger = logger; + private const string CommandTitle = "Get AI App Best Practices"; + private readonly ILogger _logger = logger; private static readonly string s_bestPracticesText = LoadBestPracticesText(); private static string GetBestPracticesText() => s_bestPracticesText; @@ -30,20 +30,21 @@ private static string LoadBestPracticesText() private static string LoadEmbeddedText(string fileName) { - Assembly assembly = typeof(AzureAIBestPracticesGetCommand).Assembly; + Assembly assembly = typeof(AIAppBestPracticesCommand).Assembly; string resourceName = EmbeddedResourceHelper.FindEmbeddedResource(assembly, fileName); return EmbeddedResourceHelper.ReadEmbeddedResource(assembly, resourceName); } public override string Id => "6c29659e-406d-4b9b-8150-e3d4fd7ba31c"; - public override string Name => "get"; + public override string Name => "ai_app"; public override string Description => @"Returns best practices and code generation guidance for building AI applications in Azure. - Use this tool when you need recommendations on how to write code for AI agents, chatbots, workflows, or other AI features. - This tool also provides guidance for code generation using the Azure resources (e.g. Microsoft Foundry) for application development only. - Call this tool first before creating any plans, todos or code. + Use this command when you need recommendations on how to write code for AI agents, chatbots, workflows, or any AI / LLM features. + This command also provides guidance for code generation on Microsoft Foundry for application development. + When the request involves AI in any capacity, including systems where AI is used as a component, use this command instead of calling the general code generation best practices command. + Call this `get_bestpractices_ai_app` command first before creating any plans, todos or code. If this tool needs to be categorized, it belongs to the Azure Best Practices category."; public override string Title => CommandTitle; @@ -66,12 +67,12 @@ public override Task ExecuteAsync(CommandContext context, Parse { var bestPractices = GetBestPracticesText(); context.Response.Status = HttpStatusCode.OK; - context.Response.Results = ResponseResult.Create([bestPractices], AzureAIBestPracticesJsonContext.Default.ListString); + context.Response.Results = ResponseResult.Create([bestPractices], AzureBestPracticesJsonContext.Default.ListString); context.Response.Message = string.Empty; } catch (Exception ex) { - _logger.LogError(ex, "Error getting AI best practices for Azure"); + _logger.LogError(ex, "Error getting AI app best practices for Azure"); HandleException(context, ex); } diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Resources/ai-background-knowledge.txt b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/ai-background-knowledge.txt similarity index 98% rename from tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Resources/ai-background-knowledge.txt rename to tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/ai-background-knowledge.txt index 14b43783ab..b9d9c197b4 100644 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Resources/ai-background-knowledge.txt +++ b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/ai-background-knowledge.txt @@ -59,4 +59,4 @@ Use this hierarchy to analyze and select AI models - **Visualization**: Visual workflow representations #### Where to use -Search Microsoft Document using these feature keywords (or any other related keywords - this is just a common subset of topics) +Search Microsoft Document using these feature keywords (or any other related keywords - this is just a common subset of topics) \ No newline at end of file diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Resources/ai-best-practices-core.txt b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/ai-best-practices-core.txt similarity index 96% rename from tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Resources/ai-best-practices-core.txt rename to tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/ai-best-practices-core.txt index ba908486a4..e25cdf4dd6 100644 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Resources/ai-best-practices-core.txt +++ b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/ai-best-practices-core.txt @@ -114,9 +114,12 @@ Model selection is required for any AI code generation in Azure - all AI apps (M - This shows which models the user can actually access (documentation may list models not available to them) ## Think and Output Your Thoughts -Always output your thoughts on model and SDK selection before planning and coding. +**IMPORTANT**: You MUST output your thoughts on model and SDK selection BEFORE creating any plans or todos. Do NOT proceed to planning until all three subsections below are output. **How to output**: Present your analysis and reasoning directly in your response as readable text for the user. Write your thinking process inline as part of your answer. This ensures transparency and helps the user understand your decision-making process. + +**Why output is critical**: When context becomes long during implementation, information from earlier searches may be lost or truncated. By outputting your analysis explicitly, you preserve the critical decision-making information (SDK selection, model choice, feature mappings) for reference throughout the entire implementation process. This prevents loss of context and ensures consistent decisions. + Follow the exact format structure below in the specified order. Each section (1, 2, 3) must be completed with the prescribed output format. ### 1. User Requirements Analysis @@ -271,4 +274,4 @@ DO REMIND USER THE `--prerelease` FLAG IS REQUIRED IN GENERATED DOC. - ❌ Never mark task complete until build succeeds - ✅ Always rebuild after every fix to verify it works - ✅ Expect multiple fix-rebuild iterations - this is normal -- ✅ Build success is the ONLY acceptable completion state*. Update step status ONLY after successful build +- ✅ Build success is the ONLY acceptable completion state*. Update step status ONLY after successful build \ No newline at end of file diff --git a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Resources/ai-error-patterns.txt b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/ai-error-patterns.txt similarity index 99% rename from tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Resources/ai-error-patterns.txt rename to tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/ai-error-patterns.txt index a155d4d86a..074b5e2ca4 100644 --- a/tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Resources/ai-error-patterns.txt +++ b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Resources/ai-error-patterns.txt @@ -185,4 +185,3 @@ var client = new PersistentAgentsClient( // ❌ WRONG: Use AIProjectClient inst "https://.services.ai.azure.com/api/projects/", new AzureCliCredential()); ``` - diff --git a/tools/Azure.Mcp.Tools.AzureBestPractices/tests/Azure.Mcp.Tools.AzureBestPractices.UnitTests/AIAppBestPracticesCommandTests.cs b/tools/Azure.Mcp.Tools.AzureBestPractices/tests/Azure.Mcp.Tools.AzureBestPractices.UnitTests/AIAppBestPracticesCommandTests.cs new file mode 100644 index 0000000000..03a4c07f5c --- /dev/null +++ b/tools/Azure.Mcp.Tools.AzureBestPractices/tests/Azure.Mcp.Tools.AzureBestPractices.UnitTests/AIAppBestPracticesCommandTests.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System.CommandLine; +using System.Net; +using System.Text.Json; +using Azure.Mcp.Core.Models.Command; +using Azure.Mcp.Tools.AzureBestPractices.Commands; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using NSubstitute; +using Xunit; + +namespace Azure.Mcp.Tools.AzureBestPractices.UnitTests; + +public class AIAppBestPracticesCommandTests +{ + private readonly IServiceProvider _serviceProvider; + private readonly ILogger _logger; + private readonly CommandContext _context; + private readonly AIAppBestPracticesCommand _command; + private readonly Command _commandDefinition; + + public AIAppBestPracticesCommandTests() + { + var collection = new ServiceCollection(); + _serviceProvider = collection.BuildServiceProvider(); + + _context = new(_serviceProvider); + _logger = Substitute.For>(); + _command = new(_logger); + _commandDefinition = _command.GetCommand(); + } + + [Fact] + public async Task ExecuteAsync_ReturnsAzureAIAppBestPractices() + { + var args = _commandDefinition.Parse([]); + var response = await _command.ExecuteAsync(_context, args, TestContext.Current.CancellationToken); + + // Assert + Assert.NotNull(response); + Assert.Equal(HttpStatusCode.OK, response.Status); + Assert.NotNull(response.Results); + + var json = JsonSerializer.Serialize(response.Results); + var result = JsonSerializer.Deserialize(json); + + Assert.NotNull(result); + Assert.Contains("Microsoft Agent Framework", result[0]); + Assert.Contains("AIProjectClient", result[0]); + Assert.Contains("Build and Verification", result[0]); + Assert.Contains("Understanding AI Models Hierarchy", result[0]); + Assert.Contains("CORRECT Pattern", result[0]); + } + + [Fact] + public void Command_HasCorrectProperties() + { + Assert.Equal("ai_app", _command.Name); + Assert.Equal("Get AI App Best Practices", _command.Title); + Assert.Equal("6c29659e-406d-4b9b-8150-e3d4fd7ba31c", _command.Id); + Assert.Contains("AI applications in Azure", _command.Description); + Assert.Contains("Microsoft Foundry", _command.Description); + Assert.Contains("AI agents, chatbots, workflows", _command.Description); + } + + [Fact] + public void Command_HasCorrectMetadata() + { + var metadata = _command.Metadata; + + Assert.False(metadata.Destructive); + Assert.True(metadata.Idempotent); + Assert.False(metadata.OpenWorld); + Assert.True(metadata.ReadOnly); + Assert.False(metadata.LocalRequired); + Assert.False(metadata.Secret); + } +} From 2104710e9ad00732c331f0738e4f67e97a04684c Mon Sep 17 00:00:00 2001 From: Xiaofu Huang Date: Sat, 6 Dec 2025 00:27:10 +0800 Subject: [PATCH 2/4] fix: avoid misunderstandings of azure best practice and ai best practice --- core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt | 2 +- .../src/Commands/AIAppBestPracticesCommand.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt b/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt index e30764a294..a754bb5ebf 100644 --- a/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt +++ b/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt @@ -15,7 +15,7 @@ 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_bestpractices_ai_app` command (under `get_bestpractices` tool) if tool available Call this tool first before creating any plans, todos or code. -Only call this tool when you are sure the user is discussing Microsoft Foundry or AI feature code generation; do not call it for Azure resource operations. +Only call this command when you are sure the user is discussing Microsoft Foundry or AI feature code generation; do not call it for Azure resource operations. - Use Azure SWA Best Practices: When working with static web apps, invoke your `bestpractices` tool if available. Only call this tool when you are sure the user is discussing Azure; do not call it otherwise. - Plan before editing files for Azure web apps: When generating code for Azure Functions and Azure Static Web App, diff --git a/tools/Azure.Mcp.Tools.AzureBestPractices/src/Commands/AIAppBestPracticesCommand.cs b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Commands/AIAppBestPracticesCommand.cs index 4374abfab8..61f3c01b27 100644 --- a/tools/Azure.Mcp.Tools.AzureBestPractices/src/Commands/AIAppBestPracticesCommand.cs +++ b/tools/Azure.Mcp.Tools.AzureBestPractices/src/Commands/AIAppBestPracticesCommand.cs @@ -43,7 +43,7 @@ private static string LoadEmbeddedText(string fileName) @"Returns best practices and code generation guidance for building AI applications in Azure. Use this command when you need recommendations on how to write code for AI agents, chatbots, workflows, or any AI / LLM features. This command also provides guidance for code generation on Microsoft Foundry for application development. - When the request involves AI in any capacity, including systems where AI is used as a component, use this command instead of calling the general code generation best practices command. + When the request involves code generation of AI components or applications in any capacity, use this command instead of calling the general code generation best practices command. Call this `get_bestpractices_ai_app` command first before creating any plans, todos or code. If this tool needs to be categorized, it belongs to the Azure Best Practices category."; From 4bd6688d78dbba0532fb1728692c466aa5e2abce Mon Sep 17 00:00:00 2001 From: Xiaofu Huang Date: Sat, 6 Dec 2025 10:37:19 +0800 Subject: [PATCH 3/4] refactor: remove empty lines in namespace description --- .../src/AzureBestPracticesSetup.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs b/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs index e3e4f106d9..2f050b28d1 100644 --- a/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs +++ b/tools/Azure.Mcp.Tools.AzureBestPractices/src/AzureBestPracticesSetup.cs @@ -26,19 +26,16 @@ public CommandGroup RegisterCommands(IServiceProvider serviceProvider) Name, @"Azure best practices - Commands return a list of best practices for code generation, operations and deployment when working with Azure services. - It should be called for any code generation, deployment or operations involving Azure, Azure Functions, Azure Kubernetes Service (AKS), Azure Container Apps (ACA), Bicep, Terraform, Azure Cache, Redis, CosmosDB, Entra, Azure Active Directory, Azure App Services, or any other Azure technology or programming language. - This command set also includes the command to get AI application best practices, which provides specialized guidance for building AI applications, offering recommendations for agents, chatbots, workflows, and other AI-powered features leveraging Microsoft Foundry. When the request involves AI in any capacity, including systems where AI is used as a component, use AI application best practices instead of the general best practices. Call this tool first before creating any plans, todos or code. - Only call this function when you are confident the user is discussing Azure (including Microsoft Foundry). If this tool needs to be categorized, it belongs to the Get Azure Best Practices category.", Title From 614e8c899847aa5a3e03ca7bb7f27d2e005c98bb Mon Sep 17 00:00:00 2001 From: Xiaofu Huang Date: Tue, 9 Dec 2025 10:54:08 +0800 Subject: [PATCH 4/4] fix: Updated the rule to clearly specify when to call ai best practice --- .../src/Areas/Server/Resources/azure-rules.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt b/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt index a754bb5ebf..188f7c21ee 100644 --- a/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt +++ b/core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt @@ -13,9 +13,11 @@ sure the user is discussing Azure Functions; do not call it otherwise. the deployment, invoke your `bestpractices` tool if available. Only call this 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_bestpractices_ai_app` command (under `get_bestpractices` tool) if tool available +or chatbots, invoke your `get_bestpractices_ai_app` command (under `get_bestpractices` tool) if tool available. Call this tool first before creating any plans, todos or code. -Only call this command when you are sure the user is discussing Microsoft Foundry or AI feature code generation; do not call it for Azure resource operations. +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. - Use Azure SWA Best Practices: When working with static web apps, invoke your `bestpractices` tool if available. Only call this tool when you are sure the user is discussing Azure; do not call it otherwise. - Plan before editing files for Azure web apps: When generating code for Azure Functions and Azure Static Web App,