> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# SpanRouteParser

> High-performance route parser using ReadOnlySpan for zero-allocation parsing.

export function DocsBadge({text, variant = 'neutral'}) {
  const variantClasses = {
    success: 'mint-bg-green-500/10 mint-text-green-600 dark:mint-text-green-400 mint-border-green-500/20',
    neutral: 'mint-bg-slate-500/10 mint-text-slate-600 dark:mint-text-slate-400 mint-border-slate-500/20',
    info: 'mint-bg-blue-500/10 mint-text-blue-600 dark:mint-text-blue-400 mint-border-blue-500/20',
    warning: 'mint-bg-amber-500/10 mint-text-amber-600 dark:mint-text-amber-400 mint-border-amber-500/20',
    danger: 'mint-bg-red-500/10 mint-text-red-600 dark:mint-text-red-400 mint-border-red-500/20'
  };
  const classes = variantClasses[variant] || variantClasses.neutral;
  return <span className={`mint-inline-flex mint-items-center mint-px-2 mint-py-0.5 mint-rounded-full mint-text-xs mint-font-medium mint-tracking-wide mint-border mint-ml-1.5 mint-align-middle mint-whitespace-nowrap ${classes}`}>
      {text}
    </span>;
}

## Definition

**Assembly:** Microsoft.OData.Mcp.Core.dll

**Namespace:** Microsoft.OData.Mcp.Core.Routing

**Inheritance:** System.ValueType

## Syntax

```csharp theme={"dark"}
Microsoft.OData.Mcp.Core.Routing.SpanRouteParser
```

## Summary

High-performance route parser using ReadOnlySpan for zero-allocation parsing.

## Remarks

This parser handles MCP routes in the format: /{odataRoute}/mcp/{command}
where {odataRoute} can be empty, and {command} is optional.

## Constructors

### <Icon icon="hammer" iconType="duotone" color="#419AC5" size={24} style={{ paddingRight: '8px' }} />  .ctor

Initializes a new instance of the [SpanRouteParser](/odata-mcp/api-reference/Microsoft/OData/Mcp/Core/Routing/SpanRouteParser) struct.

#### Syntax

```csharp theme={"dark"}
public SpanRouteParser(System.ReadOnlySpan<char> path)
```

#### Parameters

| Name   | Type                        | Description        |
| ------ | --------------------------- | ------------------ |
| `path` | `System.ReadOnlySpan<char>` | The path to parse. |

## Methods

### <Icon icon="function" iconType="duotone" color="#419AC5" size={24} style={{ paddingRight: '8px' }} />  IsMcpRoute

Checks if the path is an MCP route without parsing details.

#### Syntax

```csharp theme={"dark"}
public bool IsMcpRoute()
```

#### Returns

Type: `bool`
True if this is an MCP route; otherwise, false.

### <Icon icon="function" iconType="duotone" color="#419AC5" size={24} style={{ paddingRight: '8px' }} />  TryGetMcpCommand

Gets the MCP command from the path.

#### Syntax

```csharp theme={"dark"}
public bool TryGetMcpCommand(out Microsoft.OData.Mcp.Core.Routing.McpCommand command)
```

#### 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.

### <Icon icon="function" iconType="duotone" color="#419AC5" size={24} style={{ paddingRight: '8px' }} />  TryGetODataRoute

Extracts just the OData route portion from an MCP path.

#### Syntax

```csharp theme={"dark"}
public bool TryGetODataRoute(out System.ReadOnlySpan<char> odataRoute)
```

#### Parameters

| Name         | Type                        | Description             |
| ------------ | --------------------------- | ----------------------- |
| `odataRoute` | `System.ReadOnlySpan<char>` | The OData route prefix. |

#### Returns

Type: `bool`
True if an OData route was found; otherwise, false.

### <Icon icon="function" iconType="duotone" color="#419AC5" size={24} style={{ paddingRight: '8px' }} />  TryGetToolName

Extracts the tool name from a tool info request path.

#### Syntax

```csharp theme={"dark"}
public bool TryGetToolName(out System.ReadOnlySpan<char> toolName)
```

#### Parameters

| Name       | Type                        | Description    |
| ---------- | --------------------------- | -------------- |
| `toolName` | `System.ReadOnlySpan<char>` | The tool name. |

#### Returns

Type: `bool`
True if a tool name was found; otherwise, false.

### <Icon icon="function" iconType="duotone" color="#419AC5" size={24} style={{ paddingRight: '8px' }} />  TryParseMcpRoute

Attempts to parse an MCP route from the path.

#### Syntax

```csharp theme={"dark"}
public bool TryParseMcpRoute(out System.ReadOnlySpan<char> odataRoute, out System.ReadOnlySpan<char> mcpCommand)
```

#### 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.
