Class SpreadsheetWebMcpExecuteEventArgs
Provides information about a WebMCP tool execution request.
Inherited Members
Namespace: Syncfusion.Blazor.Spreadsheet
Assembly: Syncfusion.Blazor.Spreadsheet.dll
Syntax
public class SpreadsheetWebMcpExecuteEventArgs
Remarks
An instance of this class is supplied to the OnWebMcpExecute callback after the requested tool has been resolved and before confirmation or tool execution.
Use the properties to inspect the tool request, cancel execution, request confirmation for a write tool, or provide a response that replaces the built-in handler's output.
Command, Name, and Arguments describe the request and cannot be modified by the host; they are populated by the dispatcher and exposed through read-only accessors. Cancel, ShowConfirmationDialog, CancellationResponse, and Result are the host's output channels and remain publicly settable.
When Cancel is true, cancellation takes precedence over Result and the tool handler is not invoked. When a non-null result is supplied and execution is not cancelled, that value is returned to the requesting agent instead of the built-in tool response.
Custom tools require the host application to provide their execution response through Result in the OnWebMcpExecute callback.
Constructors
SpreadsheetWebMcpExecuteEventArgs()
Declaration
public SpreadsheetWebMcpExecuteEventArgs()
Properties
Arguments
Gets the input arguments supplied for the tool execution request.
Declaration
public IReadOnlyDictionary<string, object?>? Arguments { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | An IReadOnlyDictionary<TKey, TValue> containing argument names and native .NET values supplied by the requesting agent, or null if no arguments were supplied. |
Remarks
The values are converted to .NET objects before this callback is raised; they are not exposed as JsonElement values. Custom tool handlers can inspect these arguments when constructing Result.
The dictionary is read-only from the host's perspective so the request that the agent submitted is preserved for audit and confirmation flows.
Cancel
Gets or sets a value indicating whether the tool execution should be cancelled.
Declaration
public bool Cancel { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | true to cancel execution; otherwise, false. The default value is false. |
Remarks
Set this property to true in the OnWebMcpExecute callback to stop execution. The dispatcher returns a cancellation response instead of invoking the tool handler. Cancellation takes precedence over Result.
CancellationResponse
Gets or sets the optional response message returned when execution is cancelled.
Declaration
public string? CancellationResponse { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A custom cancellation message, or null to use the default cancellation response. |
Remarks
This value is used when Cancel is
true. The default response includes the
[USER_CANCELLED] sentinel.
Command
Gets the command associated with the tool execution request.
Declaration
public SpreadsheetWebMcpToolCommand Command { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetWebMcpToolCommand | A SpreadsheetWebMcpToolCommand identifying the built-in command or Custom for a custom tool. |
Remarks
For built-in tools, this value is the exact enum member associated with the command, such as GetActiveSheet.
Custom tools use Custom.
This property is set by the spreadsheet and cannot be changed by application code.
Name
Gets the name of the tool being executed.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string | A string containing the resolved tool name without the browser-side instance prefix. Never null; the empty string is used when the dispatcher cannot resolve a name. |
Remarks
For a built-in tool renamed through Name, this value is the configured alias. Otherwise, it is the tool's catalog name.
This property is set by the spreadsheet and cannot be changed by application code.
Result
Gets or sets a custom response payload to return to the requesting agent.
Declaration
public string? Result { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string containing the response data, or null when the built-in tool handler should provide the response. The default value is null. |
Remarks
Assign a value in the OnWebMcpExecute callback to provide the response for a custom tool or override a built-in tool's response.
The payload is treated as a string to match the convention used by the Grid and PDF Viewer WebMCP integrations. Serialize complex payloads with JsonSerializer before assigning, or assign a plain string.
When set and execution is not cancelled, the dispatcher returns this value without invoking the built-in handler. For a custom tool, provide a non-null result to handle the invocation.
Cancel takes precedence when both properties are set.
ShowConfirmationDialog
Gets or sets a value indicating whether a write tool requires host confirmation.
Declaration
public bool ShowConfirmationDialog { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | true to request confirmation before a write tool runs; otherwise, false. The default value is false. |
Remarks
Read-only tools ignore this property. For write tools, setting it to true asks the host to confirm the operation before the handler runs.