Skip to content

Conversation

@showpune
Copy link
Contributor

This pull request adds new tests to ensure custom agent availability and their interaction with AI tools in the McpAndAgentsTests suite. The main focus is on verifying that custom agents can be listed and accessed correctly, both with and without additional AI tool configuration.

Custom agent availability and AI tools integration:

  • Added Should_Custom_Agent_Availability test to verify that a custom agent can be created and is correctly listed in the session response.
  • Added Should_Custom_Agent_Availability_With_AI_Tools test to ensure that custom agents are available and function properly when AI tools (such as an encrypt_string function) are configured in the session.

Test infrastructure updates:

  • Added System.ComponentModel and Microsoft.Extensions.AI namespaces to support new test scenarios and AI tool integration.

@showpune showpune requested a review from a team as a code owner January 28, 2026 15:24
Copilot AI review requested due to automatic review settings January 28, 2026 15:24
Copy link
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

This PR adds two new test cases to verify that custom agents can be listed and accessed correctly in the McpAndAgentsTests suite. The tests focus on ensuring custom agent availability both with and without AI tool configuration.

Changes:

  • Added two new test methods to verify custom agent availability and listing functionality
  • Added required imports (System.ComponentModel and Microsoft.Extensions.AI) to support AI tool integration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +210 to +211
Description = "An dd agent",
Prompt = "You are an dd agent",
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The grammatical error "An dd agent" should be corrected to "A dd agent" (assuming "dd" is an acronym or abbreviation). If "dd" stands for something specific like "Data Dump" or similar, consider spelling it out for clarity in the description.

Suggested change
Description = "An dd agent",
Prompt = "You are an dd agent",
Description = "A dd agent",
Prompt = "You are a dd agent",

Copilot uses AI. Check for mistakes.
{
Name = "dd-agent",
DisplayName = "dd Agent",
Description = "An dd agent",
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The grammatical error "An dd agent" should be corrected to "A dd agent" (assuming "dd" is an acronym or abbreviation). If "dd" stands for something specific, consider spelling it out for clarity in the description.

Copilot uses AI. Check for mistakes.
Comment on lines +250 to +265
Tools = [AIFunctionFactory.Create(EncryptString, "encrypt_string")],
});

Assert.Matches(@"^[a-f0-9-]+$", session.SessionId);

await session.SendAsync(new MessageOptions { Prompt = "List All Custom Agents" });

var message = await TestHelper.GetFinalAssistantMessageAsync(session);
Assert.NotNull(message);
Assert.Contains("dd-agent", message!.Data.Content);

await session.DisposeAsync();

[Description("Encrypts a string")]
static string EncryptString([Description("String to encrypt")] string input)
=> input.ToUpperInvariant();
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The encrypt_string tool is defined but never invoked in the test. The test only verifies that the custom agent is available, similar to the first test. Consider either: 1) Removing the tool since it's not needed to verify agent availability, or 2) Adding an assertion to verify the tool can be invoked alongside the custom agent (e.g., prompting "Use encrypt_string to encrypt 'hello' and list all custom agents").

Copilot uses AI. Check for mistakes.
Comment on lines +210 to +211
Description = "An dd agent",
Prompt = "You are an dd agent",
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The grammatical error "You are an dd agent" should be corrected to "You are a dd agent" (assuming "dd" is an acronym or abbreviation). Consider also providing more context about what the "dd" agent is meant to do in the prompt.

Suggested change
Description = "An dd agent",
Prompt = "You are an dd agent",
Description = "A dd agent",
Prompt = "You are a dd agent",

Copilot uses AI. Check for mistakes.
Name = "dd-agent",
DisplayName = "dd Agent",
Description = "An dd agent",
Prompt = "You are an dd agent",
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The grammatical error "You are an dd agent" should be corrected to "You are a dd agent" (assuming "dd" is an acronym or abbreviation). Consider also providing more context about what the "dd" agent is meant to do in the prompt.

Copilot uses AI. Check for mistakes.
Comment on lines +235 to +259
var customAgents = new List<CustomAgentConfig>
{
new CustomAgentConfig
{
Name = "dd-agent",
DisplayName = "dd Agent",
Description = "An dd agent",
Prompt = "You are an dd agent",
Infer = true
}
};

var session = await Client.CreateSessionAsync(new SessionConfig
{
CustomAgents = customAgents,
Tools = [AIFunctionFactory.Create(EncryptString, "encrypt_string")],
});

Assert.Matches(@"^[a-f0-9-]+$", session.SessionId);

await session.SendAsync(new MessageOptions { Prompt = "List All Custom Agents" });

var message = await TestHelper.GetFinalAssistantMessageAsync(session);
Assert.NotNull(message);
Assert.Contains("dd-agent", message!.Data.Content);
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

There is significant duplication between this test and Should_Custom_Agent_Availability. Both tests create the same custom agent configuration and perform identical assertions. Consider extracting the common custom agent configuration into a helper method or private field, or consolidate these tests if they're meant to verify the same behavior.

Copilot uses AI. Check for mistakes.
patniko and others added 2 commits January 28, 2026 11:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

2 participants