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

# ODataMcpFormElicitation

> Before-invoke form elicitation: client gate, MRTR, merge, decline.

## Definition

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

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

**Inheritance:** System.Object

## Syntax

```csharp theme={"dark"}
Microsoft.OData.Mcp.Core.Catalog.ODataMcpFormElicitation
```

## Summary

Before-invoke form elicitation: client gate, MRTR, merge, decline.

## Remarks

Tools (remote `$metadata`) uses this before invoke with [ElicitFormMapper](https://si.nimbleapps.cloud/odata-mcp/api-reference/Microsoft/OData/Mcp/Core/Catalog/ElicitFormMapper.md).
In-process AspNetCore actions call `RequireForm`. Schema `default` is the form
author's; the harness may pre-fill the widget from tool arguments.

## Methods

### &#x20;BeforeInvokeAsync

Collects operator fields before OData invoke when the action has
`Microsoft.OData.Mcp.V1.ElicitForm` and the client advertised form elicitation.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.ValueTask<ModelContextProtocol.Protocol.CallToolRequestParams> BeforeInvokeAsync(ModelContextProtocol.Server.RequestContext<ModelContextProtocol.Protocol.CallToolRequestParams> request, Microsoft.OData.Mcp.Core.Models.EdmElicitForm form, System.Func<ModelContextProtocol.Protocol.ElicitRequestParams> buildLive, System.Threading.CancellationToken cancellationToken, System.Func<ModelContextProtocol.Protocol.InputRequest> toInputRequest = null)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `request` | `ModelContextProtocol.Server.RequestContext<ModelContextProtocol.Protocol.CallToolRequestParams>` | The call request. |
| `form` | `Microsoft.OData.Mcp.Core.Models.EdmElicitForm?` | The catalog form, or [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the term is omitted. |
| `buildLive` | `System.Func<ModelContextProtocol.Protocol.ElicitRequestParams>?` | Optional live schema factory for session `ElicitAsync`. When omitted, |
| [ElicitFormMapper](https://si.nimbleapps.cloud/odata-mcp/api-reference/Microsoft/OData/Mcp/Core/Catalog/ElicitFormMapper.md) projects *form*. | | |
| `cancellationToken` | `System.Threading.CancellationToken` | The cancellation token. |
| `toInputRequest` | `System.Func<ModelContextProtocol.Protocol.InputRequest>?` | Optional cached MRTR payload. When omitted, the schema is serialized with |
| `ElicitRequestParams)`. | | |

#### Returns

Type: `System.Threading.Tasks.ValueTask<ModelContextProtocol.Protocol.CallToolRequestParams?>`
Merged call params after accept; [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when elicitation does not apply.

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *request* is [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). |
| `InputRequiredException` | Thrown for MRTR on stateless Streamable HTTP. |
| `ODataFormElicitationDeclinedException` | Thrown when the operator declines or cancels. |
| `InvalidOperationException` | Thrown when the form message is empty. |


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