Skip to content

Migrate Search tools to new tool design#2954

Open
alzimmermsft wants to merge 1 commit into
microsoft:mainfrom
alzimmermsft:MigrateSearchToNewToolDesign
Open

Migrate Search tools to new tool design#2954
alzimmermsft wants to merge 1 commit into
microsoft:mainfrom
alzimmermsft:MigrateSearchToNewToolDesign

Conversation

@alzimmermsft

Copy link
Copy Markdown
Contributor

What does this PR do?

Migrates Search tools to new design where Register and Bind options are based on Option attributes.

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
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide
  • 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 running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • 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 tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • 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 command list in servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran ./eng/scripts/Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 migrates the Azure Search toolset commands from explicit RegisterOptions/BindOptions(ParseResult) patterns to the newer attribute-based options model (Options POCO + [Option]/[OptionContainer]), aligning Search commands with the newer command base classes and reducing direct System.CommandLine usage in the toolset.

Changes:

  • Converted Search commands to the new AuthenticatedCommand<TOptions, TResult> / SubscriptionCommand<TOptions, TResult> style with Options POCO binding.
  • Replaced legacy option definition classes/base option types with [Option]-attributed options and a new SearchOptionDescriptions constants holder.
  • Simplified toolset dependencies (e.g., removed explicit System.CommandLine package reference) and adjusted tests/service construction accordingly.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.Search/tests/Azure.Mcp.Tools.Search.Tests/Service/ServiceListCommandTests.cs Updates test base class to match new subscription command shape.
tools/Azure.Mcp.Tools.Search/tests/Azure.Mcp.Tools.Search.Tests/Service/SearchServiceTests.cs Updates service instantiation after constructor signature change.
tools/Azure.Mcp.Tools.Search/src/Services/SearchService.cs Removes logger dependency and updates usings for System.Text.Json.
tools/Azure.Mcp.Tools.Search/src/Services/ISearchService.cs Adds System.Text.Json import for JsonElement return types.
tools/Azure.Mcp.Tools.Search/src/Options/Service/ServiceListOptions.cs Converts subscription options to [Option] attributes + ISubscriptionOption.
tools/Azure.Mcp.Tools.Search/src/Options/SearchOptionDescriptions.cs Adds centralized option description constants for Search options.
tools/Azure.Mcp.Tools.Search/src/Options/SearchOptionDefinitions.cs Removes legacy System.CommandLine-based option definitions.
tools/Azure.Mcp.Tools.Search/src/Options/Knowledge/KnowledgeSourceGetOptions.cs Converts options to [Option] attribute model.
tools/Azure.Mcp.Tools.Search/src/Options/Knowledge/KnowledgeBaseRetrieveOptions.cs Converts options to [Option] attribute model (query/messages/service/retry).
tools/Azure.Mcp.Tools.Search/src/Options/Knowledge/KnowledgeBaseGetOptions.cs Converts options to [Option] attribute model.
tools/Azure.Mcp.Tools.Search/src/Options/Index/IndexQueryOptions.cs Converts options to [Option] attribute model.
tools/Azure.Mcp.Tools.Search/src/Options/Index/IndexGetOptions.cs Converts options to [Option] attribute model.
tools/Azure.Mcp.Tools.Search/src/Options/Index/BaseIndexOptions.cs Removes obsolete base options type.
tools/Azure.Mcp.Tools.Search/src/Options/BaseSearchOptions.cs Removes obsolete base options type.
tools/Azure.Mcp.Tools.Search/src/Models/IndexInfo.cs Removes explicit JSON property annotations (rely on serializer naming policy).
tools/Azure.Mcp.Tools.Search/src/Models/FieldInfo.cs Removes explicit JSON property annotations (rely on serializer naming policy).
tools/Azure.Mcp.Tools.Search/src/GlobalUsings.cs Removes global usings no longer needed after migration.
tools/Azure.Mcp.Tools.Search/src/Commands/Service/ServiceListCommand.cs Migrates to SubscriptionCommand<TOptions, TResult> and options binding model.
tools/Azure.Mcp.Tools.Search/src/Commands/SearchJsonContext.cs Simplifies source-gen context declaration.
tools/Azure.Mcp.Tools.Search/src/Commands/Knowledge/KnowledgeSourceGetCommand.cs Migrates to AuthenticatedCommand<TOptions, TResult> + options binding model.
tools/Azure.Mcp.Tools.Search/src/Commands/Knowledge/KnowledgeBaseRetrieveCommand.cs Migrates to AuthenticatedCommand<TOptions, TResult> and moves validation into ValidateOptions.
tools/Azure.Mcp.Tools.Search/src/Commands/Knowledge/KnowledgeBaseGetCommand.cs Migrates to AuthenticatedCommand<TOptions, TResult> + options binding model.
tools/Azure.Mcp.Tools.Search/src/Commands/Index/IndexQueryCommand.cs Migrates to AuthenticatedCommand<TOptions, TResult> and updates result type.
tools/Azure.Mcp.Tools.Search/src/Commands/Index/IndexGetCommand.cs Migrates to AuthenticatedCommand<TOptions, TResult> + options binding model.
tools/Azure.Mcp.Tools.Search/src/Azure.Mcp.Tools.Search.csproj Updates core ProjectReference path and removes System.CommandLine PackageReference.
servers/Azure.Mcp.Server/changelog-entries/1782416793886.yaml Adds changelog entry indicating breaking changes for Search tools.

@alzimmermsft alzimmermsft enabled auto-merge (squash) June 25, 2026 21:20

@jongio jongio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean migration that follows the pattern established by the ACR, StorageSync, and Monitor migrations. One minor nit below.

Note: the existing Copilot bot comment about options.Messages.Index() not compiling is incorrect. Enumerable.Index() is available in .NET 9+ and the repo targets net10.0, so it compiles fine (CI confirms).

namespace Azure.Mcp.Tools.Search.Options.Index;

public class IndexQueryOptions : BaseIndexOptions
public class IndexQueryOptions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: all other options classes in this PR are public sealed class (consistent with the StorageSync migration pattern). This one is public class without sealed. Likely just an oversight.

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

Labels

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

3 participants