@wootsup/yt-builder-mcp 1.1.6 → 1.2.0

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 (430) hide show
  1. package/README.md +7 -7
  2. package/bin/yt-builder-mcp.js +55 -40
  3. package/dist/auth.d.ts +137 -0
  4. package/dist/auth.d.ts.map +1 -0
  5. package/dist/auth.js +244 -0
  6. package/dist/auth.js.map +1 -0
  7. package/dist/cli/invocation-decision.d.ts +57 -0
  8. package/dist/cli/invocation-decision.d.ts.map +1 -0
  9. package/dist/cli/invocation-decision.js +86 -0
  10. package/dist/cli/invocation-decision.js.map +1 -0
  11. package/dist/client.d.ts +112 -0
  12. package/dist/client.d.ts.map +1 -0
  13. package/dist/client.js +190 -0
  14. package/dist/client.js.map +1 -0
  15. package/dist/clients/claude-code.d.ts +18 -0
  16. package/dist/clients/claude-code.d.ts.map +1 -0
  17. package/dist/clients/claude-code.js +55 -0
  18. package/dist/clients/claude-code.js.map +1 -0
  19. package/dist/clients/claude-desktop.d.ts +19 -0
  20. package/dist/clients/claude-desktop.d.ts.map +1 -0
  21. package/dist/clients/claude-desktop.js +58 -0
  22. package/dist/clients/claude-desktop.js.map +1 -0
  23. package/dist/clients/cline.d.ts +26 -0
  24. package/dist/clients/cline.d.ts.map +1 -0
  25. package/dist/clients/cline.js +82 -0
  26. package/dist/clients/cline.js.map +1 -0
  27. package/dist/clients/codex-cli.d.ts +42 -0
  28. package/dist/clients/codex-cli.d.ts.map +1 -0
  29. package/dist/clients/codex-cli.js +292 -0
  30. package/dist/clients/codex-cli.js.map +1 -0
  31. package/dist/clients/continue.d.ts +13 -0
  32. package/dist/clients/continue.d.ts.map +1 -0
  33. package/dist/clients/continue.js +121 -0
  34. package/dist/clients/continue.js.map +1 -0
  35. package/dist/clients/cursor.d.ts +12 -0
  36. package/dist/clients/cursor.d.ts.map +1 -0
  37. package/dist/clients/cursor.js +40 -0
  38. package/dist/clients/cursor.js.map +1 -0
  39. package/dist/clients/gemini-cli.d.ts +18 -0
  40. package/dist/clients/gemini-cli.d.ts.map +1 -0
  41. package/dist/clients/gemini-cli.js +46 -0
  42. package/dist/clients/gemini-cli.js.map +1 -0
  43. package/dist/clients/home.d.ts +14 -0
  44. package/dist/clients/home.d.ts.map +1 -0
  45. package/dist/clients/home.js +20 -0
  46. package/dist/clients/home.js.map +1 -0
  47. package/dist/clients/index.d.ts +156 -0
  48. package/dist/clients/index.d.ts.map +1 -0
  49. package/dist/clients/index.js +213 -0
  50. package/dist/clients/index.js.map +1 -0
  51. package/dist/clients/roo-code.d.ts +23 -0
  52. package/dist/clients/roo-code.d.ts.map +1 -0
  53. package/dist/clients/roo-code.js +71 -0
  54. package/dist/clients/roo-code.js.map +1 -0
  55. package/dist/clients/zed.d.ts +12 -0
  56. package/dist/clients/zed.d.ts.map +1 -0
  57. package/dist/clients/zed.js +43 -0
  58. package/dist/clients/zed.js.map +1 -0
  59. package/dist/errors/hints.d.ts +51 -0
  60. package/dist/errors/hints.d.ts.map +1 -0
  61. package/dist/errors/hints.js +95 -0
  62. package/dist/errors/hints.js.map +1 -0
  63. package/dist/errors/mask.d.ts +35 -0
  64. package/dist/errors/mask.d.ts.map +1 -0
  65. package/dist/errors/mask.js +49 -0
  66. package/dist/errors/mask.js.map +1 -0
  67. package/dist/errors/sanitize.d.ts +31 -0
  68. package/dist/errors/sanitize.d.ts.map +1 -0
  69. package/dist/errors/sanitize.js +100 -0
  70. package/dist/errors/sanitize.js.map +1 -0
  71. package/dist/errors.d.ts +42 -0
  72. package/dist/errors.d.ts.map +1 -0
  73. package/dist/errors.js +61 -0
  74. package/dist/errors.js.map +1 -0
  75. package/dist/gateway/advanced-tool/discovery.d.ts +19 -0
  76. package/dist/gateway/advanced-tool/discovery.d.ts.map +1 -0
  77. package/dist/gateway/advanced-tool/discovery.js +53 -0
  78. package/dist/gateway/advanced-tool/discovery.js.map +1 -0
  79. package/dist/gateway/advanced-tool/domains.d.ts +47 -0
  80. package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
  81. package/dist/gateway/advanced-tool/domains.js +94 -0
  82. package/dist/gateway/advanced-tool/domains.js.map +1 -0
  83. package/dist/gateway/advanced-tool/execute.d.ts +29 -0
  84. package/dist/gateway/advanced-tool/execute.d.ts.map +1 -0
  85. package/dist/gateway/advanced-tool/execute.js +54 -0
  86. package/dist/gateway/advanced-tool/execute.js.map +1 -0
  87. package/dist/gateway/advanced-tool/index.d.ts +36 -0
  88. package/dist/gateway/advanced-tool/index.d.ts.map +1 -0
  89. package/dist/gateway/advanced-tool/index.js +39 -0
  90. package/dist/gateway/advanced-tool/index.js.map +1 -0
  91. package/dist/gateway/advanced-tool/register.d.ts +18 -0
  92. package/dist/gateway/advanced-tool/register.d.ts.map +1 -0
  93. package/dist/gateway/advanced-tool/register.js +69 -0
  94. package/dist/gateway/advanced-tool/register.js.map +1 -0
  95. package/dist/gateway/advanced-tool.d.ts +13 -0
  96. package/dist/gateway/advanced-tool.d.ts.map +1 -0
  97. package/dist/gateway/advanced-tool.js +13 -0
  98. package/dist/gateway/advanced-tool.js.map +1 -0
  99. package/dist/gateway/capturing-server.d.ts +117 -0
  100. package/dist/gateway/capturing-server.d.ts.map +1 -0
  101. package/dist/gateway/capturing-server.js +103 -0
  102. package/dist/gateway/capturing-server.js.map +1 -0
  103. package/dist/gateway/essentials.d.ts +50 -0
  104. package/dist/gateway/essentials.d.ts.map +1 -0
  105. package/dist/gateway/essentials.js +108 -0
  106. package/dist/gateway/essentials.js.map +1 -0
  107. package/dist/gateway/test-support.d.ts +41 -0
  108. package/dist/gateway/test-support.d.ts.map +1 -0
  109. package/dist/gateway/test-support.js +60 -0
  110. package/dist/gateway/test-support.js.map +1 -0
  111. package/dist/index.d.ts +30 -0
  112. package/dist/index.d.ts.map +1 -0
  113. package/dist/index.js +119 -0
  114. package/dist/index.js.map +1 -0
  115. package/dist/install-skill.d.ts +43 -0
  116. package/dist/install-skill.d.ts.map +1 -0
  117. package/dist/install-skill.js +118 -0
  118. package/dist/install-skill.js.map +1 -0
  119. package/dist/platform/detect.d.ts +64 -0
  120. package/dist/platform/detect.d.ts.map +1 -0
  121. package/dist/platform/detect.js +98 -0
  122. package/dist/platform/detect.js.map +1 -0
  123. package/dist/platform/index.d.ts +121 -0
  124. package/dist/platform/index.d.ts.map +1 -0
  125. package/dist/platform/index.js +176 -0
  126. package/dist/platform/index.js.map +1 -0
  127. package/dist/platform/joomla.d.ts +44 -0
  128. package/dist/platform/joomla.d.ts.map +1 -0
  129. package/dist/platform/joomla.js +46 -0
  130. package/dist/platform/joomla.js.map +1 -0
  131. package/dist/server.d.ts +110 -0
  132. package/dist/server.d.ts.map +1 -0
  133. package/dist/server.js +274 -0
  134. package/dist/server.js.map +1 -0
  135. package/dist/setup-cli-confirm.d.ts +36 -0
  136. package/dist/setup-cli-confirm.d.ts.map +1 -0
  137. package/dist/setup-cli-confirm.js +59 -0
  138. package/dist/setup-cli-confirm.js.map +1 -0
  139. package/dist/setup-cli.d.ts +193 -0
  140. package/dist/setup-cli.d.ts.map +1 -0
  141. package/dist/setup-cli.js +1032 -0
  142. package/dist/setup-cli.js.map +1 -0
  143. package/dist/setup-prompts.d.ts +64 -0
  144. package/dist/setup-prompts.d.ts.map +1 -0
  145. package/dist/setup-prompts.js +221 -0
  146. package/dist/setup-prompts.js.map +1 -0
  147. package/dist/setup-token.d.ts +38 -0
  148. package/dist/setup-token.d.ts.map +1 -0
  149. package/dist/setup-token.js +106 -0
  150. package/dist/setup-token.js.map +1 -0
  151. package/dist/setup-wizard-defaults.d.ts +43 -0
  152. package/dist/setup-wizard-defaults.d.ts.map +1 -0
  153. package/dist/setup-wizard-defaults.js +160 -0
  154. package/dist/setup-wizard-defaults.js.map +1 -0
  155. package/dist/setup-wizard-handshake.d.ts +25 -0
  156. package/dist/setup-wizard-handshake.d.ts.map +1 -0
  157. package/dist/setup-wizard-handshake.js +103 -0
  158. package/dist/setup-wizard-handshake.js.map +1 -0
  159. package/dist/setup-wizard-types.d.ts +164 -0
  160. package/dist/setup-wizard-types.d.ts.map +1 -0
  161. package/dist/setup-wizard-types.js +11 -0
  162. package/dist/setup-wizard-types.js.map +1 -0
  163. package/dist/setup-wizard.d.ts +33 -0
  164. package/dist/setup-wizard.d.ts.map +1 -0
  165. package/dist/setup-wizard.js +199 -0
  166. package/dist/setup-wizard.js.map +1 -0
  167. package/dist/setup.d.ts +17 -0
  168. package/dist/setup.d.ts.map +1 -0
  169. package/dist/setup.js +33 -0
  170. package/dist/setup.js.map +1 -0
  171. package/dist/sites/bootstrap.d.ts +41 -0
  172. package/dist/sites/bootstrap.d.ts.map +1 -0
  173. package/dist/sites/bootstrap.js +58 -0
  174. package/dist/sites/bootstrap.js.map +1 -0
  175. package/dist/sites/cli/add-site.d.ts +106 -0
  176. package/dist/sites/cli/add-site.d.ts.map +1 -0
  177. package/dist/sites/cli/add-site.js +185 -0
  178. package/dist/sites/cli/add-site.js.map +1 -0
  179. package/dist/sites/cli/list-sites.d.ts +40 -0
  180. package/dist/sites/cli/list-sites.d.ts.map +1 -0
  181. package/dist/sites/cli/list-sites.js +116 -0
  182. package/dist/sites/cli/list-sites.js.map +1 -0
  183. package/dist/sites/cli/remove-site.d.ts +60 -0
  184. package/dist/sites/cli/remove-site.d.ts.map +1 -0
  185. package/dist/sites/cli/remove-site.js +120 -0
  186. package/dist/sites/cli/remove-site.js.map +1 -0
  187. package/dist/sites/cli/set-default.d.ts +47 -0
  188. package/dist/sites/cli/set-default.d.ts.map +1 -0
  189. package/dist/sites/cli/set-default.js +69 -0
  190. package/dist/sites/cli/set-default.js.map +1 -0
  191. package/dist/sites/cli/test-site.d.ts +77 -0
  192. package/dist/sites/cli/test-site.d.ts.map +1 -0
  193. package/dist/sites/cli/test-site.js +146 -0
  194. package/dist/sites/cli/test-site.js.map +1 -0
  195. package/dist/sites/client-pool.d.ts +157 -0
  196. package/dist/sites/client-pool.d.ts.map +1 -0
  197. package/dist/sites/client-pool.js +222 -0
  198. package/dist/sites/client-pool.js.map +1 -0
  199. package/dist/sites/env-bridge.d.ts +55 -0
  200. package/dist/sites/env-bridge.d.ts.map +1 -0
  201. package/dist/sites/env-bridge.js +94 -0
  202. package/dist/sites/env-bridge.js.map +1 -0
  203. package/dist/sites/paths.d.ts +21 -0
  204. package/dist/sites/paths.d.ts.map +1 -0
  205. package/dist/sites/paths.js +37 -0
  206. package/dist/sites/paths.js.map +1 -0
  207. package/dist/sites/probe.d.ts +60 -0
  208. package/dist/sites/probe.d.ts.map +1 -0
  209. package/dist/sites/probe.js +112 -0
  210. package/dist/sites/probe.js.map +1 -0
  211. package/dist/sites/registry.d.ts +142 -0
  212. package/dist/sites/registry.d.ts.map +1 -0
  213. package/dist/sites/registry.js +163 -0
  214. package/dist/sites/registry.js.map +1 -0
  215. package/dist/sites/schema.d.ts +90 -0
  216. package/dist/sites/schema.d.ts.map +1 -0
  217. package/dist/sites/schema.js +71 -0
  218. package/dist/sites/schema.js.map +1 -0
  219. package/dist/sites/secret-resolver.d.ts +115 -0
  220. package/dist/sites/secret-resolver.d.ts.map +1 -0
  221. package/dist/sites/secret-resolver.js +225 -0
  222. package/dist/sites/secret-resolver.js.map +1 -0
  223. package/dist/sites/store.d.ts +82 -0
  224. package/dist/sites/store.d.ts.map +1 -0
  225. package/dist/sites/store.js +198 -0
  226. package/dist/sites/store.js.map +1 -0
  227. package/dist/sites/tools/index.d.ts +28 -0
  228. package/dist/sites/tools/index.d.ts.map +1 -0
  229. package/dist/sites/tools/index.js +38 -0
  230. package/dist/sites/tools/index.js.map +1 -0
  231. package/dist/sites/tools/sites-list.d.ts +48 -0
  232. package/dist/sites/tools/sites-list.d.ts.map +1 -0
  233. package/dist/sites/tools/sites-list.js +137 -0
  234. package/dist/sites/tools/sites-list.js.map +1 -0
  235. package/dist/sites/tools/sites-test.d.ts +47 -0
  236. package/dist/sites/tools/sites-test.d.ts.map +1 -0
  237. package/dist/sites/tools/sites-test.js +148 -0
  238. package/dist/sites/tools/sites-test.js.map +1 -0
  239. package/dist/sites/tools/use-site.d.ts +47 -0
  240. package/dist/sites/tools/use-site.d.ts.map +1 -0
  241. package/dist/sites/tools/use-site.js +183 -0
  242. package/dist/sites/tools/use-site.js.map +1 -0
  243. package/dist/skill-loader.d.ts +111 -0
  244. package/dist/skill-loader.d.ts.map +1 -0
  245. package/dist/skill-loader.js +191 -0
  246. package/dist/skill-loader.js.map +1 -0
  247. package/dist/tools/elements/builders.d.ts +24 -0
  248. package/dist/tools/elements/builders.d.ts.map +1 -0
  249. package/dist/tools/elements/builders.js +208 -0
  250. package/dist/tools/elements/builders.js.map +1 -0
  251. package/dist/tools/elements/handlers-write.d.ts +49 -0
  252. package/dist/tools/elements/handlers-write.d.ts.map +1 -0
  253. package/dist/tools/elements/handlers-write.js +341 -0
  254. package/dist/tools/elements/handlers-write.js.map +1 -0
  255. package/dist/tools/elements/handlers.d.ts +70 -0
  256. package/dist/tools/elements/handlers.d.ts.map +1 -0
  257. package/dist/tools/elements/handlers.js +292 -0
  258. package/dist/tools/elements/handlers.js.map +1 -0
  259. package/dist/tools/elements/index.d.ts +28 -0
  260. package/dist/tools/elements/index.d.ts.map +1 -0
  261. package/dist/tools/elements/index.js +27 -0
  262. package/dist/tools/elements/index.js.map +1 -0
  263. package/dist/tools/elements.d.ts +13 -0
  264. package/dist/tools/elements.d.ts.map +1 -0
  265. package/dist/tools/elements.js +13 -0
  266. package/dist/tools/elements.js.map +1 -0
  267. package/dist/tools/elicitation.d.ts +87 -0
  268. package/dist/tools/elicitation.d.ts.map +1 -0
  269. package/dist/tools/elicitation.js +100 -0
  270. package/dist/tools/elicitation.js.map +1 -0
  271. package/dist/tools/format/elements-format.d.ts +40 -0
  272. package/dist/tools/format/elements-format.d.ts.map +1 -0
  273. package/dist/tools/format/elements-format.js +193 -0
  274. package/dist/tools/format/elements-format.js.map +1 -0
  275. package/dist/tools/format/health-format.d.ts +79 -0
  276. package/dist/tools/format/health-format.d.ts.map +1 -0
  277. package/dist/tools/format/health-format.js +181 -0
  278. package/dist/tools/format/health-format.js.map +1 -0
  279. package/dist/tools/format/inspection-format.d.ts +70 -0
  280. package/dist/tools/format/inspection-format.d.ts.map +1 -0
  281. package/dist/tools/format/inspection-format.js +359 -0
  282. package/dist/tools/format/inspection-format.js.map +1 -0
  283. package/dist/tools/format/pages-format.d.ts +57 -0
  284. package/dist/tools/format/pages-format.d.ts.map +1 -0
  285. package/dist/tools/format/pages-format.js +157 -0
  286. package/dist/tools/format/pages-format.js.map +1 -0
  287. package/dist/tools/format/sources-format.d.ts +44 -0
  288. package/dist/tools/format/sources-format.d.ts.map +1 -0
  289. package/dist/tools/format/sources-format.js +242 -0
  290. package/dist/tools/format/sources-format.js.map +1 -0
  291. package/dist/tools/health.d.ts +22 -0
  292. package/dist/tools/health.d.ts.map +1 -0
  293. package/dist/tools/health.js +220 -0
  294. package/dist/tools/health.js.map +1 -0
  295. package/dist/tools/index.d.ts +30 -0
  296. package/dist/tools/index.d.ts.map +1 -0
  297. package/dist/tools/index.js +39 -0
  298. package/dist/tools/index.js.map +1 -0
  299. package/dist/tools/inspection.d.ts +14 -0
  300. package/dist/tools/inspection.d.ts.map +1 -0
  301. package/dist/tools/inspection.js +401 -0
  302. package/dist/tools/inspection.js.map +1 -0
  303. package/dist/tools/layout-flatten.d.ts +75 -0
  304. package/dist/tools/layout-flatten.d.ts.map +1 -0
  305. package/dist/tools/layout-flatten.js +107 -0
  306. package/dist/tools/layout-flatten.js.map +1 -0
  307. package/dist/tools/multi-items/builders.d.ts +23 -0
  308. package/dist/tools/multi-items/builders.d.ts.map +1 -0
  309. package/dist/tools/multi-items/builders.js +84 -0
  310. package/dist/tools/multi-items/builders.js.map +1 -0
  311. package/dist/tools/multi-items/clean-implode-handler.d.ts +36 -0
  312. package/dist/tools/multi-items/clean-implode-handler.d.ts.map +1 -0
  313. package/dist/tools/multi-items/clean-implode-handler.js +57 -0
  314. package/dist/tools/multi-items/clean-implode-handler.js.map +1 -0
  315. package/dist/tools/multi-items/format/inspection-format.d.ts +41 -0
  316. package/dist/tools/multi-items/format/inspection-format.d.ts.map +1 -0
  317. package/dist/tools/multi-items/format/inspection-format.js +64 -0
  318. package/dist/tools/multi-items/format/inspection-format.js.map +1 -0
  319. package/dist/tools/multi-items/index.d.ts +18 -0
  320. package/dist/tools/multi-items/index.d.ts.map +1 -0
  321. package/dist/tools/multi-items/index.js +18 -0
  322. package/dist/tools/multi-items/index.js.map +1 -0
  323. package/dist/tools/multi-items/inspect-handler.d.ts +76 -0
  324. package/dist/tools/multi-items/inspect-handler.d.ts.map +1 -0
  325. package/dist/tools/multi-items/inspect-handler.js +133 -0
  326. package/dist/tools/multi-items/inspect-handler.js.map +1 -0
  327. package/dist/tools/multi-items/inspection-cache.d.ts +85 -0
  328. package/dist/tools/multi-items/inspection-cache.d.ts.map +1 -0
  329. package/dist/tools/multi-items/inspection-cache.js +126 -0
  330. package/dist/tools/multi-items/inspection-cache.js.map +1 -0
  331. package/dist/tools/multi-items/item-container-map.d.ts +41 -0
  332. package/dist/tools/multi-items/item-container-map.d.ts.map +1 -0
  333. package/dist/tools/multi-items/item-container-map.js +73 -0
  334. package/dist/tools/multi-items/item-container-map.js.map +1 -0
  335. package/dist/tools/pages/builders.d.ts +43 -0
  336. package/dist/tools/pages/builders.d.ts.map +1 -0
  337. package/dist/tools/pages/builders.js +229 -0
  338. package/dist/tools/pages/builders.js.map +1 -0
  339. package/dist/tools/pages/handlers-read.d.ts +33 -0
  340. package/dist/tools/pages/handlers-read.d.ts.map +1 -0
  341. package/dist/tools/pages/handlers-read.js +260 -0
  342. package/dist/tools/pages/handlers-read.js.map +1 -0
  343. package/dist/tools/pages/handlers-write.d.ts +63 -0
  344. package/dist/tools/pages/handlers-write.d.ts.map +1 -0
  345. package/dist/tools/pages/handlers-write.js +127 -0
  346. package/dist/tools/pages/handlers-write.js.map +1 -0
  347. package/dist/tools/pages/index.d.ts +17 -0
  348. package/dist/tools/pages/index.d.ts.map +1 -0
  349. package/dist/tools/pages/index.js +17 -0
  350. package/dist/tools/pages/index.js.map +1 -0
  351. package/dist/tools/pages/schemas.d.ts +157 -0
  352. package/dist/tools/pages/schemas.d.ts.map +1 -0
  353. package/dist/tools/pages/schemas.js +232 -0
  354. package/dist/tools/pages/schemas.js.map +1 -0
  355. package/dist/tools/pages.d.ts +13 -0
  356. package/dist/tools/pages.d.ts.map +1 -0
  357. package/dist/tools/pages.js +13 -0
  358. package/dist/tools/pages.js.map +1 -0
  359. package/dist/tools/pool-resolve-helper.d.ts +83 -0
  360. package/dist/tools/pool-resolve-helper.d.ts.map +1 -0
  361. package/dist/tools/pool-resolve-helper.js +148 -0
  362. package/dist/tools/pool-resolve-helper.js.map +1 -0
  363. package/dist/tools/progress-phases.d.ts +46 -0
  364. package/dist/tools/progress-phases.d.ts.map +1 -0
  365. package/dist/tools/progress-phases.js +48 -0
  366. package/dist/tools/progress-phases.js.map +1 -0
  367. package/dist/tools/shared-schemas.d.ts +25 -0
  368. package/dist/tools/shared-schemas.d.ts.map +1 -0
  369. package/dist/tools/shared-schemas.js +72 -0
  370. package/dist/tools/shared-schemas.js.map +1 -0
  371. package/dist/tools/sources/builders.d.ts +13 -0
  372. package/dist/tools/sources/builders.d.ts.map +1 -0
  373. package/dist/tools/sources/builders.js +118 -0
  374. package/dist/tools/sources/builders.js.map +1 -0
  375. package/dist/tools/sources/handlers-bind.d.ts +28 -0
  376. package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
  377. package/dist/tools/sources/handlers-bind.js +181 -0
  378. package/dist/tools/sources/handlers-bind.js.map +1 -0
  379. package/dist/tools/sources/handlers.d.ts +47 -0
  380. package/dist/tools/sources/handlers.d.ts.map +1 -0
  381. package/dist/tools/sources/handlers.js +108 -0
  382. package/dist/tools/sources/handlers.js.map +1 -0
  383. package/dist/tools/sources/index.d.ts +19 -0
  384. package/dist/tools/sources/index.d.ts.map +1 -0
  385. package/dist/tools/sources/index.js +18 -0
  386. package/dist/tools/sources/index.js.map +1 -0
  387. package/dist/tools/sources.d.ts +14 -0
  388. package/dist/tools/sources.d.ts.map +1 -0
  389. package/dist/tools/sources.js +14 -0
  390. package/dist/tools/sources.js.map +1 -0
  391. package/dist/tools/sparse-fields.d.ts +106 -0
  392. package/dist/tools/sparse-fields.d.ts.map +1 -0
  393. package/dist/tools/sparse-fields.js +165 -0
  394. package/dist/tools/sparse-fields.js.map +1 -0
  395. package/dist/tools/tool-builder/annotations.d.ts +55 -0
  396. package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
  397. package/dist/tools/tool-builder/annotations.js +86 -0
  398. package/dist/tools/tool-builder/annotations.js.map +1 -0
  399. package/dist/tools/tool-builder/define.d.ts +31 -0
  400. package/dist/tools/tool-builder/define.d.ts.map +1 -0
  401. package/dist/tools/tool-builder/define.js +31 -0
  402. package/dist/tools/tool-builder/define.js.map +1 -0
  403. package/dist/tools/tool-builder/index.d.ts +28 -0
  404. package/dist/tools/tool-builder/index.d.ts.map +1 -0
  405. package/dist/tools/tool-builder/index.js +27 -0
  406. package/dist/tools/tool-builder/index.js.map +1 -0
  407. package/dist/tools/tool-builder/results.d.ts +104 -0
  408. package/dist/tools/tool-builder/results.d.ts.map +1 -0
  409. package/dist/tools/tool-builder/results.js +224 -0
  410. package/dist/tools/tool-builder/results.js.map +1 -0
  411. package/dist/tools/tool-builder/types.d.ts +97 -0
  412. package/dist/tools/tool-builder/types.d.ts.map +1 -0
  413. package/dist/tools/tool-builder/types.js +9 -0
  414. package/dist/tools/tool-builder/types.js.map +1 -0
  415. package/dist/tools/tool-builder.d.ts +16 -0
  416. package/dist/tools/tool-builder.d.ts.map +1 -0
  417. package/dist/tools/tool-builder.js +16 -0
  418. package/dist/tools/tool-builder.js.map +1 -0
  419. package/dist/uninstall-skill.d.ts +52 -0
  420. package/dist/uninstall-skill.d.ts.map +1 -0
  421. package/dist/uninstall-skill.js +146 -0
  422. package/dist/uninstall-skill.js.map +1 -0
  423. package/dist/uninstall.d.ts +73 -0
  424. package/dist/uninstall.d.ts.map +1 -0
  425. package/dist/uninstall.js +82 -0
  426. package/dist/uninstall.js.map +1 -0
  427. package/icon.png +0 -0
  428. package/manifest.json +10 -10
  429. package/package.json +4 -1
  430. package/skills/yt-builder-mcp/SKILL.md +30 -26
@@ -0,0 +1,292 @@
1
+ /**
2
+ * Element-tool read handlers + shared types/schemas.
3
+ *
4
+ * Split out of the original `src/tools/elements.ts` (Wave G.4.0). Write
5
+ * handlers (add/update/move/clone/delete) live in `./handlers-write.ts`
6
+ * to keep each file under the 200-LoC budget.
7
+ *
8
+ * Handler responsibilities:
9
+ * - call the REST endpoint via `deps.client`,
10
+ * - map REST data to the toolkit output builders (`tableResult`,
11
+ * `detailResult`),
12
+ * - wrap in `structuredResult` to carry the typed
13
+ * `structuredContent` payload,
14
+ * - on error, return `errorResult` with `context` + `hint`.
15
+ *
16
+ * @license MIT
17
+ */
18
+ import { detailResult, tableResult } from '@getimo/mcp-toolkit';
19
+ import { z } from 'zod';
20
+ import { encodeElementPath, encodeTemplateId } from '../../client.js';
21
+ import { RestError } from '../../errors.js';
22
+ import { ELEMENTS_COMPACT_COLUMNS, ELEMENTS_TABLE_COLUMNS, buildElementDetail, mapElementRow, } from '../format/elements-format.js';
23
+ import { DEFAULT_FIELDS_ELEMENT_LIST, projectFields, projectionFeedback, projectedFieldsEcho, } from '../sparse-fields.js';
24
+ import { errorResult, structuredResult, } from '../tool-builder.js';
25
+ // ─── outputSchemas (Wave G.2 §4) ─────────────────────────────────────
26
+ export const ELEMENT_LIST_OUTPUT_SCHEMA = z.object({
27
+ // 1.0.1 Wave-1.5 — Cold agents need to see the row shape so they know
28
+ // they can copy `rel_path`/`path`/`element_type`/`parent_path` straight
29
+ // back into the next call. All fields are optional + the row is
30
+ // `passthrough()` so projected/narrow `fields[]` calls still validate.
31
+ items: z.array(z
32
+ .object({
33
+ path: z
34
+ .string()
35
+ .optional()
36
+ .describe('Fully-qualified JSON-Pointer ' +
37
+ '(`/templates/<id>/layout/children/...`).'),
38
+ rel_path: z
39
+ .string()
40
+ .optional()
41
+ .describe('Path relative to layout root (`/children/0/...`). ' +
42
+ 'Pass either form back as `element_path`.'),
43
+ element_type: z
44
+ .string()
45
+ .optional()
46
+ .describe("Element type (e.g. `headline`, `section`, `grid`). " +
47
+ "Feeds `element_add.element_type` directly."),
48
+ parent_path: z
49
+ .string()
50
+ .optional()
51
+ .describe("Path of this element's parent. Feeds `element_add.parent_path` / " +
52
+ "`element_move.to_parent_path` directly (rel_path form preferred)."),
53
+ label: z
54
+ .string()
55
+ .optional()
56
+ .describe('Human-readable name of the element (alias of `name`).'),
57
+ has_binding: z
58
+ .boolean()
59
+ .optional()
60
+ .describe('True when this element is dynamically bound to a data ' +
61
+ 'source. Use `element_get_binding` for the full mapping.'),
62
+ })
63
+ .passthrough()),
64
+ total: z.number(),
65
+ template_id: z.string(),
66
+ // N-01: present only when the call was paginated and more rows remain.
67
+ next_cursor: z.string().optional(),
68
+ projected_fields: z.array(z.string()).optional(),
69
+ // F-005 fix (2026-05-25 exhaustive audit): projection-feedback so
70
+ // callers passing the wrong field name (e.g. `type` instead of
71
+ // `element_type`) get an explicit hint instead of silently-empty
72
+ // table columns. See sparse-fields.ts::projectionFeedback.
73
+ available_fields: z.array(z.string()).optional(),
74
+ unknown_fields: z.array(z.string()).optional(),
75
+ });
76
+ export const ELEMENT_GET_OUTPUT_SCHEMA = z.object({
77
+ template_id: z.string(),
78
+ element_path: z.string(),
79
+ element_type: z.string(),
80
+ label: z.string().optional(),
81
+ props: z.record(z.string(), z.unknown()).optional(),
82
+ children_count: z.number(),
83
+ });
84
+ // ─── element_list ────────────────────────────────────────────────────
85
+ /**
86
+ * N-01 (Audit v4): build slim text-table columns from a caller-supplied
87
+ * `fields[]` projection. The default compact text table truncates at
88
+ * 2000 chars (~26 of 96 nodes); projecting to a couple of narrow
89
+ * columns lets the FULL node list fit in the 8000-char `full` budget.
90
+ *
91
+ * Width heuristic: paths get a wide column, everything else a modest
92
+ * one. Labels are uppercased for the header to match the toolkit style.
93
+ */
94
+ function columnsFromFields(fields) {
95
+ return fields.map((key) => {
96
+ const isPath = key === 'path' || key === 'rel_path' || key === 'parent_path';
97
+ return {
98
+ key,
99
+ label: key.replace(/_/g, ' ').toUpperCase(),
100
+ width: isPath ? 48 : 16,
101
+ };
102
+ });
103
+ }
104
+ /**
105
+ * F-205 (Audit 2026-05-26): shape-validate a cursor token up-front.
106
+ *
107
+ * The server-side cursor format (see `ElementOps::encodeCursor`) is
108
+ * base64url-encoded `o:<digits>`. Accept ALSO the raw `o:<digits>`
109
+ * form so hand-crafted iteration scripts + tests don't break. Anything
110
+ * else is a typo / corrupted token and must be rejected with a
111
+ * structured 400 — silently returning page 1 (the pre-fix behaviour)
112
+ * makes cold-agents loop on invalid cursors.
113
+ *
114
+ * We deliberately do NOT validate the cursor against the actual page
115
+ * state (no decode + range-check) — only shape.
116
+ */
117
+ function isValidCursorShape(cursor) {
118
+ if (cursor.length === 0)
119
+ return false;
120
+ // Form A: raw `o:<digits>`.
121
+ if (/^o:\d+$/.test(cursor))
122
+ return true;
123
+ // Form B: base64url (charset only). Must decode to `o:<digits>`.
124
+ if (!/^[A-Za-z0-9_-]+$/.test(cursor))
125
+ return false;
126
+ try {
127
+ const padded = cursor.replace(/-/g, '+').replace(/_/g, '/');
128
+ const padLen = (4 - (padded.length % 4)) % 4;
129
+ const decoded = Buffer.from(padded + '='.repeat(padLen), 'base64').toString('utf8');
130
+ return /^o:\d+$/.test(decoded);
131
+ }
132
+ catch {
133
+ return false;
134
+ }
135
+ }
136
+ export async function handleElementList({ client }, { template_id, fields, root_path, depth, limit, cursor, }) {
137
+ // F-205 (Audit 2026-05-26): validate cursor shape BEFORE the REST
138
+ // call so an invalid token surfaces a structured 400 instead of
139
+ // silently returning page 1.
140
+ if (typeof cursor === 'string' && cursor !== '' && !isValidCursorShape(cursor)) {
141
+ return errorResult({
142
+ error: new RestError({
143
+ status: 400,
144
+ code: 'yootheme_builder_mcp.elements.invalid_cursor',
145
+ message: `Invalid cursor "${cursor}" — expected an opaque token from a prior call's next_cursor.`,
146
+ body: null,
147
+ }),
148
+ context: { cursor, template_id },
149
+ hint: 'Omit `cursor` for page 1, or copy the `next_cursor` field ' +
150
+ "from a prior `element_list` call's response.",
151
+ });
152
+ }
153
+ try {
154
+ // N-01 (Audit-v3): forward the transport-safe scoping params as
155
+ // query string. The REST layer returns the pagination envelope
156
+ // `{items, next_cursor, total}` when `limit` is set, else the flat
157
+ // `{elements, total}` shape — handle both.
158
+ const qs = new URLSearchParams();
159
+ if (typeof root_path === 'string' && root_path !== '') {
160
+ qs.set('root_path', root_path);
161
+ }
162
+ if (typeof depth === 'number')
163
+ qs.set('depth', String(depth));
164
+ if (typeof limit === 'number')
165
+ qs.set('limit', String(limit));
166
+ if (typeof cursor === 'string' && cursor !== '')
167
+ qs.set('cursor', cursor);
168
+ const query = qs.toString();
169
+ const data = await client.get(`/pages/${encodeTemplateId(template_id)}/elements${query !== '' ? `?${query}` : ''}`);
170
+ // Paginated envelope uses `items`; flat shape uses `elements`.
171
+ const rawSource = Array.isArray(data.items)
172
+ ? data.items
173
+ : Array.isArray(data.elements)
174
+ ? data.elements
175
+ : [];
176
+ // F-206 (Audit 2026-05-26): distinguish "explicit root_path
177
+ // pointer not found" from "template is truly empty". Without
178
+ // this branch, `element_list({root_path: '/does/not/exist'})`
179
+ // returned `0 elements` silently — cold agents had no signal
180
+ // whether the pointer was a typo or the subtree empty. Only
181
+ // raise when (a) the caller PASSED a non-empty root_path AND
182
+ // (b) the REST returned 0 rows. Omitted root_path on a truly
183
+ // empty template stays a success.
184
+ if (typeof root_path === 'string' &&
185
+ root_path !== '' &&
186
+ rawSource.length === 0) {
187
+ return errorResult({
188
+ error: new RestError({
189
+ status: 404,
190
+ code: 'yootheme_builder_mcp.elements.unknown_root_path',
191
+ message: `root_path "${root_path}" not found in template "${template_id}".`,
192
+ body: null,
193
+ }),
194
+ context: { root_path, template_id },
195
+ hint: 'Verify via yootheme_builder_element_list (omit root_path) ' +
196
+ 'to discover existing JSON-Pointers in the template.',
197
+ });
198
+ }
199
+ const mapped = rawSource
200
+ .filter((x) => x !== null && typeof x === 'object')
201
+ .map(mapElementRow);
202
+ const items = projectFields(mapped, fields, DEFAULT_FIELDS_ELEMENT_LIST);
203
+ const echo = projectedFieldsEcho(fields, DEFAULT_FIELDS_ELEMENT_LIST);
204
+ const feedback = projectionFeedback(mapped, fields);
205
+ const unknownNote = feedback !== undefined && feedback.unknown_fields.length > 0
206
+ ? ` (unknown fields ignored: ${feedback.unknown_fields.join(', ')}; available: ${feedback.available_fields.join(', ')})`
207
+ : '';
208
+ // N-01 (Audit v4): when the caller passes an explicit narrow
209
+ // `fields[]`, render the text table from the projected (slim)
210
+ // rows with `full` detail (8000 chars) so the WHOLE node list
211
+ // survives — the default compact table caps at 2000 chars and
212
+ // hides ~70 of a 96-node template. Without `fields[]` keep the
213
+ // auto-scaling behaviour (full columns, count-driven level).
214
+ const hasNarrowProjection = Array.isArray(fields) && fields.length > 0;
215
+ const toolkitResult = hasNarrowProjection
216
+ ? tableResult(items, {
217
+ columns: columnsFromFields(fields),
218
+ header: (count) => `${String(count)} elements in template "${template_id}"${unknownNote}`,
219
+ footer: 'Use yootheme_builder_element_get <path> for full data.',
220
+ }, 'full')
221
+ : tableResult(mapped, {
222
+ columns: [...ELEMENTS_TABLE_COLUMNS],
223
+ compactColumns: [...ELEMENTS_COMPACT_COLUMNS],
224
+ header: (count) => `${String(count)} elements in template "${template_id}"${unknownNote}`,
225
+ footer: 'Use yootheme_builder_element_get <path> for full data.',
226
+ });
227
+ return structuredResult(toolkitResult, {
228
+ items,
229
+ total: typeof data.total === 'number' ? data.total : items.length,
230
+ template_id,
231
+ ...(typeof data.next_cursor === 'string' && data.next_cursor !== ''
232
+ ? { next_cursor: data.next_cursor }
233
+ : {}),
234
+ ...(echo !== undefined ? { projected_fields: [...echo] } : {}),
235
+ ...(feedback !== undefined ? {
236
+ available_fields: [...feedback.available_fields],
237
+ unknown_fields: [...feedback.unknown_fields],
238
+ } : {}),
239
+ });
240
+ }
241
+ catch (e) {
242
+ return errorResult({
243
+ error: e,
244
+ context: { template_id },
245
+ hint: 'Verify the template_id via yootheme_builder_pages_list.',
246
+ });
247
+ }
248
+ }
249
+ // ─── element_get ─────────────────────────────────────────────────────
250
+ export async function handleElementGet({ client }, { template_id, element_path }) {
251
+ const encoded = encodeElementPath(element_path);
252
+ try {
253
+ const data = await client.get(`/pages/${encodeTemplateId(template_id)}/elements/${encoded}`);
254
+ const elementType = typeof data.element_type === 'string'
255
+ ? data.element_type
256
+ : typeof data.type === 'string'
257
+ ? data.type
258
+ : '';
259
+ const label = typeof data.label === 'string' ? data.label : undefined;
260
+ const propsRaw = data.props;
261
+ const props = propsRaw !== null && typeof propsRaw === 'object'
262
+ ? propsRaw
263
+ : undefined;
264
+ const children = Array.isArray(data.children) ? data.children : [];
265
+ const toolkitResult = detailResult(buildElementDetail({
266
+ path: element_path,
267
+ element_type: elementType,
268
+ label,
269
+ props,
270
+ children: children,
271
+ }));
272
+ return structuredResult(toolkitResult, {
273
+ template_id,
274
+ element_path,
275
+ element_type: elementType,
276
+ ...(label !== undefined ? { label } : {}),
277
+ ...(props !== undefined ? { props } : {}),
278
+ children_count: children.length,
279
+ });
280
+ }
281
+ catch (e) {
282
+ return errorResult({
283
+ error: e,
284
+ context: { template_id, element_path },
285
+ hint: 'Paths are JSON-Pointer style ("/0/children/1"). Use ' +
286
+ 'yootheme_builder_element_list to enumerate valid paths.',
287
+ });
288
+ }
289
+ }
290
+ // Re-export write handlers so callers can import from this barrel.
291
+ export { handleElementAdd, handleElementClone, handleElementDelete, handleElementMove, handleElementUpdateSettings, } from './handlers-write.js';
292
+ //# sourceMappingURL=handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../src/tools/elements/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,E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;IACP,CAAC;AACL,CAAC;AAED,mEAAmE;AACnE,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,GAC9B,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Element-tool barrel — public entry-point for the 7 element tools.
3
+ *
4
+ * yootheme_builder_element_list
5
+ * → list all elements in a template (flat, with paths)
6
+ * yootheme_builder_element_get
7
+ * → fetch one element by JSON-Pointer
8
+ * yootheme_builder_element_add
9
+ * → POST new element
10
+ * yootheme_builder_element_update_settings
11
+ * → PUT props on an existing element
12
+ * yootheme_builder_element_move
13
+ * → relocate within tree
14
+ * yootheme_builder_element_clone
15
+ * → duplicate as sibling
16
+ * yootheme_builder_element_delete (destructive — elicit/confirm)
17
+ *
18
+ * Wave G.4.0 — file split from the monolithic `src/tools/elements.ts`
19
+ * (382 LoC) into `index.ts` (this file, re-exports), `builders.ts`
20
+ * (defineTool factory list, ≤200 LoC), and `handlers.ts` (handler
21
+ * bodies, ≤300 LoC). Tool surface is unchanged — see
22
+ * `tests/tools/elements-split.test.ts` for the snapshot proof.
23
+ *
24
+ * @license MIT
25
+ */
26
+ export { buildElementsTools } from './builders.js';
27
+ export type { ElementsHandlerDeps } from './handlers.js';
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Element-tool barrel — public entry-point for the 7 element tools.
3
+ *
4
+ * yootheme_builder_element_list
5
+ * → list all elements in a template (flat, with paths)
6
+ * yootheme_builder_element_get
7
+ * → fetch one element by JSON-Pointer
8
+ * yootheme_builder_element_add
9
+ * → POST new element
10
+ * yootheme_builder_element_update_settings
11
+ * → PUT props on an existing element
12
+ * yootheme_builder_element_move
13
+ * → relocate within tree
14
+ * yootheme_builder_element_clone
15
+ * → duplicate as sibling
16
+ * yootheme_builder_element_delete (destructive — elicit/confirm)
17
+ *
18
+ * Wave G.4.0 — file split from the monolithic `src/tools/elements.ts`
19
+ * (382 LoC) into `index.ts` (this file, re-exports), `builders.ts`
20
+ * (defineTool factory list, ≤200 LoC), and `handlers.ts` (handler
21
+ * bodies, ≤300 LoC). Tool surface is unchanged — see
22
+ * `tests/tools/elements-split.test.ts` for the snapshot proof.
23
+ *
24
+ * @license MIT
25
+ */
26
+ export { buildElementsTools } from './builders.js';
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Backwards-compatible re-export shim.
3
+ *
4
+ * Wave G.4.0 split the original 382-LoC `elements.ts` into
5
+ * `./elements/{index, handlers, builders}.ts`. This shim keeps the
6
+ * legacy import path (`from '../tools/elements.js'`) working for
7
+ * downstream callers and tests. New code should import from
8
+ * `./elements/index.js` directly.
9
+ *
10
+ * @license MIT
11
+ */
12
+ export { buildElementsTools } from './elements/index.js';
13
+ //# sourceMappingURL=elements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/tools/elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Backwards-compatible re-export shim.
3
+ *
4
+ * Wave G.4.0 split the original 382-LoC `elements.ts` into
5
+ * `./elements/{index, handlers, builders}.ts`. This shim keeps the
6
+ * legacy import path (`from '../tools/elements.js'`) working for
7
+ * downstream callers and tests. New code should import from
8
+ * `./elements/index.js` directly.
9
+ *
10
+ * @license MIT
11
+ */
12
+ export { buildElementsTools } from './elements/index.js';
13
+ //# sourceMappingURL=elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/tools/elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Targeted-elicitation support (Wave G.4 — Design §3.4 / §4.18).
3
+ *
4
+ * Three tool sites use elicitation:
5
+ * - element_delete (destructive confirm)
6
+ * - element_unbind_source (destructive confirm)
7
+ * - element_bind_source (ambiguity resolution: ≥2 sources with the
8
+ * same `source_name` → ask the user which one)
9
+ *
10
+ * Architecture mirrors `~/Projekte/wootsup/packages/apimapper-mcp/src/
11
+ * modules/apimapper/elicitation.ts` (the reference Goldstandard impl):
12
+ *
13
+ * 1. `toElicitationCapability(server)` — typed adapter that bridges the
14
+ * SDK's stricter discriminated `ElicitRequestFormParams` to the
15
+ * toolkit's looser `ElicitInputParams`. ONE documented cast, justified
16
+ * by the toolkit only ever emitting form-mode requests.
17
+ * 2. `ElicitationCandidate` + `renderCandidateList` — a candidate is
18
+ * `{ id, label }`; the list renders as a readable bullet block for the
19
+ * mandatory non-elicitation fallback error.
20
+ * 3. `ambiguityFallbackError` — the structured `errorResult` returned
21
+ * when elicitation is unavailable (unsupported client) or declined.
22
+ * Lists every candidate so the LLM (or operator) has an actionable
23
+ * recovery path: "retry with explicit param X set to one of …".
24
+ *
25
+ * MANDATORY non-elicitation fallback: `elicitChoice` returns `null` on a
26
+ * client without elicitation support, on decline, and on cancel. Every
27
+ * call site MUST then return a structured `errorResult` listing the
28
+ * candidates with a recovery hint — never hang, never guess, never
29
+ * silently pick.
30
+ *
31
+ * @license MIT
32
+ */
33
+ import type { McpServerWithElicitation } from '@getimo/mcp-toolkit';
34
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
35
+ import { type ToolResult } from './tool-builder.js';
36
+ export type { McpServerWithElicitation };
37
+ /**
38
+ * Build the `McpServerWithElicitation` capability object the toolkit's
39
+ * `elicitChoice` / `elicitConfirmation` consume, from the real `McpServer`.
40
+ *
41
+ * Why an adapter and not the bare `McpServer`:
42
+ * The toolkit's `McpServerWithElicitation.server.elicitInput` is typed
43
+ * with the loose `ElicitInputParams` (`mode: "form" | "url"`,
44
+ * `requestedSchema?: Record<string, unknown>`). The SDK's
45
+ * `Server.elicitInput` is the stricter discriminated
46
+ * `ElicitRequestFormParams | ElicitRequestURLParams` with a fully-typed
47
+ * `requestedSchema`. A real `McpServer` is therefore NOT structurally
48
+ * assignable to `McpServerWithElicitation` — the parameter types are
49
+ * contravariantly incompatible.
50
+ *
51
+ * The toolkit's `elicitChoice` / `elicitConfirmation` ALWAYS call with
52
+ * `mode: "form"` and a `requestedSchema` whose properties are plain
53
+ * `{ type: "string", enum: [...] }` / `{ type: "boolean" }` shapes —
54
+ * i.e. always a valid `ElicitRequestFormParams` at runtime. This adapter
55
+ * is the single, documented interop boundary that re-narrows the loose
56
+ * toolkit params to the SDK's form-params type.
57
+ */
58
+ export declare function toElicitationCapability(realServer: McpServer): McpServerWithElicitation;
59
+ /**
60
+ * A disambiguation candidate. `id` is the value a tool needs (source ID,
61
+ * credential ID, …); `label` is a human-readable name shown in the
62
+ * elicitation prompt and the fallback error list.
63
+ */
64
+ export interface ElicitationCandidate {
65
+ readonly id: string;
66
+ readonly label: string;
67
+ }
68
+ /**
69
+ * Render a candidate list as a readable bullet block for the structured
70
+ * fallback error — so a client without elicitation support still gets a
71
+ * fully actionable recovery path.
72
+ */
73
+ export declare function renderCandidateList(candidates: readonly ElicitationCandidate[]): string;
74
+ /**
75
+ * Build the structured `errorResult` returned when elicitation is
76
+ * unavailable (unsupported client) or the user declined / cancelled. The
77
+ * error names every candidate and tells the caller exactly which
78
+ * parameter to supply on retry.
79
+ */
80
+ export declare function ambiguityFallbackError(opts: {
81
+ code: string;
82
+ paramName: string;
83
+ what: string;
84
+ candidates: readonly ElicitationCandidate[];
85
+ context: Record<string, unknown>;
86
+ }): ToolResult;
87
+ //# sourceMappingURL=elicitation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../../src/tools/elicitation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAER,wBAAwB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEjE,YAAY,EAAE,wBAAwB,EAAE,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CACnC,UAAU,EAAE,SAAS,GACtB,wBAAwB,CAe1B;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,SAAS,oBAAoB,EAAE,GAAG,MAAM,CAEvF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,UAAU,CAeb"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Targeted-elicitation support (Wave G.4 — Design §3.4 / §4.18).
3
+ *
4
+ * Three tool sites use elicitation:
5
+ * - element_delete (destructive confirm)
6
+ * - element_unbind_source (destructive confirm)
7
+ * - element_bind_source (ambiguity resolution: ≥2 sources with the
8
+ * same `source_name` → ask the user which one)
9
+ *
10
+ * Architecture mirrors `~/Projekte/wootsup/packages/apimapper-mcp/src/
11
+ * modules/apimapper/elicitation.ts` (the reference Goldstandard impl):
12
+ *
13
+ * 1. `toElicitationCapability(server)` — typed adapter that bridges the
14
+ * SDK's stricter discriminated `ElicitRequestFormParams` to the
15
+ * toolkit's looser `ElicitInputParams`. ONE documented cast, justified
16
+ * by the toolkit only ever emitting form-mode requests.
17
+ * 2. `ElicitationCandidate` + `renderCandidateList` — a candidate is
18
+ * `{ id, label }`; the list renders as a readable bullet block for the
19
+ * mandatory non-elicitation fallback error.
20
+ * 3. `ambiguityFallbackError` — the structured `errorResult` returned
21
+ * when elicitation is unavailable (unsupported client) or declined.
22
+ * Lists every candidate so the LLM (or operator) has an actionable
23
+ * recovery path: "retry with explicit param X set to one of …".
24
+ *
25
+ * MANDATORY non-elicitation fallback: `elicitChoice` returns `null` on a
26
+ * client without elicitation support, on decline, and on cancel. Every
27
+ * call site MUST then return a structured `errorResult` listing the
28
+ * candidates with a recovery hint — never hang, never guess, never
29
+ * silently pick.
30
+ *
31
+ * @license MIT
32
+ */
33
+ import { errorResult } from './tool-builder.js';
34
+ /**
35
+ * Build the `McpServerWithElicitation` capability object the toolkit's
36
+ * `elicitChoice` / `elicitConfirmation` consume, from the real `McpServer`.
37
+ *
38
+ * Why an adapter and not the bare `McpServer`:
39
+ * The toolkit's `McpServerWithElicitation.server.elicitInput` is typed
40
+ * with the loose `ElicitInputParams` (`mode: "form" | "url"`,
41
+ * `requestedSchema?: Record<string, unknown>`). The SDK's
42
+ * `Server.elicitInput` is the stricter discriminated
43
+ * `ElicitRequestFormParams | ElicitRequestURLParams` with a fully-typed
44
+ * `requestedSchema`. A real `McpServer` is therefore NOT structurally
45
+ * assignable to `McpServerWithElicitation` — the parameter types are
46
+ * contravariantly incompatible.
47
+ *
48
+ * The toolkit's `elicitChoice` / `elicitConfirmation` ALWAYS call with
49
+ * `mode: "form"` and a `requestedSchema` whose properties are plain
50
+ * `{ type: "string", enum: [...] }` / `{ type: "boolean" }` shapes —
51
+ * i.e. always a valid `ElicitRequestFormParams` at runtime. This adapter
52
+ * is the single, documented interop boundary that re-narrows the loose
53
+ * toolkit params to the SDK's form-params type.
54
+ */
55
+ export function toElicitationCapability(realServer) {
56
+ return {
57
+ server: {
58
+ elicitInput: (params) =>
59
+ // Cast: the toolkit only ever produces form-mode elicitation
60
+ // requests (verified: elicitChoice + elicitConfirmation both pass
61
+ // `mode: "form"` with a string/boolean `requestedSchema`). The
62
+ // loose `ElicitInputParams` is asserted to the SDK's
63
+ // `ElicitRequestFormParams` so the SDK's overloaded
64
+ // `elicitInput` accepts it. The runtime payload is exactly a
65
+ // valid form request — only the static type is widened on the
66
+ // toolkit side.
67
+ realServer.server.elicitInput(params),
68
+ },
69
+ };
70
+ }
71
+ /**
72
+ * Render a candidate list as a readable bullet block for the structured
73
+ * fallback error — so a client without elicitation support still gets a
74
+ * fully actionable recovery path.
75
+ */
76
+ export function renderCandidateList(candidates) {
77
+ return candidates.map((c) => ` • ${c.id} — ${c.label}`).join('\n');
78
+ }
79
+ /**
80
+ * Build the structured `errorResult` returned when elicitation is
81
+ * unavailable (unsupported client) or the user declined / cancelled. The
82
+ * error names every candidate and tells the caller exactly which
83
+ * parameter to supply on retry.
84
+ */
85
+ export function ambiguityFallbackError(opts) {
86
+ const list = renderCandidateList(opts.candidates);
87
+ return errorResult({
88
+ // We piggy-back on the local errorResult shape: `error` is the
89
+ // human-readable message, `context` echoes inputs + candidate ids,
90
+ // `hint` is the recovery instruction with the full candidate list.
91
+ error: new Error(`Multiple ${opts.what} match — cannot pick automatically.`),
92
+ context: {
93
+ ...opts.context,
94
+ code: opts.code,
95
+ candidates: opts.candidates.map((c) => ({ id: c.id, label: c.label })),
96
+ },
97
+ hint: `Retry with an explicit \`${opts.paramName}\` set to one of:\n${list}`,
98
+ });
99
+ }
100
+ //# sourceMappingURL=elicitation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elicitation.js","sourceRoot":"","sources":["../../src/tools/elicitation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AASH,OAAO,EAAE,WAAW,EAAmB,MAAM,mBAAmB,CAAC;AAIjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,uBAAuB,CACnC,UAAqB;IAErB,OAAO;QACH,MAAM,EAAE;YACJ,WAAW,EAAE,CAAC,MAAyB,EAAE,EAAE;YACvC,6DAA6D;YAC7D,kEAAkE;YAClE,+DAA+D;YAC/D,qDAAqD;YACrD,oDAAoD;YACpD,6DAA6D;YAC7D,8DAA8D;YAC9D,gBAAgB;YAChB,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,MAAiC,CAAC;SACvE;KACJ,CAAC;AACN,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAA2C;IAC3E,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAMtC;IACG,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClD,OAAO,WAAW,CAAC;QACf,+DAA+D;QAC/D,mEAAmE;QACnE,mEAAmE;QACnE,KAAK,EAAE,IAAI,KAAK,CAAC,YAAY,IAAI,CAAC,IAAI,qCAAqC,CAAC;QAC5E,OAAO,EAAE;YACL,GAAG,IAAI,CAAC,OAAO;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;SACzE;QACD,IAAI,EACA,4BAA4B,IAAI,CAAC,SAAS,sBAAsB,IAAI,EAAE;KAC7E,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Elements format-sidecar — pure transforms for `element_list` (table) and
3
+ * `element_get` (detail). Wave G.2.5 (Design §3.2 rows 9 / 10).
4
+ *
5
+ * @license MIT
6
+ */
7
+ import type { DetailGroup, TableColumn } from '@getimo/mcp-toolkit';
8
+ export declare const ELEMENTS_TABLE_COLUMNS: readonly TableColumn[];
9
+ /** Compact columns kick in at 21+ rows — keep path + type only. */
10
+ export declare const ELEMENTS_COMPACT_COLUMNS: readonly TableColumn[];
11
+ /**
12
+ * True iff the node carries a source-binding. Exported so the
13
+ * layout-flatten helper (page_get_layout flat-mode) derives
14
+ * `has_binding` from the SAME logic element_list uses — one SSoT.
15
+ */
16
+ export declare function hasSourceBinding(node: unknown): boolean;
17
+ /**
18
+ * Maps an `/elements` row to the table shape.
19
+ *
20
+ * - `label` falls back to `title` (REST surface varies — newer builds emit
21
+ * `label`, older emit `title` as the human-readable name).
22
+ * - `has_binding` honours an explicit boolean from the REST plugin, else
23
+ * derives from `props.source` presence.
24
+ */
25
+ export declare function mapElementRow(input: Record<string, unknown>): Record<string, unknown>;
26
+ interface ElementChildLike {
27
+ type?: unknown;
28
+ }
29
+ export declare function buildElementDetail(payload: {
30
+ path: string;
31
+ element_type: string;
32
+ props?: unknown;
33
+ children?: ElementChildLike[];
34
+ label?: string;
35
+ }): {
36
+ groups: DetailGroup[];
37
+ title?: string;
38
+ };
39
+ export {};
40
+ //# sourceMappingURL=elements-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elements-format.d.ts","sourceRoot":"","sources":["../../../src/tools/format/elements-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOpE,eAAO,MAAM,sBAAsB,EAAE,SAAS,WAAW,EAKxD,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,wBAAwB,EAAE,SAAS,WAAW,EAG1D,CAAC;AA+CF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CA+BvD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqBrF;AAID,UAAU,gBAAgB;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAoBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG;IAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA4C5C"}