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

# TryCommand

> `dotnet odata-mcp try &lt;url&gt;`: probe a service before committing to it. Fetches `$metadata`, reads one row from the first entity set, says which of the ...

## Definition

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

**Namespace:** Microsoft.OData.Mcp.Tools.Commands

**Inheritance:** System.Object

## Syntax

```csharp theme={null}
Microsoft.OData.Mcp.Tools.Commands.TryCommand
```

## Summary

`dotnet odata-mcp try &lt;url&gt;`: probe a service before committing to it. Fetches `$metadata`, reads one row
from the first entity set, says which of the two is secured, checks the row against the model, and prints a
verdict. With auth flags it probes again through the authenticating client; without them, on a 401 it runs
OAuth discovery and prints what it found.

## Examples

```csharp theme={null}
dotnet odata-mcp try https://services.odata.org/V4/Northwind/Northwind.svc
dotnet odata-mcp try https://api.example.com/odata --client-id {app-id}
```

## Constructors

### &#x20;.ctor

#### Syntax

```csharp theme={null}
public TryCommand()
```

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public Object()
```

## Properties

### &#x20;ApiKey

Gets or sets the raw API key value for the API key escape hatch.

#### Syntax

```csharp theme={null}
public string ApiKey { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;ApiKeyHeader

Gets or sets the header name [TryCommand.ApiKey](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/Tools/Commands/TryCommand.md#apikey) is sent under.

#### Syntax

```csharp theme={null}
public string ApiKeyHeader { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;AuthServer

Gets or sets the operator's authorization server override.

#### Syntax

```csharp theme={null}
public string AuthServer { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;AuthTimeout

Gets or sets how long, in seconds, an interactive grant may run before it is abandoned.

#### Syntax

```csharp theme={null}
public System.Nullable<int> AuthTimeout { get; set; }
```

#### Property Value

Type: `System.Nullable<int>?`

### &#x20;AuthToken

Gets or sets the authentication token.

#### Syntax

```csharp theme={null}
public string AuthToken { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;BasicPassword

Gets or sets the RFC 7617 Basic authentication password.

#### Syntax

```csharp theme={null}
public string BasicPassword { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;BasicUser

Gets or sets the RFC 7617 Basic authentication user name.

#### Syntax

```csharp theme={null}
public string BasicUser { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;ClientId

Gets or sets the OAuth client id this process authenticates as.

#### Syntax

```csharp theme={null}
public string ClientId { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;ClientMetadataDocument

Gets or sets the client identity metadata document (CIMD) URI.

#### Syntax

```csharp theme={null}
public string ClientMetadataDocument { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;ClientSecret

Gets or sets the OAuth client secret for a confidential client.

#### Syntax

```csharp theme={null}
public string ClientSecret { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;Grant

Gets or sets the operator's `--grant` selection.

#### Syntax

```csharp theme={null}
public string Grant { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;IdpClientId

Gets or sets the enterprise IdP client id used to obtain the id token the identity assertion grant exchanges.

#### Syntax

```csharp theme={null}
public string IdpClientId { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;IdpClientSecret

Gets or sets the enterprise IdP client secret.

#### Syntax

```csharp theme={null}
public string IdpClientSecret { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;IdpIdTokenFile

Gets or sets the path to a UTF-8 OIDC id token file for the identity assertion grant.

#### Syntax

```csharp theme={null}
public string IdpIdTokenFile { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;IdpScope

Gets or sets the scope requested from the enterprise IdP.

#### Syntax

```csharp theme={null}
public string IdpScope { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;IdpTokenEndpoint

Gets or sets the enterprise IdP token endpoint.

#### Syntax

```csharp theme={null}
public string IdpTokenEndpoint { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;IdpUrl

Gets or sets the enterprise IdP base URL.

#### Syntax

```csharp theme={null}
public string IdpUrl { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;Output

Gets or sets where the probe report is written. Defaults to [Out](https://learn.microsoft.com/dotnet/api/system.console.out).

#### Syntax

```csharp theme={null}
public System.IO.TextWriter Output { get; set; }
```

#### Property Value

Type: `System.IO.TextWriter`

### &#x20;RedirectUri

Gets or sets the loopback redirect URI override for the authorization code grant.

#### Syntax

```csharp theme={null}
public string RedirectUri { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;Resource

Gets or sets the RFC 8707 resource indicator / audience override.

#### Syntax

```csharp theme={null}
public string Resource { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;Scopes

Gets or sets the fallback scope list requested when the authorization server advertises none.

#### Syntax

```csharp theme={null}
public string Scopes { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;TokenCache

Gets or sets the directory the Latchkey File and Dpapi backends store cached tokens in.

#### Syntax

```csharp theme={null}
public string TokenCache { get; set; }
```

#### Property Value

Type: `string?`

### &#x20;Url

Gets or sets the OData service root URL. A pasted `$metadata` URL is accepted.

#### Syntax

```csharp theme={null}
public string Url { get; set; }
```

#### Property Value

Type: `string?`

## Methods

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;OnExecuteAsync

Runs the probe and prints the report.

#### Syntax

```csharp theme={null}
public System.Threading.Tasks.Task<int> OnExecuteAsync()
```

#### Returns

Type: `System.Threading.Tasks.Task<int>`
0 when the service is ready, [TryCommand.ExitSignInRequired](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/Tools/Commands/TryCommand.md#exitsigninrequired) when it needs sign-in no flag provided, 1 otherwise.

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual string ToString()
```

#### Returns

Type: `string?`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.