/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { McpToolOption } from '@progress/kendo-react-common';
/**
* Configuration for the Grid's `webMcp` prop.
*
* Enables browser-native AI agent tools via Web MCP (Chrome 146+).
* Pass `true` for defaults or an object for fine-grained control.
*
* @example
* ```tsx
* // Boolean — generic "data" label, tools auto-inferred from Grid props
*
*
* // Config object — semantic naming in any language
*
*
* ```
*/
export type GridWebMcpProps = boolean | {
/**
* Human-readable name for the data exposed by the grid.
* AI agents are multilingual — any language works.
*
* @example 'employees', 'empleados', 'employés'
*/
dataName: string;
/**
* Tool name prefix. Auto-generated from `dataName` when omitted.
* Tools are named `{groupName}_{action}`, e.g. `employees_grid_sort`.
*/
groupName?: string;
/**
* Customize the built-in tools before they are registered.
* Receives the auto-generated tool list and a helpers object.
* Return a modified array to remove, rename, re-describe, or add custom tools.
*
* @example
* ```tsx
* // Override a description
* tools: (tools) => tools.map(t =>
* t.commandType === 'GridSort'
* ? { ...t, description: 'Reorder employees by column' }
* : t
* )
*
* // Remove sort tools
* tools: (tools) => tools.filter(t => t.commandType !== 'GridSort')
*
* // Add a custom tool
* tools: (tools, helpers) => [
* ...tools,
* { name: 'validate', description: 'Validate data', commandType: 'Custom', enabled: true }
* ]
* ```
*/
tools?: GridWebMcpToolsCallback;
};
/**
* Helpers passed to the `tools` callback.
*/
export interface GridWebMcpToolsHelpers {
/** Generates a prefixed tool name: `{groupName}_{suffix}`. */
tname: (suffix: string) => string;
/** The column metadata extracted from GridColumn children. */
columns: Array<{
field: string;
id: string;
}>;
/** The current grid data (visible rows). */
data: any;
}
/**
* Callback that receives the auto-generated tool list and returns a
* (possibly modified) list to register.
*/
export type GridWebMcpToolsCallback = (tools: McpToolOption[], helpers: GridWebMcpToolsHelpers) => McpToolOption[];