Class GridWebMcpExecuteEventArgs
Provides information about a WebMCP tool execution request.
Inherited Members
Namespace: Syncfusion.Blazor.Grids
Assembly: Syncfusion.Blazor.Grids.dll
Syntax
public class GridWebMcpExecuteEventArgs : GridEventBaseArgs
Remarks
An instance of this class is provided to the OnWebMcpExecute event whenever a WebMCP tool is invoked through a SfGrid<TValue> instance.
The properties of this class describe the requested tool and its input arguments. Use this information to inspect, audit, validate, modify, or cancel tool execution before the corresponding handler runs.
For custom tools, the host application is responsible for handling the invocation and returning a response by assigning a value to Result.
For built-in tools, the grid executes the associated built-in handler unless execution is cancelled or a custom response is provided.
Exceptions thrown during event handling are converted into structured execution-failed responses and returned to the requesting agent.
Constructors
GridWebMcpExecuteEventArgs()
Declaration
public GridWebMcpExecuteEventArgs()
Properties
Arguments
Gets or sets the input arguments supplied with the tool execution request.
Declaration
public IReadOnlyDictionary<string, object>? Arguments { get; set; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | An IReadOnlyDictionary<TKey, TValue> containing the argument names and values provided for the current tool invocation, or null if the tool does not define or receive any input arguments. |
Remarks
The arguments exposed through this property correspond to the values supplied by the requesting agent and are typically based on the tool's registered input schema.
Applications can use this property within the OnWebMcpExecute event to inspect, validate, and process the arguments associated with the current tool request.
The collection is exposed as an IReadOnlyDictionary<TKey, TValue> and is intended for reading request data.
Assigning a new value to this property does not modify the arguments used by the grid's built-in tool execution logic.
For custom tools, applications can use the supplied argument values when generating a response through Result.
To override the default behavior of a built-in tool, assign a value to Result during the OnWebMcpExecute event.
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 | A bool indicating whether execution is cancelled. true cancels the operation; otherwise, false. The default value is false. |
Remarks
Set this property to true within the
OnWebMcpExecute event to prevent the requested tool from
executing.
When execution is cancelled, the dispatcher returns a cancellation response to the requesting agent instead of invoking the associated tool handler.
CancellationResponse
Gets or sets the response message returned when execution is cancelled or when confirmation is denied.
Declaration
public string? CancellationResponse { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the message returned to the caller when the operation is cancelled or a required confirmation is rejected. The default value is null. |
Remarks
This property can be used to provide a user-friendly message that explains why the operation did not proceed.
When set to null, no custom cancellation response is specified, and the default cancellation behavior is used.
Command
Gets the command associated with the tool execution request.
Declaration
public GridWebMcpToolCommand Command { get; }
Property Value
| Type | Description |
|---|---|
| GridWebMcpToolCommand | A GridWebMcpToolCommand 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 GetSelectedRecords. Custom tools use Custom. This property is set by the grid 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 representing the tool associated with the current WebMCP execution request, or null if no tool name is available. |
Remarks
For custom tools, this value corresponds to the configured Name.
For built-in tools, this value corresponds to the effective tool name exposed to the agent after any customization applied through GridWebMcpTool.
Applications can use this property within the OnWebMcpExecute event handler to identify the requested tool and provide an appropriate response.
Result
Gets or sets the custom response payload produced by the host's
OnWebMcpExecute event handler, returned to the AI
agent in place of the built-in handler's output.
Declaration
public object? Result { get; set; }
Property Value
| Type | Description |
|---|---|
| object | An object representing the custom result data, or null when no custom response is supplied by the host. The default value is null. |
Remarks
Assigning a value to this property suppresses the normal tool execution pipeline and returns the supplied value directly to the requesting agent.
This property is commonly used when implementing custom WebMCP tools
through the OnWebMcpExecute event.
For built-in tools, setting this property overrides the result that would otherwise be produced by the grid's built-in tool handler.
If both Cancel and Result are set, Cancel takes precedence. The supplied result is ignored, and a cancellation response is returned to the requesting agent.
ShowConfirmationDialog
Gets or sets a value indicating whether the host requests user confirmation before executing the tool.
Declaration
public bool ShowConfirmationDialog { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether a host-controlled confirmation dialog should be displayed before tool execution. A value of true requests confirmation before execution; otherwise, false. The default value is false. |
Remarks
Set this property to true within the
OnWebMcpExecute event to request that the host display a
confirmation dialog before executing the tool.
Confirmation dialogs are only displayed for writable tools. Read-only tools execute immediately regardless of this property's value.
If the user declines the confirmation request, tool execution is cancelled and a terminal cancellation response is returned to the agent. In this scenario, no tool handler or per-tool callback is invoked.
This property is evaluated only when Cancel is false. If both cancellation and confirmation are requested, cancellation takes precedence.