Definition
Assembly: Microsoft.OData.Mcp.Core.dll Namespace: Microsoft.OData.Mcp.Core.Routing Inheritance: System.ValueTypeSyntax
Summary
High-performance route parser using ReadOnlySpan for zero-allocation parsing.Remarks
This parser handles MCP routes in the format: //mcp/ where can be empty, and is optional.Constructors
.ctor
Initializes a new instance of the SpanRouteParser struct.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
path | System.ReadOnlySpan<char> | The path to parse. |
Methods
IsMcpRoute
Checks if the path is an MCP route without parsing details.Syntax
Returns
Type:bool
True if this is an MCP route; otherwise, false.
TryGetMcpCommand
Gets the MCP command from the path.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
command | Microsoft.OData.Mcp.Core.Routing.McpCommand | The MCP command. |
Returns
Type:bool
True if a command was found; otherwise, false.
TryGetODataRoute
Extracts just the OData route portion from an MCP path.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
odataRoute | System.ReadOnlySpan<char> | The OData route prefix. |
Returns
Type:bool
True if an OData route was found; otherwise, false.
TryGetToolName
Extracts the tool name from a tool info request path.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
toolName | System.ReadOnlySpan<char> | The tool name. |
Returns
Type:bool
True if a tool name was found; otherwise, false.
TryParseMcpRoute
Attempts to parse an MCP route from the path.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
odataRoute | System.ReadOnlySpan<char> | The OData route prefix, if found. |
mcpCommand | System.ReadOnlySpan<char> | The MCP command, if specified. |
Returns
Type:bool
True if this is an MCP route; otherwise, false.