Language

SearchRouteAttribute(String, String, Boolean, UInt16, String) Constructor

Definition

Attribute to define a route that handles Adaptive Card dynamic search (application/search) invoke activities, optionally matching a specific dataset or dataset pattern.

public SearchRouteAttribute(string dataset = default, string datasetRegex = default, bool isAgenticOnly = false, ushort rank = 32767, string autoSignInHandlers = default);
new Microsoft.Agents.Builder.App.AdaptiveCards.SearchRouteAttribute : string * string * bool * uint16 * string -> Microsoft.Agents.Builder.App.AdaptiveCards.SearchRouteAttribute
Public Sub New (Optional dataset As String = Nothing, Optional datasetRegex As String = Nothing, Optional isAgenticOnly As Boolean = false, Optional rank As UShort = 32767, Optional autoSignInHandlers As String = Nothing)

Parameters

dataset
String

The exact dataset to match. Mutually exclusive with datasetRegex. When both are omitted, all datasets are matched.

datasetRegex
String

A regular expression pattern matched against the search dataset. Mutually exclusive with dataset.

isAgenticOnly
Boolean

When true, the route only fires for agentic turns. Defaults to false.

rank
UInt16

Route evaluation order. Lower values run first. Defaults to Unspecified.

autoSignInHandlers
String

A comma/space/semicolon-delimited list of OAuth sign-in handler names, or the name of an instance or static method on the agent class matching Func<ITurnContext, string[]>.

Remarks

Decorate a method with this attribute to register it as a handler for Adaptive Card search events. Provide dataset for an exact match, datasetRegex for a pattern match, or neither to match any dataset. dataset and datasetRegex are mutually exclusive. The method must match the SearchHandler delegate signature.

[SearchRoute("npm")]
public async Task<IList<AdaptiveCardsSearchResult>> OnNpmSearchAsync(ITurnContext turnContext, ITurnState turnState, Query<AdaptiveCardsSearchParams> query, CancellationToken cancellationToken)
{
    // Handle search for dataset "npm"
}

Applies to