Skip to content

Investigation into setting IsServerCommandInvoked more locally#874

Merged
alzimmermsft merged 4 commits intomicrosoft:mainfrom
alzimmermsft:LookIntoIsServerCommandInvoked
Oct 20, 2025
Merged

Investigation into setting IsServerCommandInvoked more locally#874
alzimmermsft merged 4 commits intomicrosoft:mainfrom
alzimmermsft:LookIntoIsServerCommandInvoked

Conversation

@alzimmermsft
Copy link
Copy Markdown
Contributor

What does this PR do?

[Provide a clear, concise description of the changes]

[Any additional context, screenshots, or information that helps reviewers]

GitHub issue number?

[Link to the GitHub issue this PR addresses]

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated test prompts in /servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

@joshfree joshfree moved this from Untriaged to In Progress in Azure MCP Server Oct 20, 2025
@joshfree joshfree added this to the 2025-10 milestone Oct 20, 2025
@alzimmermsft alzimmermsft marked this pull request as ready for review October 20, 2025 16:46
@alzimmermsft alzimmermsft requested a review from a team as a code owner October 20, 2025 16:46
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

This PR refactors telemetry instrumentation to set the IsServerCommandInvoked tag closer to where command execution decisions are made, rather than assuming all calls invoke server commands by default. The changes improve accuracy by setting the tag within specific execution paths (learn mode vs command mode) across multiple tool loader implementations.

Key changes:

  • Removed premature/default telemetry tag setting from McpRuntime and tool loader entry points
  • Added explicit telemetry tag setting in learn mode methods (false) and command execution methods (true)
  • Minor code modernization (collection expressions, lambda parameter simplification)

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
TelemetryService.cs Modernized collection syntax using collection expressions and removed unused imports
CommandFactory.cs Simplified lambda parameter names to use type inference
SingleProxyToolLoader.cs Moved IsServerCommandInvoked telemetry tag from entry point to specific execution path methods
ServerToolLoader.cs Relocated telemetry tag setting from conditional block to actual command invocation point
NamespaceToolLoader.cs Moved telemetry tag assignment from learn mode check to command execution method
McpRuntime.cs Removed default assumption that all tool calls invoke server commands

Copy link
Copy Markdown
Member

@conniey conniey left a comment

Choose a reason for hiding this comment

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

CHANGELOG comment in "Other changes"?
I was thinking about how to test these code paths in unit tests but could not figure out anything reasonable. Hmm

@alzimmermsft alzimmermsft merged commit 8ae9e6f into microsoft:main Oct 20, 2025
24 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Oct 20, 2025
@alzimmermsft alzimmermsft deleted the LookIntoIsServerCommandInvoked branch October 20, 2025 18:57
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Dec 8, 2025
…soft#874)

* Investigation into setting IsServerCommandInvoked more locally

* Fix linting

* CHANGELOG entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants