@progress/kendo-react-webmcp 15.0.0-develop.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +383 -0
  3. package/README.md +72 -0
  4. package/WebMcpProvider.d.ts +49 -0
  5. package/WebMcpProvider.js +8 -0
  6. package/WebMcpProvider.mjs +138 -0
  7. package/adapters/aiprompt.d.ts +15 -0
  8. package/adapters/aiprompt.js +8 -0
  9. package/adapters/aiprompt.mjs +63 -0
  10. package/adapters/autocomplete.d.ts +18 -0
  11. package/adapters/autocomplete.js +8 -0
  12. package/adapters/autocomplete.mjs +69 -0
  13. package/adapters/button.d.ts +18 -0
  14. package/adapters/button.js +8 -0
  15. package/adapters/button.mjs +46 -0
  16. package/adapters/calendar.d.ts +16 -0
  17. package/adapters/calendar.js +8 -0
  18. package/adapters/calendar.mjs +61 -0
  19. package/adapters/chart.d.ts +29 -0
  20. package/adapters/chart.js +8 -0
  21. package/adapters/chart.mjs +95 -0
  22. package/adapters/chat.d.ts +16 -0
  23. package/adapters/chat.js +8 -0
  24. package/adapters/chat.mjs +66 -0
  25. package/adapters/colorpicker.d.ts +16 -0
  26. package/adapters/colorpicker.js +8 -0
  27. package/adapters/colorpicker.mjs +60 -0
  28. package/adapters/combobox.d.ts +20 -0
  29. package/adapters/combobox.js +8 -0
  30. package/adapters/combobox.mjs +87 -0
  31. package/adapters/dashboard.d.ts +18 -0
  32. package/adapters/dashboard.js +8 -0
  33. package/adapters/dashboard.mjs +41 -0
  34. package/adapters/datepicker.d.ts +17 -0
  35. package/adapters/datepicker.js +8 -0
  36. package/adapters/datepicker.mjs +59 -0
  37. package/adapters/daterangepicker.d.ts +19 -0
  38. package/adapters/daterangepicker.js +8 -0
  39. package/adapters/daterangepicker.mjs +70 -0
  40. package/adapters/datetimepicker.d.ts +16 -0
  41. package/adapters/datetimepicker.js +8 -0
  42. package/adapters/datetimepicker.mjs +59 -0
  43. package/adapters/dialog.d.ts +15 -0
  44. package/adapters/dialog.js +8 -0
  45. package/adapters/dialog.mjs +58 -0
  46. package/adapters/drawer.d.ts +33 -0
  47. package/adapters/drawer.js +8 -0
  48. package/adapters/drawer.mjs +86 -0
  49. package/adapters/dropdownlist.d.ts +19 -0
  50. package/adapters/dropdownlist.js +8 -0
  51. package/adapters/dropdownlist.mjs +74 -0
  52. package/adapters/dropdowntree.d.ts +22 -0
  53. package/adapters/dropdowntree.js +8 -0
  54. package/adapters/dropdowntree.mjs +108 -0
  55. package/adapters/editor.d.ts +30 -0
  56. package/adapters/editor.js +8 -0
  57. package/adapters/editor.mjs +109 -0
  58. package/adapters/form.d.ts +20 -0
  59. package/adapters/form.js +10 -0
  60. package/adapters/form.mjs +115 -0
  61. package/adapters/gantt.d.ts +65 -0
  62. package/adapters/gantt.js +8 -0
  63. package/adapters/gantt.mjs +370 -0
  64. package/adapters/grid.d.ts +102 -0
  65. package/adapters/grid.js +8 -0
  66. package/adapters/grid.mjs +692 -0
  67. package/adapters/listbox.d.ts +18 -0
  68. package/adapters/listbox.js +8 -0
  69. package/adapters/listbox.mjs +87 -0
  70. package/adapters/listview.d.ts +22 -0
  71. package/adapters/listview.js +8 -0
  72. package/adapters/listview.mjs +80 -0
  73. package/adapters/map.d.ts +32 -0
  74. package/adapters/map.js +8 -0
  75. package/adapters/map.mjs +88 -0
  76. package/adapters/maskedtextbox.d.ts +17 -0
  77. package/adapters/maskedtextbox.js +8 -0
  78. package/adapters/maskedtextbox.mjs +57 -0
  79. package/adapters/menu.d.ts +16 -0
  80. package/adapters/menu.js +8 -0
  81. package/adapters/menu.mjs +50 -0
  82. package/adapters/multiselect.d.ts +19 -0
  83. package/adapters/multiselect.js +8 -0
  84. package/adapters/multiselect.mjs +75 -0
  85. package/adapters/notification.d.ts +17 -0
  86. package/adapters/notification.js +8 -0
  87. package/adapters/notification.mjs +57 -0
  88. package/adapters/numerictextbox.d.ts +19 -0
  89. package/adapters/numerictextbox.js +8 -0
  90. package/adapters/numerictextbox.mjs +78 -0
  91. package/adapters/panelbar.d.ts +17 -0
  92. package/adapters/panelbar.js +8 -0
  93. package/adapters/panelbar.mjs +66 -0
  94. package/adapters/pivotgrid.d.ts +16 -0
  95. package/adapters/pivotgrid.js +8 -0
  96. package/adapters/pivotgrid.mjs +126 -0
  97. package/adapters/rangeslider.d.ts +21 -0
  98. package/adapters/rangeslider.js +8 -0
  99. package/adapters/rangeslider.mjs +55 -0
  100. package/adapters/rating.d.ts +16 -0
  101. package/adapters/rating.js +8 -0
  102. package/adapters/rating.mjs +60 -0
  103. package/adapters/scheduler.d.ts +45 -0
  104. package/adapters/scheduler.js +8 -0
  105. package/adapters/scheduler.mjs +165 -0
  106. package/adapters/scrollview.d.ts +21 -0
  107. package/adapters/scrollview.js +8 -0
  108. package/adapters/scrollview.mjs +74 -0
  109. package/adapters/signature.d.ts +16 -0
  110. package/adapters/signature.js +8 -0
  111. package/adapters/signature.mjs +47 -0
  112. package/adapters/slider.d.ts +19 -0
  113. package/adapters/slider.js +8 -0
  114. package/adapters/slider.mjs +47 -0
  115. package/adapters/sortable.d.ts +17 -0
  116. package/adapters/sortable.js +8 -0
  117. package/adapters/sortable.mjs +67 -0
  118. package/adapters/spreadsheet.d.ts +32 -0
  119. package/adapters/spreadsheet.js +8 -0
  120. package/adapters/spreadsheet.mjs +256 -0
  121. package/adapters/stepper.d.ts +23 -0
  122. package/adapters/stepper.js +8 -0
  123. package/adapters/stepper.mjs +47 -0
  124. package/adapters/switch.d.ts +17 -0
  125. package/adapters/switch.js +8 -0
  126. package/adapters/switch.mjs +48 -0
  127. package/adapters/tabstrip.d.ts +19 -0
  128. package/adapters/tabstrip.js +8 -0
  129. package/adapters/tabstrip.mjs +47 -0
  130. package/adapters/taskboard.d.ts +20 -0
  131. package/adapters/taskboard.js +8 -0
  132. package/adapters/taskboard.mjs +104 -0
  133. package/adapters/textarea.d.ts +16 -0
  134. package/adapters/textarea.js +8 -0
  135. package/adapters/textarea.mjs +57 -0
  136. package/adapters/textbox.d.ts +19 -0
  137. package/adapters/textbox.js +8 -0
  138. package/adapters/textbox.mjs +61 -0
  139. package/adapters/timepicker.d.ts +16 -0
  140. package/adapters/timepicker.js +8 -0
  141. package/adapters/timepicker.mjs +59 -0
  142. package/adapters/treelist.d.ts +81 -0
  143. package/adapters/treelist.js +8 -0
  144. package/adapters/treelist.mjs +403 -0
  145. package/adapters/treeview.d.ts +25 -0
  146. package/adapters/treeview.js +9 -0
  147. package/adapters/treeview.mjs +212 -0
  148. package/adapters/upload.d.ts +15 -0
  149. package/adapters/upload.js +8 -0
  150. package/adapters/upload.mjs +52 -0
  151. package/adapters/utils.d.ts +16 -0
  152. package/adapters/utils.js +8 -0
  153. package/adapters/utils.mjs +25 -0
  154. package/adapters/window.d.ts +17 -0
  155. package/adapters/window.js +8 -0
  156. package/adapters/window.mjs +99 -0
  157. package/commands/aiprompt.d.ts +30 -0
  158. package/commands/aiprompt.js +8 -0
  159. package/commands/aiprompt.mjs +54 -0
  160. package/commands/autocomplete.d.ts +26 -0
  161. package/commands/autocomplete.js +8 -0
  162. package/commands/autocomplete.mjs +36 -0
  163. package/commands/button.d.ts +19 -0
  164. package/commands/button.js +8 -0
  165. package/commands/button.mjs +21 -0
  166. package/commands/calendar.d.ts +29 -0
  167. package/commands/calendar.js +8 -0
  168. package/commands/calendar.mjs +52 -0
  169. package/commands/chart.d.ts +27 -0
  170. package/commands/chart.js +8 -0
  171. package/commands/chart.mjs +43 -0
  172. package/commands/chat.d.ts +22 -0
  173. package/commands/chat.js +8 -0
  174. package/commands/chat.mjs +30 -0
  175. package/commands/checkbox.d.ts +26 -0
  176. package/commands/checkbox.js +8 -0
  177. package/commands/checkbox.mjs +36 -0
  178. package/commands/colorpicker.d.ts +26 -0
  179. package/commands/colorpicker.js +8 -0
  180. package/commands/colorpicker.mjs +36 -0
  181. package/commands/combobox.d.ts +34 -0
  182. package/commands/combobox.js +8 -0
  183. package/commands/combobox.mjs +48 -0
  184. package/commands/dashboard.d.ts +19 -0
  185. package/commands/dashboard.js +8 -0
  186. package/commands/dashboard.mjs +21 -0
  187. package/commands/datepicker.d.ts +26 -0
  188. package/commands/datepicker.js +8 -0
  189. package/commands/datepicker.mjs +36 -0
  190. package/commands/daterangepicker.d.ts +27 -0
  191. package/commands/daterangepicker.js +8 -0
  192. package/commands/daterangepicker.mjs +37 -0
  193. package/commands/datetimepicker.d.ts +26 -0
  194. package/commands/datetimepicker.js +8 -0
  195. package/commands/datetimepicker.mjs +36 -0
  196. package/commands/dialog.d.ts +23 -0
  197. package/commands/dialog.js +8 -0
  198. package/commands/dialog.mjs +25 -0
  199. package/commands/drawer.d.ts +30 -0
  200. package/commands/drawer.js +8 -0
  201. package/commands/drawer.mjs +38 -0
  202. package/commands/dropdownlist.d.ts +30 -0
  203. package/commands/dropdownlist.js +8 -0
  204. package/commands/dropdownlist.mjs +42 -0
  205. package/commands/dropdowntree.d.ts +34 -0
  206. package/commands/dropdowntree.js +8 -0
  207. package/commands/dropdowntree.mjs +48 -0
  208. package/commands/editor.d.ts +26 -0
  209. package/commands/editor.js +8 -0
  210. package/commands/editor.mjs +36 -0
  211. package/commands/form.d.ts +34 -0
  212. package/commands/form.js +8 -0
  213. package/commands/form.mjs +54 -0
  214. package/commands/gantt.d.ts +119 -0
  215. package/commands/gantt.js +8 -0
  216. package/commands/gantt.mjs +156 -0
  217. package/commands/grid.d.ts +209 -0
  218. package/commands/grid.js +8 -0
  219. package/commands/grid.mjs +280 -0
  220. package/commands/index.d.ts +58 -0
  221. package/commands/listbox.d.ts +31 -0
  222. package/commands/listbox.js +8 -0
  223. package/commands/listbox.mjs +69 -0
  224. package/commands/listview.d.ts +22 -0
  225. package/commands/listview.js +8 -0
  226. package/commands/listview.mjs +29 -0
  227. package/commands/map.d.ts +43 -0
  228. package/commands/map.js +8 -0
  229. package/commands/map.mjs +77 -0
  230. package/commands/maskedtextbox.d.ts +26 -0
  231. package/commands/maskedtextbox.js +8 -0
  232. package/commands/maskedtextbox.mjs +36 -0
  233. package/commands/menu.d.ts +22 -0
  234. package/commands/menu.js +8 -0
  235. package/commands/menu.mjs +30 -0
  236. package/commands/multicolumncombobox.d.ts +34 -0
  237. package/commands/multicolumncombobox.js +8 -0
  238. package/commands/multicolumncombobox.mjs +48 -0
  239. package/commands/multiselect.d.ts +41 -0
  240. package/commands/multiselect.js +8 -0
  241. package/commands/multiselect.mjs +57 -0
  242. package/commands/notification.d.ts +27 -0
  243. package/commands/notification.js +8 -0
  244. package/commands/notification.mjs +46 -0
  245. package/commands/numerictextbox.d.ts +34 -0
  246. package/commands/numerictextbox.js +8 -0
  247. package/commands/numerictextbox.mjs +48 -0
  248. package/commands/panelbar.d.ts +29 -0
  249. package/commands/panelbar.js +8 -0
  250. package/commands/panelbar.mjs +43 -0
  251. package/commands/pivotgrid.d.ts +56 -0
  252. package/commands/pivotgrid.js +8 -0
  253. package/commands/pivotgrid.mjs +87 -0
  254. package/commands/rangeslider.d.ts +23 -0
  255. package/commands/rangeslider.js +8 -0
  256. package/commands/rangeslider.mjs +25 -0
  257. package/commands/rating.d.ts +26 -0
  258. package/commands/rating.js +8 -0
  259. package/commands/rating.mjs +36 -0
  260. package/commands/scheduler.d.ts +45 -0
  261. package/commands/scheduler.js +8 -0
  262. package/commands/scheduler.mjs +59 -0
  263. package/commands/scrollview.d.ts +30 -0
  264. package/commands/scrollview.js +8 -0
  265. package/commands/scrollview.mjs +46 -0
  266. package/commands/signature.d.ts +19 -0
  267. package/commands/signature.js +8 -0
  268. package/commands/signature.mjs +21 -0
  269. package/commands/slider.d.ts +22 -0
  270. package/commands/slider.js +8 -0
  271. package/commands/slider.mjs +24 -0
  272. package/commands/sortable.d.ts +23 -0
  273. package/commands/sortable.js +8 -0
  274. package/commands/sortable.mjs +32 -0
  275. package/commands/spreadsheet.d.ts +92 -0
  276. package/commands/spreadsheet.js +8 -0
  277. package/commands/spreadsheet.mjs +181 -0
  278. package/commands/stepper.d.ts +22 -0
  279. package/commands/stepper.js +8 -0
  280. package/commands/stepper.mjs +35 -0
  281. package/commands/switch.d.ts +26 -0
  282. package/commands/switch.js +8 -0
  283. package/commands/switch.mjs +36 -0
  284. package/commands/tabstrip.d.ts +23 -0
  285. package/commands/tabstrip.js +8 -0
  286. package/commands/tabstrip.mjs +30 -0
  287. package/commands/taskboard.d.ts +48 -0
  288. package/commands/taskboard.js +8 -0
  289. package/commands/taskboard.mjs +90 -0
  290. package/commands/textarea.d.ts +26 -0
  291. package/commands/textarea.js +8 -0
  292. package/commands/textarea.mjs +36 -0
  293. package/commands/textbox.d.ts +26 -0
  294. package/commands/textbox.js +8 -0
  295. package/commands/textbox.mjs +36 -0
  296. package/commands/timepicker.d.ts +26 -0
  297. package/commands/timepicker.js +8 -0
  298. package/commands/timepicker.mjs +36 -0
  299. package/commands/treelist.d.ts +135 -0
  300. package/commands/treelist.js +8 -0
  301. package/commands/treelist.mjs +177 -0
  302. package/commands/treeview.d.ts +44 -0
  303. package/commands/treeview.js +8 -0
  304. package/commands/treeview.mjs +84 -0
  305. package/commands/upload.d.ts +19 -0
  306. package/commands/upload.js +8 -0
  307. package/commands/upload.mjs +21 -0
  308. package/commands/window.d.ts +35 -0
  309. package/commands/window.js +8 -0
  310. package/commands/window.mjs +45 -0
  311. package/dist/cdn/js/kendo-react-webmcp.js +15 -0
  312. package/grid-mcp-tools.d.ts +26 -0
  313. package/grid-mcp-tools.js +8 -0
  314. package/grid-mcp-tools.mjs +75 -0
  315. package/index.d.mts +68 -0
  316. package/index.d.ts +68 -0
  317. package/index.js +8 -0
  318. package/index.mjs +308 -0
  319. package/mcp-types.d.ts +12 -0
  320. package/package.json +64 -0
  321. package/schemas/common.d.ts +27 -0
  322. package/schemas/common.js +8 -0
  323. package/schemas/common.mjs +113 -0
  324. package/schemas/gantt.d.ts +10 -0
  325. package/schemas/gantt.js +8 -0
  326. package/schemas/gantt.mjs +51 -0
  327. package/schemas/grid.d.ts +10 -0
  328. package/schemas/grid.js +8 -0
  329. package/schemas/grid.mjs +46 -0
  330. package/schemas/index.d.ts +13 -0
  331. package/schemas/input.d.ts +19 -0
  332. package/schemas/input.js +8 -0
  333. package/schemas/input.mjs +137 -0
  334. package/schemas/scheduler.d.ts +11 -0
  335. package/schemas/scheduler.js +8 -0
  336. package/schemas/scheduler.mjs +58 -0
  337. package/schemas/table.d.ts +12 -0
  338. package/schemas/table.js +8 -0
  339. package/schemas/table.mjs +87 -0
  340. package/types.d.ts +39 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../commands/form.js");function F(t,n){if(!n)return{content:[{type:"text",text:"Form ref not available."}],isError:!0};const e=t.values;if(!e||typeof e!="object")return{content:[{type:"text",text:"Missing required argument: values (object)"}],isError:!0};for(const[a,i]of Object.entries(e))n.onChange(a,{value:i});return{content:[{type:"text",text:`Filled ${Object.keys(e).length} field(s): ${Object.keys(e).join(", ")}.`}]}}function v(t){if(!t)return{content:[{type:"text",text:"Form ref not available."}],isError:!0};const n=t.errors||{},e=Object.entries(n).filter(([,a])=>!!a);return e.length===0?{content:[{type:"text",text:"Form is valid."}]}:{content:[{type:"text",text:`Validation errors:
9
+ `+e.map(([a,i])=>` ${a}: ${i}`).join(`
10
+ `)}]}}function C(t){if(!t)return{content:[{type:"text",text:"Form ref not available."}],isError:!0};const n={preventDefault:()=>{},stopPropagation:()=>{}};return t.onSubmit(n),{content:[{type:"text",text:"Form submitted."}]}}function $(t){return t?(t.onReset(),{content:[{type:"text",text:"Form reset to initial values."}]}):{content:[{type:"text",text:"Form ref not available."}],isError:!0}}const j={componentSuffix:"form",createTools(t,n,e,a){const i=[],d=o=>`${e.groupName}_${o}`,m=(t==null?void 0:t.fields)||[],f=m.length>0?` Available fields: ${m.join(", ")}.`:"",u=[{name:"fill",description:`Fill the ${e.dataName} form fields with the provided values.${f}`,commandType:r.FormCommands.Fill,enabled:!0},{name:"validate",description:`Validate the ${e.dataName} form and return any errors.`,commandType:r.FormCommands.Validate,enabled:!0},{name:"submit",description:`Submit the ${e.dataName} form.`,commandType:r.FormCommands.Submit,enabled:!0},{name:"reset",description:`Reset the ${e.dataName} form to its initial values.`,commandType:r.FormCommands.Reset,enabled:!0}],s=n.current.webMcp,l=typeof s=="object"&&s!==null&&typeof s.tools=="function"?s.tools:void 0,p=l?l(u):u,b=async(o,c)=>{switch(o){case r.FormCommands.Fill:return F(c,t);case r.FormCommands.Validate:return v(t);case r.FormCommands.Submit:return C(t);case r.FormCommands.Reset:return $(t);default:return{content:[{type:"text",text:`Unknown command: ${o}`}],isError:!0}}};for(const o of p){if(!o.enabled)continue;const c=r.getFormToolSchema(o.commandType,m),x=o.commandType;try{i.push(a.registerTool({name:d(o.name),description:o.description,inputSchema:c,execute:async y=>b(x,y||{})}))}catch{}}return i}};exports.formAdapter=j;
@@ -0,0 +1,115 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { FormCommands as r, getFormToolSchema as v } from "../commands/form.mjs";
9
+ function F(t, n) {
10
+ if (!n)
11
+ return { content: [{ type: "text", text: "Form ref not available." }], isError: !0 };
12
+ const e = t.values;
13
+ if (!e || typeof e != "object")
14
+ return { content: [{ type: "text", text: "Missing required argument: values (object)" }], isError: !0 };
15
+ for (const [i, a] of Object.entries(e))
16
+ n.onChange(i, { value: a });
17
+ return {
18
+ content: [
19
+ { type: "text", text: `Filled ${Object.keys(e).length} field(s): ${Object.keys(e).join(", ")}.` }
20
+ ]
21
+ };
22
+ }
23
+ function $(t) {
24
+ if (!t)
25
+ return { content: [{ type: "text", text: "Form ref not available." }], isError: !0 };
26
+ const n = t.errors || {}, e = Object.entries(n).filter(([, i]) => !!i);
27
+ return e.length === 0 ? { content: [{ type: "text", text: "Form is valid." }] } : {
28
+ content: [
29
+ {
30
+ type: "text",
31
+ text: `Validation errors:
32
+ ` + e.map(([i, a]) => ` ${i}: ${a}`).join(`
33
+ `)
34
+ }
35
+ ]
36
+ };
37
+ }
38
+ function j(t) {
39
+ if (!t)
40
+ return { content: [{ type: "text", text: "Form ref not available." }], isError: !0 };
41
+ const n = {
42
+ preventDefault: () => {
43
+ },
44
+ stopPropagation: () => {
45
+ }
46
+ };
47
+ return t.onSubmit(n), { content: [{ type: "text", text: "Form submitted." }] };
48
+ }
49
+ function T(t) {
50
+ return t ? (t.onReset(), { content: [{ type: "text", text: "Form reset to initial values." }] }) : { content: [{ type: "text", text: "Form ref not available." }], isError: !0 };
51
+ }
52
+ const g = {
53
+ componentSuffix: "form",
54
+ createTools(t, n, e, i) {
55
+ const a = [], f = (o) => `${e.groupName}_${o}`, c = (t == null ? void 0 : t.fields) || [], p = c.length > 0 ? ` Available fields: ${c.join(", ")}.` : "", u = [
56
+ {
57
+ name: "fill",
58
+ description: `Fill the ${e.dataName} form fields with the provided values.${p}`,
59
+ commandType: r.Fill,
60
+ enabled: !0
61
+ },
62
+ {
63
+ name: "validate",
64
+ description: `Validate the ${e.dataName} form and return any errors.`,
65
+ commandType: r.Validate,
66
+ enabled: !0
67
+ },
68
+ {
69
+ name: "submit",
70
+ description: `Submit the ${e.dataName} form.`,
71
+ commandType: r.Submit,
72
+ enabled: !0
73
+ },
74
+ {
75
+ name: "reset",
76
+ description: `Reset the ${e.dataName} form to its initial values.`,
77
+ commandType: r.Reset,
78
+ enabled: !0
79
+ }
80
+ ], s = n.current.webMcp, l = typeof s == "object" && s !== null && typeof s.tools == "function" ? s.tools : void 0, d = l ? l(u) : u, x = async (o, m) => {
81
+ switch (o) {
82
+ case r.Fill:
83
+ return F(m, t);
84
+ case r.Validate:
85
+ return $(t);
86
+ case r.Submit:
87
+ return j(t);
88
+ case r.Reset:
89
+ return T(t);
90
+ default:
91
+ return { content: [{ type: "text", text: `Unknown command: ${o}` }], isError: !0 };
92
+ }
93
+ };
94
+ for (const o of d) {
95
+ if (!o.enabled)
96
+ continue;
97
+ const m = v(o.commandType, c), b = o.commandType;
98
+ try {
99
+ a.push(
100
+ i.registerTool({
101
+ name: f(o.name),
102
+ description: o.description,
103
+ inputSchema: m,
104
+ execute: async (y) => x(b, y || {})
105
+ })
106
+ );
107
+ } catch {
108
+ }
109
+ }
110
+ return a;
111
+ }
112
+ };
113
+ export {
114
+ g as formAdapter
115
+ };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { ToolAdapter } from '../types';
9
+ /**
10
+ * Gantt tool adapter for the Web MCP Provider.
11
+ *
12
+ * Reads Gantt props (sortable, filterable, columns, view, task CRUD callbacks)
13
+ * and GanttHandle to register sort, filter, column, expand/collapse, view, and task tools.
14
+ *
15
+ * Imports the shared schema generators from `@progress/kendo-react-common` for rich
16
+ * input schemas with column field enums for better AI agent guidance.
17
+ *
18
+ * Delegates all mutations to public Gantt callbacks (onSortChange, onFilterChange, etc.)
19
+ * following the React controlled-component pattern.
20
+ */
21
+ import * as React from 'react';
22
+ interface GanttColumnState {
23
+ field?: string;
24
+ id?: string;
25
+ width?: number;
26
+ hidden?: boolean;
27
+ orderIndex?: number;
28
+ [key: string]: unknown;
29
+ }
30
+ interface GanttAdapterHandle {
31
+ columns?: Array<{
32
+ field?: string;
33
+ id?: string;
34
+ }>;
35
+ element?: HTMLDivElement | null;
36
+ props?: Record<string, unknown>;
37
+ }
38
+ interface GanttAdapterProps {
39
+ taskData?: Record<string, unknown>[];
40
+ taskModelFields?: Record<string, string>;
41
+ children?: React.ReactNode;
42
+ columns?: Array<{
43
+ field?: string;
44
+ id?: string;
45
+ width?: number;
46
+ [key: string]: unknown;
47
+ }>;
48
+ sortable?: boolean | Record<string, unknown>;
49
+ onSortChange?: (event: Record<string, unknown>) => void;
50
+ onFilterChange?: (event: Record<string, unknown>) => void;
51
+ onExpandChange?: (event: Record<string, unknown>) => void;
52
+ onViewChange?: (event: Record<string, unknown>) => void;
53
+ onTaskChange?: (event: Record<string, unknown>) => void;
54
+ onDataStateChange?: (event: Record<string, unknown>) => void;
55
+ columnsState?: GanttColumnState[];
56
+ onColumnsStateChange?: (event: Record<string, unknown>) => void;
57
+ onColumnResize?: (event: Record<string, unknown>) => void;
58
+ onColumnReorder?: (event: Record<string, unknown>) => void;
59
+ reorderable?: boolean;
60
+ resizable?: boolean;
61
+ webMcp?: unknown;
62
+ }
63
+ /** @hidden */
64
+ export declare const ganttAdapter: ToolAdapter<GanttAdapterHandle, GanttAdapterProps>;
65
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),i=require("../commands/gantt.js"),S=require("./utils.js");function j(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,a.get?a:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const v=j(O);function b(t){return{id:(t==null?void 0:t.id)||"id",title:(t==null?void 0:t.title)||"title",start:(t==null?void 0:t.start)||"start",end:(t==null?void 0:t.end)||"end",percentComplete:(t==null?void 0:t.percentComplete)||"percentComplete",isExpanded:(t==null?void 0:t.isExpanded)||"isExpanded",children:(t==null?void 0:t.children)||"children"}}function G(t,n){const e=[],a=o=>{for(const c of o){e.push(c);const r=c[n.children];Array.isArray(r)&&r.length>0&&a(r)}};return a(t),e}function H(t){const n=[];if(Array.isArray(t.columns))for(const e of t.columns)e.field&&n.push({field:e.field,id:e.id||e.field});return n.length===0&&t.children&&v.Children.forEach(t.children,e=>{if(v.isValidElement(e)&&e.props.field){const a=e.props;n.push({field:a.field,id:a.id||a.field})}}),n}function V(t,n,e){if(!t.field)return{content:[{type:"text",text:"Missing required argument: field"}],isError:!0};const a=t.field,o=t.dir||"asc",c=[{field:a,dir:o}];return n.current.onSortChange&&n.current.onSortChange({sort:c,field:a,target:e}),{content:[{type:"text",text:`Sorted by ${a} ${o}.`}]}}function W(t,n,e){if(!t.field||!t.operator)return{content:[{type:"text",text:"Missing required arguments: field, operator"}],isError:!0};const a=t.field,o=t.operator,c=t.value;return n.current.onFilterChange&&n.current.onFilterChange({filter:{logic:"and",filters:[{field:a,operator:o,value:c}]},target:e}),{content:[{type:"text",text:`Filter applied: ${a} ${o} "${S.toText(c)}".`}]}}function D(t,n,e){const a=typeof t=="string"?t.toLowerCase():t,o=typeof e=="string"?e.toLowerCase():e;switch(n){case"eq":return a===o;case"neq":return a!==o;case"contains":return typeof a=="string"&&typeof o=="string"&&a.includes(o);case"startswith":return typeof a=="string"&&typeof o=="string"&&a.startsWith(o);case"endswith":return typeof a=="string"&&typeof o=="string"&&a.endsWith(o);default:return a===o}}function N(t,n,e,a){const o=e.current,c=b(o.taskModelFields),r=G(o.taskData||[],c);let s;return n.field&&n.operator?s=r.find(u=>{const l=u[n.field];return D(l,n.operator,n.value)}):n.id!==void 0&&(s=r.find(u=>String(u[c.id])===String(n.id))),s?(o.onExpandChange&&o.onExpandChange({dataItem:s,value:t,level:[],target:a}),{content:[{type:"text",text:`${t?"Expanded":"Collapsed"} task "${S.toText(s[c.title])}".`}]}):{content:[{type:"text",text:"No matching task found."}],isError:!0}}function A(t,n,e){const a=n.current,o=b(a.taskModelFields),r=G(a.taskData||[],o).filter(m=>{const u=m[o.children];return Array.isArray(u)&&u.length>0});if(a.onExpandChange)for(const m of r)a.onExpandChange({dataItem:m,value:t,level:[],target:e});return{content:[{type:"text",text:`${t?"Expanded":"Collapsed"} ${r.length} parent task(s).`}]}}function P(t,n,e,a){switch(t){case i.GanttCommands.Expand:return N(!0,n,e,a);case i.GanttCommands.Collapse:return N(!1,n,e,a);case i.GanttCommands.ExpandAll:return A(!0,e,a);case i.GanttCommands.CollapseAll:return A(!1,e,a);default:return{content:[{type:"text",text:`Unknown expand/collapse command: ${t}`}],isError:!0}}}function g(t,n){return t.id===n||t.field===n}function _(t,n,e){return t.map(a=>g(a,n)?e(a):a)}function U(t,n,e,a,o,c,r){var m;const s=Number(n.position);if(Number.isNaN(s))return{content:[{type:"text",text:"Missing required argument: position"}],isError:!0};if(r){const u=o.findIndex(C=>g(C,t)),l=c[u];if(l){const C=[...c];C.splice(u,1),C.splice(s,0,l),(m=e.onColumnsStateChange)==null||m.call(e,{columnsState:C.map((x,w)=>({...x,orderIndex:w})),target:a})}}else if(e.onColumnReorder){const u=o.findIndex(l=>g(l,t));e.onColumnReorder({oldIndex:u,newIndex:s,target:a})}else return{content:[{type:"text",text:"Column reorder not supported."}],isError:!0};return{content:[{type:"text",text:`Column ${t} moved to position ${s}.`}]}}function L(t,n,e,a,o,c,r){var m;const s=Number.parseInt(n.size,10);if(Number.isNaN(s))return{content:[{type:"text",text:"Missing required argument: size"}],isError:!0};if(r)(m=e.onColumnsStateChange)==null||m.call(e,{columnsState:_(c,t,u=>({...u,width:s})),target:a});else if(e.onColumnResize){const u=o.findIndex(x=>g(x,t)),l=(e.columns||[])[u],C=l&&l.width||0;e.onColumnResize({index:u,newWidth:s,oldWidth:C,end:!0,target:a})}else return{content:[{type:"text",text:"Column resize not supported."}],isError:!0};return{content:[{type:"text",text:`Column ${t} resized to ${s}px.`}]}}function z(t,n,e,a,o,c){var s;return c?((s=e.onColumnsStateChange)==null||s.call(e,{columnsState:_(o,t,m=>({...m,hidden:n})),target:a}),{content:[{type:"text",text:`Column ${t} is now ${n?"hidden":"visible"}.`}]}):{content:[{type:"text",text:"Column state changes not supported."}],isError:!0}}function B(t,n,e,a,o){const c=n.id;if(!c)return{content:[{type:"text",text:"Missing required argument: id"}],isError:!0};const r=e.current,s=!!r.onColumnsStateChange&&!!a,m=s?r.columnsState||(a==null?void 0:a.columns)||[]:[];switch(t){case i.GanttCommands.ColumnReorder:return U(c,n,r,a,o,m,s);case i.GanttCommands.ColumnResize:return L(c,n,r,a,o,m,s);case i.GanttCommands.ColumnShow:return z(c,!1,r,a,m,s);case i.GanttCommands.ColumnHide:return z(c,!0,r,a,m,s);default:return null}}function J(t,n,e){const a=t.view;return a?(n.current.onViewChange&&n.current.onViewChange({value:a,target:e}),{content:[{type:"text",text:`Switched to ${a} view.`}]}):{content:[{type:"text",text:"Missing required argument: view"}],isError:!0}}function K(t,n,e,a){var s;const o=e.current,c=o.onTaskChange||o.onDataStateChange;if(!c)return null;const r=b(o.taskModelFields);switch(t){case i.GanttCommands.CreateTask:{const m=n.title;if(!m)return{content:[{type:"text",text:"Missing required argument: title"}],isError:!0};const u={[r.id]:Date.now(),[r.title]:m,[r.start]:n.start?new Date(n.start):void 0,[r.end]:n.end?new Date(n.end):void 0,[r.percentComplete]:(s=n.percentComplete)!=null?s:0};return c({created:[u],updated:[],deleted:[]}),{content:[{type:"text",text:`Added task "${m}".`}]}}case i.GanttCommands.DeleteTask:{const m=G(o.taskData||[],r);let u;return n.field&&n.operator?u=m.find(l=>{const C=l[n.field];return D(C,n.operator,n.value)}):n.id!==void 0&&(u=m.find(l=>String(l[r.id])===String(n.id))),u?(c({created:[],updated:[],deleted:[u]}),{content:[{type:"text",text:`Deleted task "${S.toText(u[r.title])}".`}]}):{content:[{type:"text",text:"No matching task found."}],isError:!0}}default:return null}}const Q={componentSuffix:"gantt",createTools(t,n,e,a){const o=[],c=d=>`${e.groupName}_${d}`,r=n.current,s=H(r),m=!!r.sortable,u=!!r.onFilterChange,l=!!r.onExpandChange,C=!!r.onViewChange,x=!!r.onTaskChange||!!r.onDataStateChange,w=!!r.reorderable,I=!!r.resizable,E=!!r.onColumnsStateChange,$=[{name:"sort",description:`Sort the ${e.dataName} gantt by a column`,commandType:i.GanttCommands.Sort,enabled:m},{name:"clear_sort",description:`Remove all sorting from the ${e.dataName} gantt`,commandType:i.GanttCommands.ClearSort,enabled:m},{name:"filter",description:`Filter the ${e.dataName} gantt on a column`,commandType:i.GanttCommands.Filter,enabled:u},{name:"clear_filters",description:`Remove all filters from the ${e.dataName} gantt`,commandType:i.GanttCommands.ClearFilter,enabled:u},{name:"expand",description:`Expand a task in the ${e.dataName} gantt`,commandType:i.GanttCommands.Expand,enabled:l},{name:"collapse",description:`Collapse a task in the ${e.dataName} gantt`,commandType:i.GanttCommands.Collapse,enabled:l},{name:"expand_all",description:`Expand all parent tasks in the ${e.dataName} gantt`,commandType:i.GanttCommands.ExpandAll,enabled:l},{name:"collapse_all",description:`Collapse all parent tasks in the ${e.dataName} gantt`,commandType:i.GanttCommands.CollapseAll,enabled:l},{name:"change_view",description:`Switch the ${e.dataName} gantt chart view`,commandType:i.GanttCommands.ChangeView,enabled:C},{name:"create_task",description:`Add a new task to the ${e.dataName} gantt`,commandType:i.GanttCommands.CreateTask,enabled:x},{name:"delete_task",description:`Delete a task from the ${e.dataName} gantt`,commandType:i.GanttCommands.DeleteTask,enabled:x},{name:"reorder_column",description:`Reorder a column in the ${e.dataName} gantt`,commandType:i.GanttCommands.ColumnReorder,enabled:w},{name:"resize_column",description:`Resize a column in the ${e.dataName} gantt`,commandType:i.GanttCommands.ColumnResize,enabled:I},{name:"show_column",description:`Show a hidden column in the ${e.dataName} gantt`,commandType:i.GanttCommands.ColumnShow,enabled:E},{name:"hide_column",description:`Hide a column in the ${e.dataName} gantt`,commandType:i.GanttCommands.ColumnHide,enabled:E}],y=n.current.webMcp,T=typeof y=="object"&&y!==null&&typeof y.tools=="function"?y.tools:void 0,k={tname:c,columns:s,data:r.taskData},q=T?T($,k):$,R=async(d,p)=>{const h=n.current;switch(d){case i.GanttCommands.Sort:return V(p,n,t);case i.GanttCommands.ClearSort:return h.onSortChange&&h.onSortChange({sort:[],field:"",target:t}),{content:[{type:"text",text:"Sorting cleared."}]};case i.GanttCommands.Filter:return W(p,n,t);case i.GanttCommands.ClearFilter:return h.onFilterChange&&h.onFilterChange({filter:{logic:"and",filters:[]},target:t}),{content:[{type:"text",text:"All filters cleared."}]};case i.GanttCommands.Expand:case i.GanttCommands.Collapse:case i.GanttCommands.ExpandAll:case i.GanttCommands.CollapseAll:return P(d,p,n,t);case i.GanttCommands.ChangeView:return J(p,n,t);case i.GanttCommands.CreateTask:case i.GanttCommands.DeleteTask:{const f=K(d,p,n);return f||{content:[{type:"text",text:"Task operations not supported."}],isError:!0}}case i.GanttCommands.ColumnReorder:case i.GanttCommands.ColumnResize:case i.GanttCommands.ColumnShow:case i.GanttCommands.ColumnHide:{const f=B(d,p,n,t,s);return f||{content:[{type:"text",text:`Unknown column command: ${d}`}],isError:!0}}default:return{content:[{type:"text",text:`Unknown command: ${d}`}],isError:!0}}};for(const d of q){if(!d.enabled)continue;const p=i.getGanttToolSchema(d.commandType,s),h=d.commandType;try{o.push(a.registerTool({name:c(d.name),description:d.description,inputSchema:p,execute:async f=>R(h,f||{})}))}catch{}}return o}};exports.ganttAdapter=Q;
@@ -0,0 +1,370 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as N from "react";
9
+ import { GanttCommands as i, getGanttToolSchema as H } from "../commands/gantt.mjs";
10
+ import { toText as S } from "./utils.mjs";
11
+ function E(t) {
12
+ return {
13
+ id: (t == null ? void 0 : t.id) || "id",
14
+ title: (t == null ? void 0 : t.title) || "title",
15
+ start: (t == null ? void 0 : t.start) || "start",
16
+ end: (t == null ? void 0 : t.end) || "end",
17
+ percentComplete: (t == null ? void 0 : t.percentComplete) || "percentComplete",
18
+ isExpanded: (t == null ? void 0 : t.isExpanded) || "isExpanded",
19
+ children: (t == null ? void 0 : t.children) || "children"
20
+ };
21
+ }
22
+ function b(t, e) {
23
+ const n = [], r = (o) => {
24
+ for (const c of o) {
25
+ n.push(c);
26
+ const a = c[e.children];
27
+ Array.isArray(a) && a.length > 0 && r(a);
28
+ }
29
+ };
30
+ return r(t), n;
31
+ }
32
+ function V(t) {
33
+ const e = [];
34
+ if (Array.isArray(t.columns))
35
+ for (const n of t.columns)
36
+ n.field && e.push({ field: n.field, id: n.id || n.field });
37
+ return e.length === 0 && t.children && N.Children.forEach(t.children, (n) => {
38
+ if (N.isValidElement(n) && n.props.field) {
39
+ const r = n.props;
40
+ e.push({ field: r.field, id: r.id || r.field });
41
+ }
42
+ }), e;
43
+ }
44
+ function W(t, e, n) {
45
+ if (!t.field)
46
+ return { content: [{ type: "text", text: "Missing required argument: field" }], isError: !0 };
47
+ const r = t.field, o = t.dir || "asc", c = [{ field: r, dir: o }];
48
+ return e.current.onSortChange && e.current.onSortChange({ sort: c, field: r, target: n }), { content: [{ type: "text", text: `Sorted by ${r} ${o}.` }] };
49
+ }
50
+ function U(t, e, n) {
51
+ if (!t.field || !t.operator)
52
+ return { content: [{ type: "text", text: "Missing required arguments: field, operator" }], isError: !0 };
53
+ const r = t.field, o = t.operator, c = t.value;
54
+ return e.current.onFilterChange && e.current.onFilterChange({
55
+ filter: { logic: "and", filters: [{ field: r, operator: o, value: c }] },
56
+ target: n
57
+ }), { content: [{ type: "text", text: `Filter applied: ${r} ${o} "${S(c)}".` }] };
58
+ }
59
+ function I(t, e, n) {
60
+ const r = typeof t == "string" ? t.toLowerCase() : t, o = typeof n == "string" ? n.toLowerCase() : n;
61
+ switch (e) {
62
+ case "eq":
63
+ return r === o;
64
+ case "neq":
65
+ return r !== o;
66
+ case "contains":
67
+ return typeof r == "string" && typeof o == "string" && r.includes(o);
68
+ case "startswith":
69
+ return typeof r == "string" && typeof o == "string" && r.startsWith(o);
70
+ case "endswith":
71
+ return typeof r == "string" && typeof o == "string" && r.endsWith(o);
72
+ default:
73
+ return r === o;
74
+ }
75
+ }
76
+ function A(t, e, n, r) {
77
+ const o = n.current, c = E(o.taskModelFields), a = b(o.taskData || [], c);
78
+ let s;
79
+ return e.field && e.operator ? s = a.find((l) => {
80
+ const d = l[e.field];
81
+ return I(d, e.operator, e.value);
82
+ }) : e.id !== void 0 && (s = a.find((l) => String(l[c.id]) === String(e.id))), s ? (o.onExpandChange && o.onExpandChange({ dataItem: s, value: t, level: [], target: r }), { content: [{ type: "text", text: `${t ? "Expanded" : "Collapsed"} task "${S(s[c.title])}".` }] }) : { content: [{ type: "text", text: "No matching task found." }], isError: !0 };
83
+ }
84
+ function z(t, e, n) {
85
+ const r = e.current, o = E(r.taskModelFields), a = b(r.taskData || [], o).filter((u) => {
86
+ const l = u[o.children];
87
+ return Array.isArray(l) && l.length > 0;
88
+ });
89
+ if (r.onExpandChange)
90
+ for (const u of a)
91
+ r.onExpandChange({ dataItem: u, value: t, level: [], target: n });
92
+ return { content: [{ type: "text", text: `${t ? "Expanded" : "Collapsed"} ${a.length} parent task(s).` }] };
93
+ }
94
+ function L(t, e, n, r) {
95
+ switch (t) {
96
+ case i.Expand:
97
+ return A(!0, e, n, r);
98
+ case i.Collapse:
99
+ return A(!1, e, n, r);
100
+ case i.ExpandAll:
101
+ return z(!0, n, r);
102
+ case i.CollapseAll:
103
+ return z(!1, n, r);
104
+ default:
105
+ return {
106
+ content: [{ type: "text", text: `Unknown expand/collapse command: ${t}` }],
107
+ isError: !0
108
+ };
109
+ }
110
+ }
111
+ function g(t, e) {
112
+ return t.id === e || t.field === e;
113
+ }
114
+ function _(t, e, n) {
115
+ return t.map(
116
+ (r) => g(r, e) ? n(r) : r
117
+ );
118
+ }
119
+ function j(t, e, n, r, o, c, a) {
120
+ var u;
121
+ const s = Number(e.position);
122
+ if (Number.isNaN(s))
123
+ return { content: [{ type: "text", text: "Missing required argument: position" }], isError: !0 };
124
+ if (a) {
125
+ const l = o.findIndex((p) => g(p, t)), d = c[l];
126
+ if (d) {
127
+ const p = [...c];
128
+ p.splice(l, 1), p.splice(s, 0, d), (u = n.onColumnsStateChange) == null || u.call(n, {
129
+ columnsState: p.map((C, w) => ({ ...C, orderIndex: w })),
130
+ target: r
131
+ });
132
+ }
133
+ } else if (n.onColumnReorder) {
134
+ const l = o.findIndex((d) => g(d, t));
135
+ n.onColumnReorder({ oldIndex: l, newIndex: s, target: r });
136
+ } else
137
+ return { content: [{ type: "text", text: "Column reorder not supported." }], isError: !0 };
138
+ return { content: [{ type: "text", text: `Column ${t} moved to position ${s}.` }] };
139
+ }
140
+ function B(t, e, n, r, o, c, a) {
141
+ var u;
142
+ const s = Number.parseInt(e.size, 10);
143
+ if (Number.isNaN(s))
144
+ return { content: [{ type: "text", text: "Missing required argument: size" }], isError: !0 };
145
+ if (a)
146
+ (u = n.onColumnsStateChange) == null || u.call(n, {
147
+ columnsState: _(c, t, (l) => ({ ...l, width: s })),
148
+ target: r
149
+ });
150
+ else if (n.onColumnResize) {
151
+ const l = o.findIndex((C) => g(C, t)), d = (n.columns || [])[l], p = d && d.width || 0;
152
+ n.onColumnResize({ index: l, newWidth: s, oldWidth: p, end: !0, target: r });
153
+ } else
154
+ return { content: [{ type: "text", text: "Column resize not supported." }], isError: !0 };
155
+ return { content: [{ type: "text", text: `Column ${t} resized to ${s}px.` }] };
156
+ }
157
+ function D(t, e, n, r, o, c) {
158
+ var s;
159
+ return c ? ((s = n.onColumnsStateChange) == null || s.call(n, {
160
+ columnsState: _(o, t, (u) => ({ ...u, hidden: e })),
161
+ target: r
162
+ }), { content: [{ type: "text", text: `Column ${t} is now ${e ? "hidden" : "visible"}.` }] }) : { content: [{ type: "text", text: "Column state changes not supported." }], isError: !0 };
163
+ }
164
+ function O(t, e, n, r, o) {
165
+ const c = e.id;
166
+ if (!c)
167
+ return { content: [{ type: "text", text: "Missing required argument: id" }], isError: !0 };
168
+ const a = n.current, s = !!a.onColumnsStateChange && !!r, u = s ? a.columnsState || (r == null ? void 0 : r.columns) || [] : [];
169
+ switch (t) {
170
+ case i.ColumnReorder:
171
+ return j(c, e, a, r, o, u, s);
172
+ case i.ColumnResize:
173
+ return B(c, e, a, r, o, u, s);
174
+ case i.ColumnShow:
175
+ return D(c, !1, a, r, u, s);
176
+ case i.ColumnHide:
177
+ return D(c, !0, a, r, u, s);
178
+ default:
179
+ return null;
180
+ }
181
+ }
182
+ function J(t, e, n) {
183
+ const r = t.view;
184
+ return r ? (e.current.onViewChange && e.current.onViewChange({ value: r, target: n }), { content: [{ type: "text", text: `Switched to ${r} view.` }] }) : { content: [{ type: "text", text: "Missing required argument: view" }], isError: !0 };
185
+ }
186
+ function K(t, e, n, r) {
187
+ var s;
188
+ const o = n.current, c = o.onTaskChange || o.onDataStateChange;
189
+ if (!c)
190
+ return null;
191
+ const a = E(o.taskModelFields);
192
+ switch (t) {
193
+ case i.CreateTask: {
194
+ const u = e.title;
195
+ if (!u)
196
+ return { content: [{ type: "text", text: "Missing required argument: title" }], isError: !0 };
197
+ const l = {
198
+ [a.id]: Date.now(),
199
+ [a.title]: u,
200
+ [a.start]: e.start ? new Date(e.start) : void 0,
201
+ [a.end]: e.end ? new Date(e.end) : void 0,
202
+ [a.percentComplete]: (s = e.percentComplete) != null ? s : 0
203
+ };
204
+ return c({ created: [l], updated: [], deleted: [] }), { content: [{ type: "text", text: `Added task "${u}".` }] };
205
+ }
206
+ case i.DeleteTask: {
207
+ const u = b(o.taskData || [], a);
208
+ let l;
209
+ return e.field && e.operator ? l = u.find((d) => {
210
+ const p = d[e.field];
211
+ return I(p, e.operator, e.value);
212
+ }) : e.id !== void 0 && (l = u.find((d) => String(d[a.id]) === String(e.id))), l ? (c({ created: [], updated: [], deleted: [l] }), { content: [{ type: "text", text: `Deleted task "${S(l[a.title])}".` }] }) : { content: [{ type: "text", text: "No matching task found." }], isError: !0 };
213
+ }
214
+ default:
215
+ return null;
216
+ }
217
+ }
218
+ const X = {
219
+ componentSuffix: "gantt",
220
+ createTools(t, e, n, r) {
221
+ const o = [], c = (m) => `${n.groupName}_${m}`, a = e.current, s = V(a), u = !!a.sortable, l = !!a.onFilterChange, d = !!a.onExpandChange, p = !!a.onViewChange, C = !!a.onTaskChange || !!a.onDataStateChange, w = !!a.reorderable, k = !!a.resizable, $ = !!a.onColumnsStateChange, v = [
222
+ {
223
+ name: "sort",
224
+ description: `Sort the ${n.dataName} gantt by a column`,
225
+ commandType: i.Sort,
226
+ enabled: u
227
+ },
228
+ {
229
+ name: "clear_sort",
230
+ description: `Remove all sorting from the ${n.dataName} gantt`,
231
+ commandType: i.ClearSort,
232
+ enabled: u
233
+ },
234
+ {
235
+ name: "filter",
236
+ description: `Filter the ${n.dataName} gantt on a column`,
237
+ commandType: i.Filter,
238
+ enabled: l
239
+ },
240
+ {
241
+ name: "clear_filters",
242
+ description: `Remove all filters from the ${n.dataName} gantt`,
243
+ commandType: i.ClearFilter,
244
+ enabled: l
245
+ },
246
+ {
247
+ name: "expand",
248
+ description: `Expand a task in the ${n.dataName} gantt`,
249
+ commandType: i.Expand,
250
+ enabled: d
251
+ },
252
+ {
253
+ name: "collapse",
254
+ description: `Collapse a task in the ${n.dataName} gantt`,
255
+ commandType: i.Collapse,
256
+ enabled: d
257
+ },
258
+ {
259
+ name: "expand_all",
260
+ description: `Expand all parent tasks in the ${n.dataName} gantt`,
261
+ commandType: i.ExpandAll,
262
+ enabled: d
263
+ },
264
+ {
265
+ name: "collapse_all",
266
+ description: `Collapse all parent tasks in the ${n.dataName} gantt`,
267
+ commandType: i.CollapseAll,
268
+ enabled: d
269
+ },
270
+ {
271
+ name: "change_view",
272
+ description: `Switch the ${n.dataName} gantt chart view`,
273
+ commandType: i.ChangeView,
274
+ enabled: p
275
+ },
276
+ {
277
+ name: "create_task",
278
+ description: `Add a new task to the ${n.dataName} gantt`,
279
+ commandType: i.CreateTask,
280
+ enabled: C
281
+ },
282
+ {
283
+ name: "delete_task",
284
+ description: `Delete a task from the ${n.dataName} gantt`,
285
+ commandType: i.DeleteTask,
286
+ enabled: C
287
+ },
288
+ {
289
+ name: "reorder_column",
290
+ description: `Reorder a column in the ${n.dataName} gantt`,
291
+ commandType: i.ColumnReorder,
292
+ enabled: w
293
+ },
294
+ {
295
+ name: "resize_column",
296
+ description: `Resize a column in the ${n.dataName} gantt`,
297
+ commandType: i.ColumnResize,
298
+ enabled: k
299
+ },
300
+ {
301
+ name: "show_column",
302
+ description: `Show a hidden column in the ${n.dataName} gantt`,
303
+ commandType: i.ColumnShow,
304
+ enabled: $
305
+ },
306
+ {
307
+ name: "hide_column",
308
+ description: `Hide a column in the ${n.dataName} gantt`,
309
+ commandType: i.ColumnHide,
310
+ enabled: $
311
+ }
312
+ ], y = e.current.webMcp, T = typeof y == "object" && y !== null && typeof y.tools == "function" ? y.tools : void 0, q = { tname: c, columns: s, data: a.taskData }, R = T ? T(v, q) : v, G = async (m, x) => {
313
+ const h = e.current;
314
+ switch (m) {
315
+ case i.Sort:
316
+ return W(x, e, t);
317
+ case i.ClearSort:
318
+ return h.onSortChange && h.onSortChange({ sort: [], field: "", target: t }), { content: [{ type: "text", text: "Sorting cleared." }] };
319
+ case i.Filter:
320
+ return U(x, e, t);
321
+ case i.ClearFilter:
322
+ return h.onFilterChange && h.onFilterChange({ filter: { logic: "and", filters: [] }, target: t }), { content: [{ type: "text", text: "All filters cleared." }] };
323
+ case i.Expand:
324
+ case i.Collapse:
325
+ case i.ExpandAll:
326
+ case i.CollapseAll:
327
+ return L(m, x, e, t);
328
+ case i.ChangeView:
329
+ return J(x, e, t);
330
+ case i.CreateTask:
331
+ case i.DeleteTask: {
332
+ const f = K(m, x, e);
333
+ return f || { content: [{ type: "text", text: "Task operations not supported." }], isError: !0 };
334
+ }
335
+ case i.ColumnReorder:
336
+ case i.ColumnResize:
337
+ case i.ColumnShow:
338
+ case i.ColumnHide: {
339
+ const f = O(m, x, e, t, s);
340
+ return f || {
341
+ content: [{ type: "text", text: `Unknown column command: ${m}` }],
342
+ isError: !0
343
+ };
344
+ }
345
+ default:
346
+ return { content: [{ type: "text", text: `Unknown command: ${m}` }], isError: !0 };
347
+ }
348
+ };
349
+ for (const m of R) {
350
+ if (!m.enabled)
351
+ continue;
352
+ const x = H(m.commandType, s), h = m.commandType;
353
+ try {
354
+ o.push(
355
+ r.registerTool({
356
+ name: c(m.name),
357
+ description: m.description,
358
+ inputSchema: x,
359
+ execute: async (f) => G(h, f || {})
360
+ })
361
+ );
362
+ } catch {
363
+ }
364
+ }
365
+ return o;
366
+ }
367
+ };
368
+ export {
369
+ X as ganttAdapter
370
+ };