Skip to content

Remove hardcoded Azure Functions templates, use MCP tool - #1902

Closed
Manvir Kaur (manvkaur) wants to merge 6 commits into
microsoft:mainfrom
manvkaur:manvkaur/function-remove-coded-recipes
Closed

Remove hardcoded Azure Functions templates, use MCP tool#1902
Manvir Kaur (manvkaur) wants to merge 6 commits into
microsoft:mainfrom
manvkaur:manvkaur/function-remove-coded-recipes

Conversation

@manvkaur

@manvkaur Manvir Kaur (manvkaur) commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Replace ~70 hardcoded Azure Functions template files with dynamic MCP tool calls (functions_template_get). This reduces context and maintenance burden by fetching templates from GitHub samples at runtime instead of storing static copies.

Summary

  • Deleted: ~9,000 lines of hardcoded template files (source/.md, bicep/.bicep, terraform/.tf)
  • Added: MCP tool integration for dynamic template discovery and retrieval
  • Kept: Critical agent guidance in composition.md (UAMI config, entry points, deploy strategy, Terraform rules)
  • Updated: All eval summaries with manifest-backed language coverage

Key Changes

  • Templates now retrieved via functions_template_get(language, template) MCP tool
  • 3-tier manifest fallback: CDN → GitHub source → known-good Azure-Samples repos
  • Removed duplicate intent→resource table from README.md (consolidated in selection.md)
  • Fixed tool signature drift: positional → keyword args in eval files
  • Preserved composition algorithm and selection logic
  • Added troubleshooting sections to recipe READMEs
  • Version bumped to 1.1.19

Integration Test Results ✅

CI Run: Integration Tests - azure-prepare (passed)

  • Job: Integration – azure-prepare
  • Status: ✅ Success
  • Duration: ~63 min (22:39 → 23:42 UTC)
  • Commit: c7cbbd1

Functions Template MCP Validation (11 tests)

Test Trigger Status
HTTP trigger (base) http ✅ PASS
Timer trigger timer ✅ PASS
Cosmos DB trigger cosmos ✅ PASS
SQL trigger sql ✅ PASS
Blob/EventGrid trigger blob ✅ PASS
Service Bus trigger servicebus ✅ PASS
Event Hubs trigger eventhub ✅ PASS
Durable Functions durable ✅ PASS
MCP server on Functions mcp ✅ PASS
HTTP trigger + Terraform http (TF) ✅ PASS
Cosmos DB + Terraform cosmos (TF) ✅ PASS

Manifest-Backed Language Coverage

Eval summaries now reference the functions template manifest (70 templates, 6 languages) instead of claiming unverified coverage. Python is verified end-to-end; other languages are confirmed as AZD templates in the manifest.

Recipe Python TS JS C# Java PS
HTTP (base) ✅ Verified 📋 2 📋 2 📋 4 📋 2 📋 1
Timer ✅ Verified 📋 1 📋 1 📋 1 📋 1 📋 1
Cosmos DB ✅ Verified 📋 1 🔧 agent 📋 1 📋 3 🔧 agent
SQL ✅ Verified 📋 1 🔧 agent 📋 1 🔧 agent 🔧 agent
Blob/EventGrid ✅ Verified 📋 1 📋 1 📋 1 📋 1 📋 1
Service Bus ✅ Verified 🔧 agent 🔧 agent 🔧 agent 🔧 agent 🔧 agent
Event Hubs ✅ Verified 📋 1 🔧 agent 📋 1 📋 1 🔧 agent
Durable ✅ Verified 📋 1 📋 1 📋 8 📋 1 🔧 agent
MCP ✅ Verified 📋 2 🔧 agent 📋 2 📋 2 🔧 agent

📋 = AZD template exists in manifest (number = template count) | 🔧 agent = No AZD template, skill relies on agent-composed scaffolding

Eval cost note: Each language × trigger eval requires ~5 min of agent runtime. Full 6-language matrix = ~4.5 hours CI. Multi-language eval expansion tracked as follow-up.

AZD Template Gaps

cc Paul Yuknewicz (@paulyuk)

  • Service Bus: No AZD templates for any language in the manifest. Skill relies on agent-composed scaffolding for all languages.
  • Partial gaps: JS and PS have no AZD template for cosmos, sql, eventhubs, mcp, durable — skill relies on agent-composed scaffolding for these combinations.

