Skip to content

.NET: Add Foundry Toolbox MCP skills discovery sample#6134

Merged
semenshi merged 3 commits into
microsoft:mainfrom
semenshi:fix/step26-foundry-toolbox-mcp-skills
May 28, 2026
Merged

.NET: Add Foundry Toolbox MCP skills discovery sample#6134
semenshi merged 3 commits into
microsoft:mainfrom
semenshi:fix/step26-foundry-toolbox-mcp-skills

Conversation

@semenshi
Copy link
Copy Markdown
Contributor

@semenshi semenshi commented May 28, 2026

Adds a new sample demonstrating MCP-based skills discovery from a Foundry Toolbox endpoint using AgentSkillsProviderBuilder and AIContextProviders.

  • Connects to a Foundry Toolbox MCP endpoint via Streamable HTTP transport
  • Discovers skills with AgentSkillsProviderBuilder.UseMcpSkills() and injects them into an agent
  • Includes Foundry-Features header and bearer token auth
  • README with prerequisites and usage instructions

Add a new sample demonstrating MCP-based skills discovery from a Foundry
Toolbox endpoint using AgentSkillsProviderBuilder and AIContextProviders.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 28, 2026 09:38
@semenshi semenshi self-assigned this May 28, 2026
@moonbox3 moonbox3 added documentation Improvements or additions to documentation .NET labels May 28, 2026
@github-actions github-actions Bot changed the title feat: add Agent_Step26_FoundryToolboxMcpSkills sample .NET: feat: add Agent_Step26_FoundryToolboxMcpSkills sample May 28, 2026
@semenshi semenshi moved this to In Review in Agent Framework May 28, 2026
@semenshi semenshi changed the title .NET: feat: add Agent_Step26_FoundryToolboxMcpSkills sample .NET: Add Foundry Toolbox MCP skills discovery sample May 28, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new .NET Foundry agent sample showing how to connect to a Foundry Toolbox MCP endpoint and use MCP-based Agent Skills as AI context.

Changes:

  • Adds Agent_Step26_FoundryToolboxMcpSkills sample with MCP transport, bearer-token handler, skills discovery, and agent creation.
  • Adds README usage/prerequisite guidance for the new sample.
  • Registers the sample in the AgentsWithFoundry README and .NET solution.

Reviewed changes

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

Show a summary per file
File Description
dotnet/samples/02-agents/AgentsWithFoundry/README.md Adds Step26 to the Foundry agents sample table.
dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step26_FoundryToolboxMcpSkills/README.md Documents the new sample, prerequisites, env vars, and run command.
dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step26_FoundryToolboxMcpSkills/Program.cs Implements the Foundry Toolbox MCP skills sample.
dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step26_FoundryToolboxMcpSkills/Agent_Step26_FoundryToolboxMcpSkills.csproj Defines the new sample project and dependencies.
dotnet/agent-framework-dotnet.slnx Adds the new sample project to the solution.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 4 | Confidence: 90%

✓ Correctness

The sample is missing the Foundry-Features: Toolboxes=V1Preview header in the HttpClientTransportOptions for the MCP transport, despite the PR description explicitly claiming it is included. Step25 adds this via AdditionalHeaders (lines 51-54 of Step25's Program.cs) and the header is described as required for toolbox operations. Without it, the MCP connection to the Foundry Toolbox endpoint will likely fail at runtime. All other API usage (AgentSkillsProviderBuilder, AsAIAgent overload, AIContextProviders, RunAsync) is correct.

✓ Security Reliability

The PR adds a clean sample demonstrating MCP-based skills discovery. The main finding is a missing Foundry-Features: Toolboxes=V1Preview header that the PR description claims is present (matching Step25's pattern). Without it, the sample may fail at runtime if the Foundry Toolbox MCP endpoint requires this preview feature flag. Resource management (using/await using) and auth patterns are correct.

✓ Test Coverage

This PR adds a new sample project (Agent_Step26_FoundryToolboxMcpSkills) demonstrating MCP-based skills discovery. The repository's consistent pattern is that sample projects do not have dedicated test projects — they are demonstrative code meant to be run manually against live Azure services. The core library code exercised by this sample (AgentSkillsProviderBuilder.UseMcpSkills, AgentMcpSkillsSource) already has comprehensive unit test coverage in AgentMcpSkillsSourceTests.cs (10 test methods covering discovery, edge cases, invalid inputs, path traversal, binary resources) and AgentSkillsProviderBuilderTests.cs. No test coverage gaps were identified.

✗ Design Approach

I found one blocking design issue: the new Step26 sample constructs its MCP transport without the Foundry-Features: Toolboxes=V1Preview header, even though the existing Foundry toolbox samples and handlers in this repo treat that header as part of the toolbox request pattern. That means the sample does not actually match the Step25 contract it claims to demonstrate and can fail against preview toolbox MCP endpoints.

Flagged Issues

  • dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step26_FoundryToolboxMcpSkills/Program.cs:35-42 creates the MCP transport without AditionalHeaders["Foundry-Features"] = "Toolboxes=V1Preview", which the established Foundry toolbox pattern requires (see Step25's Program.cs:44-56, FoundryToolboxBearerTokenHandler.cs:13-19, and related tests). The sample will not match the documented contract and may fail against preview toolbox MCP endpoints.

Automated review by semenshi's agents

- Add Foundry-Features: Toolboxes=V1Preview header to MCP transport
  options, matching the Step25 pattern
- Document skill://index.json prerequisite in README

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@semenshi semenshi marked this pull request as ready for review May 28, 2026 10:10
@semenshi semenshi enabled auto-merge May 28, 2026 10:14
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 3 | Confidence: 92% | Result: All clear

Reviewed: Security Reliability, Test Coverage, Design Approach


Automated review by semenshi's agents

…yToolboxMcpSkills/Program.cs

Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
@semenshi semenshi added this pull request to the merge queue May 28, 2026
Merged via the queue into microsoft:main with commit 08abe9e May 28, 2026
27 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in Agent Framework May 28, 2026
@SergeyMenshykh SergeyMenshykh self-assigned this Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants