Skip to content

Add AI/MCP Client example#486

Merged
MehakBindra merged 16 commits into
mainfrom
mehak/ext-ai-sample
May 15, 2026
Merged

Add AI/MCP Client example#486
MehakBindra merged 16 commits into
mainfrom
mehak/ext-ai-sample

Conversation

@MehakBindra
Copy link
Copy Markdown
Collaborator

@MehakBindra MehakBindra commented May 7, 2026

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

  • Added the complete ExtAIBot sample 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), and CitationCollector.cs (parsing and accumulating citations for Teams messages).
  • Implemented Program.cs to wire up the Teams bot, register message and feedback handlers, and delegate AI execution to the Agent.

Feedback Handling Support

  • Added support for Teams feedback via new invoke names and value types, including message/fetchTask and associated data classes in the Teams SDK.
  • Implemented feedback collection and UI in the sample bot, including Adaptive Card generation for feedback and console logging of user input.

Configuration and Documentation

  • Added appsettings.json and updated the project file to include all necessary dependencies and references for running the sample.
  • Provided a comprehensive README.md with setup instructions, architecture diagrams, and example interactions to help users understand and run the sample.

@MehakBindra MehakBindra changed the title init Add AI/MCP Client example May 7, 2026
@MehakBindra MehakBindra marked this pull request as ready for review May 11, 2026 23:35
Copilot AI review requested due to automatic review settings May 11, 2026 23:35
@MehakBindra MehakBindra marked this pull request as draft May 11, 2026 23:40
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 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/ExtAIBot sample (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/fetchTask invokes and a typed message/submitAction “feedback” route, plus new channelData schema for feedbackLoop.

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.

Comment thread core/src/Microsoft.Teams.Apps/Schema/TeamsAttachmentBuilder.cs Outdated
Comment thread core/src/Microsoft.Teams.Apps/TeamsStreamingWriter.cs
Comment thread core/src/Microsoft.Teams.Apps/Schema/Entities/CitationEntity.cs
Comment thread core/samples/ExtAIBot/Agent.cs Outdated
Comment thread core/samples/ExtAIBot/Agent.cs Outdated
Comment thread core/samples/ExtAIBot/Program.cs Outdated
Comment thread core/samples/ExtAIBot/LocalTools.cs Outdated
@MehakBindra MehakBindra marked this pull request as ready for review May 12, 2026 22:01
Copilot AI review requested due to automatic review settings May 12, 2026 22:01
@MehakBindra MehakBindra requested review from rido-min and singhk97 May 12, 2026 22:05
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

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 FeedbackLoop takes precedence over FeedbackLoopEnabled, but the constructor currently leaves FeedbackLoopEnabled populated when both properties exist. To align behavior with the documented precedence (and avoid emitting/propagating a state Teams may reject), set FeedbackLoopEnabled = null when FeedbackLoop is successfully deserialized.
// Copyright (c) Microsoft Corporation.

Comment thread core/src/Microsoft.Teams.Apps/TeamsStreamingWriter.cs
Comment thread core/src/Microsoft.Teams.Apps/Schema/SuggestedAction.cs
Comment thread core/samples/ExtAIBot/Program.cs Outdated
Comment thread core/samples/ExtAIBot/CitationCollector.cs Outdated
Comment thread core/samples/ExtAIBot/CitationCollector.cs
Comment thread core/samples/ExtAIBot/Agent.cs
Comment thread core/samples/ExtAIBot/TeamsBotAppHandlers.cs
Comment thread core/samples/ExtAIBot/README.md Outdated
Copilot AI review requested due to automatic review settings May 14, 2026 01:39
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

Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.

@MehakBindra MehakBindra merged commit 1ed9636 into main May 15, 2026
10 checks passed
@MehakBindra MehakBindra deleted the mehak/ext-ai-sample branch May 15, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants