Class PivotViewWebMcpTool
Represents a WebMCP tool definition or customization entry associated with an SfPivotView<TValue> instance.
Inherited Members
Namespace: Syncfusion.Blazor.PivotView
Assembly: Syncfusion.Blazor.PivotView.dll
Syntax
public class PivotViewWebMcpTool : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Remarks
A tool can either customize a built-in WebMCP command by specifying a value from PivotViewWebMcpToolCommand through the Command property, or define a fully custom tool by setting Command to Custom.
Built-in tools inherit their default behavior from the pivot table and can be customized by overriding properties such as name, description, input schema, and enabled state.
Custom tools do not provide built-in execution logic. Applications must handle tool invocations through the OnWebMcpExecute event and provide an appropriate execution result.
Tool names should be unique within a page. When multiple WebMCP-enabled pivot tables are present, use PivotViewWebMcpSettings.Name to help avoid tool-name collisions.
Examples
<SfPivotView TValue="ProductDetails" EnableWebMcp="true"> <PivotViewWebMcpSettings Name="SalesPivot"> <PivotViewWebMcpTools> <PivotViewWebMcpTool Command="PivotViewWebMcpToolCommand.ApplyFiltering" Name="filterProducts" Description="Filter the pivot table by a field." />
<PivotViewWebMcpTool
Command="PivotViewWebMcpToolCommand.Custom"
Name="getTopCountries"
Description="Returns the top countries."
InputSchema="@(new { type = "object", properties = new { } })" />
</PivotViewWebMcpTools>
</PivotViewWebMcpSettings>
<PivotViewEvents TValue="ProductDetails" OnWebMcpExecute="HandleToolExecute" />
</SfPivotView>
@code { private Task HandleToolExecute(WebMcpToolExecuteEventArgs args) { if (args.ToolName == "getTopCountries") { args.Result = new { Countries = new[] { "France", "Germany" } }; }
return Task.CompletedTask;
}
}
Constructors
PivotViewWebMcpTool()
Declaration
public PivotViewWebMcpTool()
Properties
Command
Gets or sets the WebMCP command associated with this tool configuration.
Declaration
[Parameter]
public PivotViewWebMcpToolCommand Command { get; set; }
Property Value
| Type | Description |
|---|---|
| PivotViewWebMcpToolCommand | A PivotViewWebMcpToolCommand that identifies the built-in tool to customize or specifies a custom tool through Custom. The default value is None. |
Remarks
For built-in commands, this property identifies the WebMCP tool whose metadata, schema, or availability can be customized through the current PivotViewWebMcpTool configuration.
Set this property to Custom to register a custom tool that is not provided by the pivot table. Custom tools must define a unique Name, a Description, and an InputSchema.
Custom tool execution is not handled automatically by the pivot table. Applications must process tool invocations through the OnWebMcpExecute event and provide a result by setting Result. A custom tool cannot be configured unless this event has an assigned handler.
The value None is reserved as the default state and does not represent a valid configured tool. A tool entry should specify either a built-in command or Custom.
Description
Gets or sets the description exposed to browser-side agents for this tool.
Declaration
[Parameter]
public string? Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string containing the tool description. This parameter is optional for built-in tools, which use the catalog description when it is omitted. Custom tools must supply a non-empty description. |
Enabled
Gets or sets a value indicating whether the targeted built-in tool is enabled.
Declaration
[Parameter]
public bool Enabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether the tool should be included in the effective WebMCP tool catalog. The default value is true. |
Remarks
This property applies only to entries that target a built-in tool through Command. Custom tools are always included.
InputSchema
Gets or sets the JSON Schema that defines the input arguments accepted by this tool.
Declaration
[Parameter]
public object? InputSchema { get; set; }
Property Value
| Type | Description |
|---|---|
| object | An object representing a JSON Schema document. For built-in tools, the supplied schema replaces the default catalog schema. Custom tools must supply a valid object schema. |
Remarks
Invalid schema objects may prevent tool registration or cause runtime errors. Applications are responsible for supplying a valid JSON Schema document.
Name
Gets or sets the tool name exposed to browser-side agents.
Declaration
[Parameter]
public string? Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the public tool name. For built-in tools, when no value is specified, the default tool name defined by the pivot table is used. For custom tools, this property specifies the unique identifier exposed through WebMCP registration. The default value is null. |
Remarks
For built-in tools, this property can be used to override the default tool name exposed to AI agents. Renaming a built-in tool changes only the exposed name and does not affect the underlying implementation or execution behavior.
For custom tools, this property is required and uniquely identifies the tool during registration and execution.
During tool execution, the configured tool name is available through ToolName.
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
OnInitializedAsync()
Initializes the tool entry and registers it with the parent PivotViewWebMcpSettings.
Sets BaseParent.HasWebMcpSettingsChanges so the pivot table invalidates its cached effective-tools list on the next registration.
Declaration
protected override Task OnInitializedAsync()
Returns
| Type |
|---|
| Task |
Overrides
OnParametersSetAsync()
Detects parameter mutations and flips the parent's HasWebMcpSettingsChanges flag.
Declaration
protected override Task OnParametersSetAsync()
Returns
| Type |
|---|
| Task |