Skip to content

Enhance ResearcherAgent to handle Microsoft Learn MCP server unavaila… - #27

Merged
JesseLiberty merged 1 commit into
mainfrom
copilot-suggested-change-limit-researcher-log
Sep 6, 2026
Merged

Enhance ResearcherAgent to handle Microsoft Learn MCP server unavaila…#27
JesseLiberty merged 1 commit into
mainfrom
copilot-suggested-change-limit-researcher-log

Conversation

@JesseLiberty

Copy link
Copy Markdown
Owner

…bility gracefully and simplify logging of tool invocations.

…bility gracefully and simplify logging of tool invocations.
Copilot AI lite review requested due to automatic review settings September 6, 2026 13:46
@JesseLiberty
JesseLiberty merged commit a085db7 into main Sep 6, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new startup MCP client flow introduces a likely resource-lifetime/disposal issue and overly broad exception handling that can hide real startup failures.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR improves the robustness of the research toolchain by making Microsoft Learn MCP integration optional at startup (falling back to Tavily-only when unavailable) and by simplifying/safer logging around tool invocations in ResearcherAgent.

Changes:

  • Simplify ResearcherAgent tool-invocation logging to avoid emitting tool arguments.
  • Wrap Microsoft Learn MCP client initialization/tool discovery in a startup try/catch and continue without it on failure.
  • Add a dedicated startup logger for clearer warning output during initialization.
File summaries
File Description
ResearcherAgent.cs Reduces tool invocation log detail to just the tool name (no arguments).
Program.cs Makes Microsoft Learn MCP tool discovery best-effort and logs a warning when unavailable.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Program.cs
Comment on lines +127 to +138
List<AIFunction> researcherTools = [tavilyTool];
try
{
McpClient microsoftLearnMcp = await McpClient.CreateAsync(
new HttpClientTransport(new HttpClientTransportOptions
{
Endpoint = new Uri("https://learn.microsoft.com/api/mcp"),
Name = "microsoft-learn",
}));
IList<McpClientTool> microsoftLearnTools = await microsoftLearnMcp.ListToolsAsync();
researcherTools.AddRange(microsoftLearnTools);
}
Comment thread Program.cs
Comment on lines +139 to +142
catch (Exception ex)
{
startupLogger.LogWarning(ex, "Microsoft Learn MCP server unavailable; continuing with Tavily-only research tools.");
}
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