Repository navigation
Group AddAzureFunctionTool parameters into an options type - #22253
Conversation
Co-authored-by: Copilot App <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22253Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22253" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
All four polyglot AppHosts still call the removed eight-argument API and must migrate to the generated options DTO to avoid compilation or type-checking failures after SDK regeneration.
1 open issue
What changed in this PR
This PR addresses #16610 by grouping Foundry Azure Function tool configuration into AzureFunctionToolOptions, simplifying C# and polyglot AppHost calls while preserving resource construction and serialized output.
Changes:
- Replaces both preview positional overloads with
AddAzureFunctionTool(name, options). - Documents the options-based API with C# and TypeScript examples.
- Expands tests for resource mapping and invalid options.
| File | Description |
|---|---|
tests/Aspire.Hosting.Foundry.Tests/PromptAgentTests.cs |
Migrates calls and adds mapping and validation assertions. |
src/Aspire.Hosting.Foundry/ToolResources/AzureFunctionToolOptions.cs |
Adds required function-definition and queue-binding options. |
src/Aspire.Hosting.Foundry/README.md |
Documents options-based usage in C# and TypeScript. |
src/Aspire.Hosting.Foundry/PromptAgent/PromptAgentBuilderExtensions.cs |
Replaces positional overloads with the exported options-based method. |
Review effort: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]>
Tests selector3 / 101 PR test projects · 2 PR jobs, from 7 changed files. Selected PR test projects (3 / 101)
Selected PR jobs (2)
How these were chosen — grouped by what changed🔧 🔧 🧪 Job reasons
Selection computed for commit |
|
Pull request created: #2252
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#2252 targeting Added a breaking-change entry to Note This draft PR needs human review before merging. |

Description
AddAzureFunctionToolcurrently takes a long list of positional arguments, including input and output queue endpoint/name pairs. Grouping the configuration makes call sites easier to read and allows configuration to evolve without adding more overloads.Replace both preview overloads with
AddAzureFunctionTool(name, AzureFunctionToolOptions). The required options capture the function definition and queue bindings.ParametersJsonkeeps the same options type usable from C# and TypeScript. Existing resource construction, argument validation, and serialized agent-tool output are preserved.Fixes: #16610
User-facing usage
C# AppHost:
TypeScript AppHost:
Breaking changes
Callers of the preview positional overloads must move configuration into
AzureFunctionToolOptions. C# callers usingBinaryDatamust supply its JSON text throughParametersJson. The resource constructor remains unchanged; generated API compatibility baselines are not edited.Validation
Added focused coverage for options-to-resource mapping, null options, null schema, and null/empty queue names. The existing serialized agent definition snapshot is unchanged.
Passed, 43 tests:
The process-local settings accommodate the host's exhausted inotify quota and OpenSSL strong-name signing restriction. The test project also rebuilt successfully with zero warnings and errors. Generated the TypeScript SDK from the updated Foundry assembly and inspected the options DTO, method signature, and documentation. No live Azure deployment was run; runtime/deployment behavior is unchanged.
Checklist
<remarks />and<code />elements on your triple slash comments?