Add AI/MCP Client example#486
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new ExtAIBot sample demonstrating Microsoft.Extensions.AI + Azure OpenAI + MCP tools, and extends the Teams SDK surface to support richer final streamed messages (feedback modes + suggested actions) and Teams feedback-related invoke routing.
Changes:
- Added
core/samples/ExtAIBotsample (agent orchestration, MCP tool wiring, local tools, citation extraction, feedback UI). - Enhanced streaming finalization to support explicit feedback modes, suggested actions, and attachment-only final messages.
- Added SDK support for
message/fetchTaskinvokes and a typedmessage/submitAction“feedback” route, plus new channelData schema forfeedbackLoop.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/Microsoft.Teams.Apps/TeamsStreamingWriter.cs | Extends FinalizeResponseAsync and final-activity building to support feedback mode/suggested actions/text override. |
| core/src/Microsoft.Teams.Apps/Schema/TeamsChannelData.cs | Adds channelData.feedbackLoop schema + parsing and FeedbackType constants. |
| core/src/Microsoft.Teams.Apps/Schema/TeamsAttachmentBuilder.cs | Adds a new using (currently unused). |
| core/src/Microsoft.Teams.Apps/Schema/SuggestedAction.cs | Extends ctor to allow explicit value (defaults to title). |
| core/src/Microsoft.Teams.Apps/Schema/Entities/CitationEntity.cs | Adds AddFeedback(string mode) overload for feedbackLoop. |
| core/src/Microsoft.Teams.Apps/Handlers/MessageSubmitActionHandler.Value.cs | Adds typed payload model for submit-feedback value. |
| core/src/Microsoft.Teams.Apps/Handlers/MessageSubmitActionHandler.cs | Adds OnMessageSubmitFeedback route helper. |
| core/src/Microsoft.Teams.Apps/Handlers/MessageFetchTaskHandler.Value.cs | Adds typed payload model for message/fetchTask. |
| core/src/Microsoft.Teams.Apps/Handlers/MessageFetchTaskHandler.cs | Adds OnMessageFetchTask route helper returning task module invoke responses. |
| core/src/Microsoft.Teams.Apps/Handlers/InvokeHandler.Activity.cs | Adds InvokeNames.MessageFetchTask. |
| core/samples/StreamingBot/Program.cs | Updates sample to use new feedback mode constant. |
| core/samples/ExtAIBot/README.md | Documents the new sample’s architecture, setup, and flows. |
| core/samples/ExtAIBot/Program.cs | Wires up bot, streaming agent response, fetchTask feedback UI, and submit-feedback handler. |
| core/samples/ExtAIBot/Agent.cs | Implements streaming chat + per-conversation history + follow-up suggestion generation. |
| core/samples/ExtAIBot/LocalTools.cs | Adds local clarification tool that emits an Adaptive Card. |
| core/samples/ExtAIBot/McpTools.cs | Adds MCP client/tool wrapper to capture citations. |
| core/samples/ExtAIBot/CitationCollector.cs | Extracts citations from MCP results and builds Teams citation entities. |
| core/samples/ExtAIBot/appsettings.json | Adds sample configuration template. |
| core/samples/ExtAIBot/ExtAIBot.csproj | New sample project + package references. |
| core/core.slnx | Adds ExtAIBot to the core solution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ams.net into mehak/ext-ai-sample
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 8 comments.
Comments suppressed due to low confidence (1)
core/src/Microsoft.Teams.Apps/Schema/TeamsChannelData.cs:1
- The XML docs state
FeedbackLooptakes precedence overFeedbackLoopEnabled, but the constructor currently leavesFeedbackLoopEnabledpopulated when both properties exist. To align behavior with the documented precedence (and avoid emitting/propagating a state Teams may reject), setFeedbackLoopEnabled = nullwhenFeedbackLoopis successfully deserialized.
// Copyright (c) Microsoft Corporation.
rido-min
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new sample Teams bot,
ExtAIBot, that demonstrates the integration of Microsoft.Extensions.AI with Azure OpenAI and the Model Context Protocol (MCP) for advanced conversational capabilities. The main changes include the implementation of the bot’s core logic, support for streaming responses, per-conversation memory, local and remote tool invocation, and feedback handling. Additionally, supporting infrastructure and documentation are provided.Key new features and infrastructure:
ExtAIBot Sample Implementation
ExtAIBotsample including core files:Agent.cs(conversation logic with streaming, memory, and tool invocation),LocalTools.cs(local AI tool definitions),McpTools.cs(MCP client and tool wrapping for citations), andCitationCollector.cs(parsing and accumulating citations for Teams messages).Program.csto wire up the Teams bot, register message and feedback handlers, and delegate AI execution to theAgent.Feedback Handling Support
message/fetchTaskand associated data classes in the Teams SDK.Configuration and Documentation
appsettings.jsonand updated the project file to include all necessary dependencies and references for running the sample.README.mdwith setup instructions, architecture diagrams, and example interactions to help users understand and run the sample.