Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Routing Inheritance: System.ObjectSyntax
Summary
Efficiently matches MCP routes to their corresponding OData endpoints.Remarks
This matcher is optimized for startup-time registration and runtime lookups using frozen collections for maximum performance.Constructors
.ctor
Initializes a new instance of the McpRouteMatcher class.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
routes | System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Routing.McpRouteEntry> | The routes to register. |
Exceptions
| Exception | Description |
|---|---|
ArgumentNullException | Thrown when routes is null. |
.ctor Inherited
Inherited from
objectSyntax
Methods
BuildMcpUrl
Builds the MCP URL for a given OData route.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
odataPrefix | string | The OData route prefix. |
command | System.Nullable<Microsoft.OData.Mcp.Core.Routing.McpCommand> | The MCP command (optional). |
Returns
Type:string?
The MCP URL, or null if the route is not found.
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | - |
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
GetAllRoutes
Gets all registered routes.Syntax
Returns
Type:System.Collections.Generic.IEnumerable<Microsoft.OData.Mcp.Core.Routing.McpRouteEntry>
A collection of all registered route entries.
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
TryGetRouteByODataPrefix
Gets a route entry by its OData prefix.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
odataPrefix | string | The OData route prefix. |
route | Microsoft.OData.Mcp.Core.Routing.McpRouteEntry? | The route entry if found. |
Returns
Type:bool
True if the route was found; otherwise, false.
TryMatch
Attempts to match a request path to an MCP route.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
path | string | The request path. |
route | Microsoft.OData.Mcp.Core.Routing.McpRouteEntry? | The matched route entry. |
mcpCommand | Microsoft.OData.Mcp.Core.Routing.McpCommand | The MCP command extracted from the path. |
Returns
Type:bool
True if a route was matched; otherwise, false.