PR Review Items Addressed

# Item Status
1 Version bump (1.1.18 on main → 1.1.19) ✅ Done
2 Tool signature drift (positional → keyword) ✅ Fixed in 5 eval python.md files
3 Manifest fallback path ✅ 3-tier fallback in README.md + composition.md
4 Duplicate intent→resource table ✅ Consolidated in selection.md
5 Line 47 formatting ✅ Resolved (table removed)
6 Eval evidence / test results ✅ CI run linked above
7 Durable links valid ✅ Confirmed, no action needed
8 Coverage gap tracking ✅ Documented above with manifest data

Checklist

  • Tests pass locally (cd tests && npm test)
  • Integration tests pass in CI (run link)
  • Version bumped in skill frontmatter (1.1.17 → 1.1.19)
  • If modifying skill descriptions: verified routing correctness with integration tests - N/A
  • If modifying skill USE FOR / DO NOT USE FOR / PREFER OVER clauses: confirmed no routing regressions - N/A

Related Issues

Replace ~70 hardcoded template files (source code, Bicep, Terraform) with
dynamic MCP tool calls via functions_template_get(). Templates are now
retrieved at runtime from Azure Functions CDN.

Changes:
- Remove source/<lang>.md files (6 langs x 8 recipes = ~48 files)
- Remove bicep/*.bicep and terraform/*.tf files (~20 files)
- Remove common/uami-bindings.md (guidance now in composition.md)
- Update composition.md with UAMI validation, entry point rules, deploy strategy
- Update recipe READMEs with troubleshooting sections
- Update eval summaries to reflect MCP tool validation
- Simplify recipes/README.md to reference selection.md

Tested:
- HTTP trigger: PASS (5 API calls, 54s)
- Timer trigger: PASS (12 API calls, 146s)
- Cosmos DB trigger: PASS (5 API calls, 49s)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the azure-prepare skill’s Azure Functions guidance to stop relying on hardcoded, in-repo “template” snippets and instead direct users to discover and fetch templates dynamically via the functions_template_get MCP tool (or a CDN manifest fallback).

Changes:

  • Removes many legacy per-language “template/source” and IaC snippet files under Functions recipes (timer/sql/servicebus/eventhubs/durable/cosmosdb/blob-eventgrid/mcp).
  • Updates recipe READMEs and eval summaries to reference MCP-based template discovery (resource filtering) instead of local template files.
  • Bumps plugin/skills/azure-prepare skill version from 1.1.12 → 1.1.13.

Reviewed changes

Copilot reviewed 94 out of 94 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
plugin/skills/azure-prepare/references/services/functions/triggers.md Removed legacy trigger examples doc.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/source/typescript.md Removed hardcoded Timer TS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/source/python.md Removed hardcoded Timer Python source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/source/powershell.md Removed hardcoded Timer PowerShell source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/source/javascript.md Removed hardcoded Timer JS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/source/java.md Removed hardcoded Timer Java source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/source/dotnet.md Removed hardcoded Timer .NET source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/eval/summary.md Updated eval summary to MCP-template framing.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/timer/README.md Updated Timer recipe to MCP resource discovery approach.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/terraform/sql.tf Removed hardcoded SQL Terraform module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/typescript.md Removed hardcoded SQL TS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/python.md Removed hardcoded SQL Python source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/powershell.md Removed hardcoded SQL PowerShell source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/javascript.md Removed hardcoded SQL JS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/java.md Removed hardcoded SQL Java source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/dotnet.md Removed hardcoded SQL .NET source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/eval/summary.md Updated eval summary to MCP-template framing.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/eval/python.md Updated Python eval doc to MCP discovery/selection workflow.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/bicep/sql.bicep Removed hardcoded SQL Bicep module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/README.md Updated SQL recipe to MCP resource discovery approach.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/terraform/servicebus.tf Removed hardcoded Service Bus Terraform module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/typescript.md Removed hardcoded Service Bus TS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/python.md Removed hardcoded Service Bus Python source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/powershell.md Removed hardcoded Service Bus PowerShell source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/javascript.md Removed hardcoded Service Bus JS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/java.md Removed hardcoded Service Bus Java source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/dotnet.md Removed hardcoded Service Bus .NET source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/eval/summary.md Updated eval summary to MCP-template framing.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/bicep/servicebus.bicep Removed hardcoded Service Bus Bicep module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/README.md Updated Service Bus recipe to MCP resource discovery approach + troubleshooting.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/typescript.md Removed hardcoded MCP TS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/python.md Removed hardcoded MCP Python source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/powershell.md Removed hardcoded MCP PowerShell source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/javascript.md Removed hardcoded MCP JS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/java.md Removed hardcoded MCP Java source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/dotnet.md Removed hardcoded MCP .NET source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/eval/summary.md Updated eval summary to MCP-template framing.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/README.md Updated MCP recipe to MCP resource discovery approach.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/source/typescript.md Removed hardcoded Event Hubs TS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/source/python.md Removed hardcoded Event Hubs Python source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/source/powershell.md Removed hardcoded Event Hubs PowerShell source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/source/javascript.md Removed hardcoded Event Hubs JS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/source/java.md Removed hardcoded Event Hubs Java source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/source/dotnet.md Removed hardcoded Event Hubs .NET source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/eval/summary.md Updated eval summary to MCP-template framing.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/eval/python.md Updated Python eval doc to MCP discovery/selection workflow.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/bicep/eventhubs.bicep Removed hardcoded Event Hubs Bicep module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/bicep/eventhubs-network.bicep Removed hardcoded Event Hubs networking Bicep module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/README.md Updated Event Hubs recipe to MCP resource discovery approach.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/source/typescript.md Removed hardcoded Durable TS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/source/python.md Removed hardcoded Durable Python source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/source/powershell.md Removed hardcoded Durable PowerShell source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/source/javascript.md Removed hardcoded Durable JS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/source/java.md Removed hardcoded Durable Java source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/source/dotnet.md Removed hardcoded Durable .NET source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/eval/summary.md Updated eval summary to MCP-template framing (+ DTS note/link).
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/eval/python.md Updated Python eval doc to MCP discovery/selection workflow.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/bicep/durable-task-scheduler.bicep Removed hardcoded Durable Task Scheduler Bicep module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/source/typescript.md Removed hardcoded Cosmos DB TS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/source/python.md Removed hardcoded Cosmos DB Python source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/source/powershell.md Removed hardcoded Cosmos DB PowerShell source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/source/javascript.md Removed hardcoded Cosmos DB JS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/source/java.md Removed hardcoded Cosmos DB Java source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/source/dotnet.md Removed hardcoded Cosmos DB .NET source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/eval/summary.md Updated eval summary to MCP-template framing.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/eval/python.md Updated Python eval doc to MCP discovery/selection workflow.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/bicep/cosmos.bicep Removed hardcoded Cosmos DB Bicep module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/bicep/cosmos-network.bicep Removed hardcoded Cosmos DB networking Bicep module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/common/uami-bindings.md Removed legacy UAMI binding guidance doc (now presumed covered by templates).
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/terraform/blob.tf Removed hardcoded blob+EventGrid Terraform module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/source/typescript.md Removed hardcoded blob+EventGrid TS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/source/python.md Removed hardcoded blob+EventGrid Python source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/source/powershell.md Removed hardcoded blob+EventGrid PowerShell source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/source/javascript.md Removed hardcoded blob+EventGrid JS source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/source/java.md Removed hardcoded blob+EventGrid Java source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/source/dotnet.md Removed hardcoded blob+EventGrid .NET source template.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/eval/summary.md Updated eval summary to MCP-template framing.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/eval/python.md Updated Python eval doc to MCP discovery/selection workflow.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/bicep/blob.bicep Removed hardcoded blob+EventGrid Bicep module.
plugin/skills/azure-prepare/references/services/functions/templates/recipes/blob-eventgrid/README.md Updated blob+EventGrid recipe to MCP resource discovery approach.
plugin/skills/azure-prepare/references/services/functions/templates/mcp.md Removed legacy MCP templates index doc.
plugin/skills/azure-prepare/references/services/functions/templates/integrations.md Removed legacy integrations index doc.
plugin/skills/azure-prepare/references/services/functions/templates/http.md Removed legacy HTTP templates index doc.
plugin/skills/azure-prepare/references/services/functions/templates/base/eval/summary.md Updated base HTTP eval summary to MCP-template framing.
plugin/skills/azure-prepare/references/services/functions/durable.md Updated Durable Functions guidance to point to MCP templates workflow.
plugin/skills/azure-prepare/SKILL.md Version bump to reflect skill documentation changes.

- Remove deleted triggers.md link from functions/README.md
- Fix directory links to point to README.md files in recipes/README.md
- Fix directory links to point to README.md files in selection.md
- Fix durable-task-scheduler relative path (add extra ../ level)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread tests/azure-prepare/functions-e2e.test.ts Fixed
Manvir Kaur (manvkaur) and others added 2 commits April 16, 2026 01:39
- Fix relative link to durable-task-scheduler (4 levels up to services/)
- Remove stray backticks breaking table in durable/README.md
- Remove test and migration-plan files from PR (keep local)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- templates/README.md: add links to recipes/README.md and base/eval/summary.md
- recipes/README.md: add link to common/error-handling.md
- base/eval/summary.md: add link to python.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kvenkatrajan

kvenkatrajan commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator
image

Im sold :)

Can you attach the test results to the PR as well please? Thanks!

@jongio Jon Gallant (jongio) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Direction looks right. A few concrete items to look at before this comes out of draft:

Blocking: Skill Structure CI is failing. azure-prepare bumped 1.1.15 → 1.1.16 in this PR, but main has moved to 1.1.18 since you branched. The check compares base vs. head, so it needs a bump to at least 1.1.19 after you merge/rebase main.

Tool signature drift. The prescriptive docs (templates/README.md, selection.md, composition.md) all show functions_template_get(language: "python") - keyword args. But the five recipes/*/eval/python.md files show a positional form in their "Template discovery" row: functions_template_get("python"). If the MCP server rejects positional args, agents copying the eval form will fail. Pick one and standardize.

