Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Extend sample to show how to use MCP Tools from an Agent #11361

Conversation

markwallace-microsoft
Copy link
Member

Motivation and Context

Extend the sample to show how to use MCP Tools from an Agent.

Description

Contribution Checklist

@markwallace-microsoft markwallace-microsoft requested a review from a team as a code owner April 3, 2025 14:21
@markwallace-microsoft markwallace-microsoft added the .NET Issue or Pull requests regarding .NET code label Apr 3, 2025
@github-actions github-actions bot changed the title Extend sample to show how to use MCP Tools from an Agent .Net: Extend sample to show how to use MCP Tools from an Agent Apr 3, 2025
SergeyMenshykh
SergeyMenshykh previously approved these changes Apr 4, 2025
westey-m
westey-m previously approved these changes Apr 4, 2025
RogerBarreto
RogerBarreto previously approved these changes Apr 4, 2025
Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
@markwallace-microsoft markwallace-microsoft added this pull request to the merge queue Apr 7, 2025
github-merge-queue bot pushed a commit that referenced this pull request Apr 7, 2025
### Motivation and Context

Extend the sample to show how to use MCP Tools from an Agent.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

---------

Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
Comment on lines +85 to +86
ChatMessageContent response = await agent.InvokeAsync("Summarize the last four commits to the microsoft/semantic-kernel repository?").FirstAsync();
Console.WriteLine($"\n\nResponse from GitHubAgent:\n{response.Content}");
Copy link
Member

Choose a reason for hiding this comment

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

May be simpler just use the ToString() implicit here.

Suggested change
ChatMessageContent response = await agent.InvokeAsync("Summarize the last four commits to the microsoft/semantic-kernel repository?").FirstAsync();
Console.WriteLine($"\n\nResponse from GitHubAgent:\n{response.Content}");
var response = await agent.InvokeAsync("Summarize the last four commits to the microsoft/semantic-kernel repository?").FirstAsync();
Console.WriteLine($"\n\nResponse from GitHubAgent:\n{response}");
Suggested change
ChatMessageContent response = await agent.InvokeAsync("Summarize the last four commits to the microsoft/semantic-kernel repository?").FirstAsync();
Console.WriteLine($"\n\nResponse from GitHubAgent:\n{response.Content}");
ChatMessageContent response = await agent.InvokeAsync("Summarize the last four commits to the microsoft/semantic-kernel repository?").FirstAsync();
Console.WriteLine($"\n\nResponse from GitHubAgent:\n{response.Content}");

Merged via the queue into microsoft:main with commit 61c3fdc Apr 7, 2025
20 checks passed
@markwallace-microsoft markwallace-microsoft deleted the users/markwallace/mcp_agent_sample branch April 7, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants