Skip to content

Commit fe6d600

Browse files
committed
feat: add agent code gen best practice into azure mcp
1 parent 51b9898 commit fe6d600

File tree

22 files changed

+3050
-2238
lines changed

22 files changed

+3050
-2238
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
# ServiceLabel: %tools-AppService
6666
# ServiceOwners: @ArthurMa1978 @weidongxu-microsoft
6767

68+
# PRLabel: %tools-AIBestPractices
69+
/tools/Azure.Mcp.Tools.AzureAIBestPractices/ @XiaofuHuang @microsoft/azure-mcp
70+
71+
# ServiceLabel: %tools-AIBestPractices
72+
# ServiceOwners: @XiaofuHuang
73+
6874
# PRLabel: %tools-BestPractices
6975
/tools/Azure.Mcp.Tools.AzureBestPractices/ @g2vinay @conniey @fanyang-mono @microsoft/azure-mcp
7076

AzureMcp.sln

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fabric.Mcp.Tools.PublicApi.
549549
EndProject
550550
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}"
551551
EndProject
552+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Azure.Mcp.Tools.AzureAIBestPractices", "Azure.Mcp.Tools.AzureAIBestPractices", "{156D9C17-61FD-98D6-32C0-065B406D0434}"
553+
EndProject
554+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5D760DD8-DBA3-B865-9021-FDE8FD3497A8}"
555+
EndProject
556+
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}"
557+
EndProject
558+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{50124EEC-97B0-320E-80D4-8464D7692B22}"
559+
EndProject
560+
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}"
552561
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{319B94CD-694C-16E8-9E3A-9577B99158DD}"
553562
EndProject
554563
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}"
@@ -2087,6 +2096,30 @@ Global
20872096
{BF0354AE-3748-A8DC-F79D-B21FDDEDDFAE}.Release|x64.Build.0 = Release|Any CPU
20882097
{BF0354AE-3748-A8DC-F79D-B21FDDEDDFAE}.Release|x86.ActiveCfg = Release|Any CPU
20892098
{BF0354AE-3748-A8DC-F79D-B21FDDEDDFAE}.Release|x86.Build.0 = Release|Any CPU
2099+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2100+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
2101+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|x64.ActiveCfg = Debug|Any CPU
2102+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|x64.Build.0 = Debug|Any CPU
2103+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|x86.ActiveCfg = Debug|Any CPU
2104+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Debug|x86.Build.0 = Debug|Any CPU
2105+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
2106+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|Any CPU.Build.0 = Release|Any CPU
2107+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|x64.ActiveCfg = Release|Any CPU
2108+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|x64.Build.0 = Release|Any CPU
2109+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|x86.ActiveCfg = Release|Any CPU
2110+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E}.Release|x86.Build.0 = Release|Any CPU
2111+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2112+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|Any CPU.Build.0 = Debug|Any CPU
2113+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|x64.ActiveCfg = Debug|Any CPU
2114+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|x64.Build.0 = Debug|Any CPU
2115+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|x86.ActiveCfg = Debug|Any CPU
2116+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Debug|x86.Build.0 = Debug|Any CPU
2117+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|Any CPU.ActiveCfg = Release|Any CPU
2118+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|Any CPU.Build.0 = Release|Any CPU
2119+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|x64.ActiveCfg = Release|Any CPU
2120+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|x64.Build.0 = Release|Any CPU
2121+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|x86.ActiveCfg = Release|Any CPU
2122+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37}.Release|x86.Build.0 = Release|Any CPU
20902123
{ADF14627-FCB5-4BD3-B65F-DDCC3A3F727C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20912124
{ADF14627-FCB5-4BD3-B65F-DDCC3A3F727C}.Debug|Any CPU.Build.0 = Debug|Any CPU
20922125
{ADF14627-FCB5-4BD3-B65F-DDCC3A3F727C}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -2373,6 +2406,11 @@ Global
23732406
{294AC723-70DA-F50A-2C7A-AC6C0AEA0A62} = {9072C7AF-9EB2-E481-3974-77957587AC76}
23742407
{D3F46C2D-3AFD-FD9C-9C6A-180B1514DD2F} = {294AC723-70DA-F50A-2C7A-AC6C0AEA0A62}
23752408
{BF0354AE-3748-A8DC-F79D-B21FDDEDDFAE} = {37B0CE47-14C8-F5BF-BDDD-13EEBE580A88}
2409+
{156D9C17-61FD-98D6-32C0-065B406D0434} = {07C2787E-EAC7-C090-1BA3-A61EC2A24D84}
2410+
{5D760DD8-DBA3-B865-9021-FDE8FD3497A8} = {156D9C17-61FD-98D6-32C0-065B406D0434}
2411+
{87C51120-6A0A-4D14-B644-1787DB6C6D6E} = {5D760DD8-DBA3-B865-9021-FDE8FD3497A8}
2412+
{50124EEC-97B0-320E-80D4-8464D7692B22} = {156D9C17-61FD-98D6-32C0-065B406D0434}
2413+
{BE8CFF4C-E536-43DB-9D01-001E9A052D37} = {50124EEC-97B0-320E-80D4-8464D7692B22}
23762414
{319B94CD-694C-16E8-9E3A-9577B99158DD} = {F7E192D1-DE6C-42A2-B52F-02849D482450}
23772415
{ADF14627-FCB5-4BD3-B65F-DDCC3A3F727C} = {319B94CD-694C-16E8-9E3A-9577B99158DD}
23782416
EndGlobalSection

core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ sure the user is discussing Azure Functions; do not call it otherwise.
1212
- Use Azure Functions Deployment Best Practices: When deploying Azure Functions apps to Azure or preparing for
1313
the deployment, invoke your `bestpractices` tool if available. Only call this tool when you are sure the user
1414
is discussing Azure; do not call it otherwise.
15+
- Use Azure AI Code Generation Best Practices: When generating code for AI applications, AI agents, workflows,
16+
or chatbots in Azure, invoke your `azureaibestpractices` tool if available. Only call this tool when you are sure
17+
the user is discussing Azure and code generation; do not call it for Azure resource operations.
1518
- Use Azure SWA Best Practices: When working with static web apps, invoke your `bestpractices` tool if available.
1619
Only call this tool when you are sure the user is discussing Azure; do not call it otherwise.
1720
- Plan before editing files for Azure web apps: When generating code for Azure Functions and Azure Static Web App,

core/Azure.Mcp.Core/src/Areas/Server/Resources/consolidated-tools.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@
478478
},
479479
{
480480
"name": "get_azure_best_practices",
481-
"description": "Retrieve Azure best practices and infrastructure schema for code generation, deployment, and operations. Covers general Azure practices, Azure Functions best practices, Terraform configurations, Bicep template schemas, and deployment best practices.",
481+
"description": "Retrieve Azure best practices and infrastructure schema for code generation, deployment, and operations. Covers general Azure practices, Azure Functions best practices, AI agent development with Azure AI Foundry, Terraform configurations, Bicep template schemas, and deployment best practices.",
482482
"toolMetadata": {
483483
"destructive": false,
484484
"idempotent": true,
@@ -488,6 +488,7 @@
488488
"localRequired": false
489489
},
490490
"mappedToolList": [
491+
"azureaibestpractices_get",
491492
"azureterraformbestpractices_get",
492493
"bicepschema_get",
493494
"get_bestpractices_get"

eng/tools/ToolDescriptionEvaluator/prompts.json

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"foundry_agents_connect": [
3-
"Query an agent in my AI foundry project"
3+
"Query an agent in my Azure AI foundry resource"
44
],
55
"foundry_agents_evaluate": [
66
"Evaluate the full query and response I got from my agent for task_adherence"
77
],
88
"foundry_agents_list": [
9-
"List all agents in my AI Foundry project",
10-
"Show me the available agents in my AI Foundry project"
9+
"List all agents in my Azure AI Foundry resource",
10+
"Show me the available agents in my Azure AI Foundry resource"
1111
],
1212
"foundry_agents_query-and-evaluate": [
13-
"Query and evaluate an agent in my AI Foundry project for task_adherence"
13+
"Query and evaluate an agent in my Azure AI Foundry resource for task_adherence"
1414
],
1515
"foundry_knowledge_index_list": [
1616
"List all knowledge indexes in my AI Foundry project",
1717
"Show me the knowledge indexes in my AI Foundry project"
1818
],
1919
"foundry_knowledge_index_schema": [
20-
"Show me the schema for knowledge index <index-name> in my AI Foundry project",
20+
"Show me the schema for knowledge index <index-name> in my Azure AI Foundry resource",
2121
"Get the schema configuration for knowledge index <index-name>"
2222
],
2323
"foundry_models_deploy": [
@@ -32,18 +32,18 @@
3232
"Show me the available AI Foundry models"
3333
],
3434
"foundry_openai_chat-completions-create": [
35-
"Create a chat completion with the message \"Hello, how are you today?\""
35+
"Create a chat completion with the message \"Hello, how are you today?\" using my Azure AI Foundry resource"
3636
],
3737
"foundry_openai_create-completion": [
38-
"Create a completion with the prompt \"What is Azure?\""
38+
"Create a completion with the prompt \"What is Azure?\" using my Azure AI Foundry resource"
3939
],
4040
"foundry_openai_embeddings-create": [
41-
"Generate embeddings for the text \"Azure OpenAI Service\"",
42-
"Create vector embeddings for my text using Azure OpenAI"
41+
"Generate embeddings for the text \"Azure OpenAI Service\" using my Azure AI Foundry resource",
42+
"Create vector embeddings for my text using my Azure AI Foundry resource"
4343
],
4444
"foundry_openai_models-list": [
45-
"List all available OpenAI models in my Azure resource",
46-
"Show me the OpenAI model deployments"
45+
"List all available OpenAI models in my Azure AI Foundry resource",
46+
"Show me the OpenAI model deployments in my Azure AI Foundry resource"
4747
],
4848
"foundry_resource_get": [
4949
"List all AI Foundry resources in my subscription",
@@ -128,15 +128,16 @@
128128
"What does app lens say is wrong with my service?"
129129
],
130130
"appservice_database_add": [
131-
"Add a database connection to my app service <app_name> in resource group <resource_group>",
132-
"Configure a SQL Server database for app service <app_name>",
133-
"Add a MySQL database to app service <app_name>",
134-
"Add a PostgreSQL database to app service <app_name>",
135-
"Add a CosmosDB database to app service <app_name>",
136-
"Add database <database_name> on server <database_server> to app service <app_name>",
137-
"Set connection string for database <database_name> in app service <app_name>",
138-
"Configure tenant <tenant> for database <database_name> in app service <app_name>",
139-
"Add database <database_name> with retry policy to app service <app_name>"
131+
"Add database connection <connection_string> to my app service <app_name> for database <database_name> in resource group <resource_group>",
132+
"Configure SQL Server database <database_name> for app service <app_name> with connection string <connection_string> in resource group <resource_group>",
133+
"Add MySQL database <database_name> to app service <app_name> using connection <connection_string> in resource group <resource_group>",
134+
"Add PostgreSQL database <database_name> to app service <app_name> using connection <connection_string> in resource group <resource_group>",
135+
"Connect CosmosDB database <database_name> using connection string <connection_string> to app service <app_name> in resource group <resource_group>",
136+
"Add database connection <connection_string> for database <database_name> on server <database_server> to app service <app_name> in resource group <resource_group>",
137+
"Add database connection string for <database_name> to app service <app_name> using connection string <connection_string> in resource group <resource_group>",
138+
"Connect database <database_name> to my app service <app_name> using connection string <connection_string> in resource group <resource_group>",
139+
"Set up database <database_name> for app service <app_name> with connection string <connection_string> under resource group <resource_group>",
140+
"Configure database <database_name> for app service <app_name> with the connection string <connection_string> in resource group <resource_group>"
140141
],
141142
"applicationinsights_recommendation_list": [
142143
"List code optimization recommendations across my Application Insights components",
@@ -330,14 +331,14 @@
330331
"Show Event Grid subscriptions in resource group <resource_group_name> in subscription <subscription>",
331332
"List Event Grid subscriptions for subscription <subscription> in location <location>"
332333
],
333-
"eventhubs_consumergroup_delete": [
334+
"eventhubs_eventhub_consumergroup_delete": [
334335
"Delete my consumer group <consumer_group_name> in my event hub <event_hub_name>, namespace <namespace_name>, and resource group <resource_group_name>"
335336
],
336-
"eventhubs_consumergroup_get": [
337+
"eventhubs_eventhub_consumergroup_get": [
337338
"List all consumer groups in my event hub <event_hub_name> in namespace <namespace_name>",
338339
"Get the details of my consumer group <consumer_group_name> in my event hub <event_hub_name>, namespace <namespace_name>, and resource group <resource_group_name>"
339340
],
340-
"eventhubs_consumergroup_update": [
341+
"eventhubs_eventhub_consumergroup_update": [
341342
"Create a new consumer group <consumer_group_name> in my event hub <event_hub_name>, namespace <namespace_name>, and resource group <resource_group_name>",
342343
"Update my consumer group <consumer_group_name> in my event hub <event_hub_name>, namespace <namespace_name>, and resource group <resource_group_name>"
343344
],
@@ -499,23 +500,23 @@
499500
"grafana_list": [
500501
"List all Azure Managed Grafana in one subscription"
501502
],
502-
"managedlustre_filesystem_create": [
503+
"managedlustre_fs_create": [
503504
"Create an Azure Managed Lustre filesystem with name <filesystem_name>, size <filesystem_size>, SKU <sku>, and subnet <subnet_id> for availability zone <zone> in location <location>. Maintenance should occur on <maintenance_window_day> at <maintenance_window_time>"
504505
],
505-
"managedlustre_filesystem_list": [
506+
"managedlustre_fs_list": [
506507
"List the Azure Managed Lustre filesystems in my subscription <subscription_name>",
507508
"List the Azure Managed Lustre filesystems in my resource group <resource_group_name>"
508509
],
509-
"managedlustre_filesystem_sku_get": [
510+
"managedlustre_fs_sku_get": [
510511
"List the Azure Managed Lustre SKUs available in location <location>"
511512
],
512-
"managedlustre_filesystem_subnetsize_ask": [
513+
"managedlustre_fs_subnetsize_ask": [
513514
"Tell me how many IP addresses I need for an Azure Managed Lustre filesystem of size <filesystem_size> using the SKU <sku>"
514515
],
515-
"managedlustre_filesystem_subnetsize_validate": [
516+
"managedlustre_fs_subnetsize_validate": [
516517
"Validate if the network <subnet_id> can host Azure Managed Lustre filesystem of size <filesystem_size> using the SKU <sku>"
517518
],
518-
"managedlustre_filesystem_update": [
519+
"managedlustre_fs_update": [
519520
"Update the maintenance window of the Azure Managed Lustre filesystem <filesystem_name> to <maintenance_window_day> at <maintenance_window_time>"
520521
],
521522
"marketplace_product_get": [
@@ -525,6 +526,11 @@
525526
"Search for Microsoft products in the marketplace",
526527
"Show me marketplace products from publisher <publisher_name>"
527528
],
529+
"azureagentbestpractices_get": [
530+
"Get best practices for building AI applications in Azure",
531+
"Show me best practices for Azure AI Foundry agents",
532+
"Get guidance for building agents with Azure AI Foundry"
533+
],
528534
"get_bestpractices_get": [
529535
"Get the latest Azure code generation best practices",
530536
"Get the latest Azure deployment best practices",
@@ -533,12 +539,13 @@
533539
"Get the latest Azure Functions deployment best practices",
534540
"Get the latest Azure Functions best practices",
535541
"Get the latest Azure Static Web Apps best practices",
536-
"What are azure function best practices?"
542+
"What are azure function best practices?",
543+
"configure azure mcp in coding agent for my repo"
537544
],
538545
"monitor_activitylog_list": [
539546
"List the activity logs of the last month for <resource_name>"
540547
],
541-
"monitor_healthmodels_entity_gethealth": [
548+
"monitor_healthmodels_entity_get": [
542549
"Show me the health status of entity <entity_id> using the health model <health_model_name>"
543550
],
544551
"monitor_metrics_definitions": [
@@ -627,7 +634,7 @@
627634
"Show me the health status of all my Azure resources",
628635
"What resources in resource group <resource_group_name> have health issues?"
629636
],
630-
"resourcehealth_service-health-events_list": [
637+
"resourcehealth_health-events_list": [
631638
"List all service health events in my subscription",
632639
"Show me Azure service health events for subscription <subscription_id>",
633640
"What service issues have occurred in the last 30 days?",
@@ -765,10 +772,10 @@
765772
"virtualdesktop_hostpool_list": [
766773
"List all host pools in my subscription"
767774
],
768-
"virtualdesktop_hostpool_sessionhost_list": [
775+
"virtualdesktop_hostpool_host_list": [
769776
"List all session hosts in host pool <hostpool_name>"
770777
],
771-
"virtualdesktop_hostpool_sessionhost_usersession-list": [
778+
"virtualdesktop_hostpool_host_user-list": [
772779
"List all user sessions on session host <sessionhost_name> in host pool <hostpool_name>"
773780
],
774781
"workbooks_create": [
@@ -793,7 +800,7 @@
793800
],
794801
"cloudarchitect_design": [
795802
"Please help me design an architecture for a large-scale file upload, storage, and retrieval service",
796-
"Help me create a cloud service that will serve as ATM for users",
803+
"Help me design an Azure cloud service that will serve as an ATM for users",
797804
"I want to design a cloud app for ordering groceries",
798805
"How can I design a cloud service in Azure that will store and present videos for users?"
799806
]

eng/tools/ToolDescriptionEvaluator/results-consolidated.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@
19881988
| 2 | 0.338439 | `get_azure_resource_and_app_health_status` |**EXPECTED** |
19891989
| 3 | 0.336768 | `get_azure_storage_details` ||
19901990
| 4 | 0.325422 | `get_azure_subscriptions_and_resource_groups` ||
1991-
| 5 | 0.312349 | `get_azure_cache_for_redis_details` ||
1991+
| 5 | 0.312350 | `get_azure_cache_for_redis_details` ||
19921992

19931993
---
19941994

0 commit comments

Comments
 (0)