Example: recipes/blob-eventgrid/eval/python.md line 7 has functions_template_get("python") while line 16 (same file) uses the keyword form. Same pattern in cosmosdb, durable, eventhubs, sql.

Fallback has no manifest-failure path. templates/README.md Step 1 (line 115) and composition.md Step 1 (line 45) both unconditionally GET cdn.functions.azure.com/.../manifest.json. There's a fallback for per-template download failures ("fall back to git clone"), but nothing for manifest.json itself being 404/timeout/DNS-failed. Agent will stall or surface a confusing error. Suggest: if manifest fetch fails, fall back to a known-good list of Azure-Samples/functions-quickstart-* repos keyed by language+resource, or at minimum document "report and ask user to retry later".

Duplicate intent→resource table. templates/README.md Step 2 (lines 41-51) and selection.md (lines 9-20) now both carry the user-intent → resource-filter mapping. They already disagree subtly: README has "MCP, server, tools, resource, prompt" and "AI agent, chatbot" rows that selection.md doesn't, and the "Service Bus" row reads differently in each. Two sources of truth on the same mapping will drift. Consolidate: keep the table in selection.md (since it's the selection guide) and have templates/README.md Step 2 reference it.

Line 47 of templates/README.md reads rough. | "Service Bus, Message processing topic, queue| "Service Bus" | servicebus | - the "Message processing topic, queue" phrasing is ambiguous and the cell delimiter is missing a space. Something like Service Bus, message queue, topic, pub-sub is clearer.

Eval summaries don't back up the "✅ PASS" claims. kvenkatrajan already asked for test results. The eval/summary.md files (all of them) report PASS for MCP Tool Validation but carry no attached azd up output, generated project listing, or verification logs. For Python (the only language currently marked complete), attaching one concrete run would give reviewers something real to look at. Agreed with the ask.

Copilot bot's link feedback on durable/README.md:14 and durable/eval/summary.md:35 - those links actually resolve correctly. ../../../../durable-task-scheduler/README.md from recipes/durable/README.md and ../../../../../durable-task-scheduler/README.md from eval/summary.md both resolve to services/durable-task-scheduler/README.md, which exists. Safe to resolve those threads.

Main risk I see: eval coverage gap. Six languages claimed, only Python actually verified. Worth tracking in the PR description or a follow-up issue so this doesn't ship as "done" while five languages are still pending.

@manvkaur

Manvir Kaur (manvkaur) commented Apr 18, 2026

Copy link
Copy Markdown
Collaborator Author

Closing in favor of a new PR #1949 from the microsoft org branch (commits were pushed directly to microsoft/GitHub-Copilot-for-Azure).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants