@ffschrattenecker/tm1-mcp-server 6.0.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 (475) hide show
  1. package/CHANGELOG.md +1211 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +34 -0
  4. package/README.md +276 -0
  5. package/dist/config.d.ts +35 -0
  6. package/dist/config.js +238 -0
  7. package/dist/http-transport.d.ts +8 -0
  8. package/dist/http-transport.js +132 -0
  9. package/dist/index.d.ts +18 -0
  10. package/dist/index.js +164 -0
  11. package/dist/lib/callgraph/callGraph.d.ts +124 -0
  12. package/dist/lib/callgraph/callGraph.js +334 -0
  13. package/dist/lib/callgraph/choreGraph.d.ts +23 -0
  14. package/dist/lib/callgraph/choreGraph.js +102 -0
  15. package/dist/lib/callgraph/dataFlow.d.ts +74 -0
  16. package/dist/lib/callgraph/dataFlow.js +271 -0
  17. package/dist/lib/callgraph/datasourceMembership.d.ts +31 -0
  18. package/dist/lib/callgraph/datasourceMembership.js +142 -0
  19. package/dist/lib/callgraph/lintTypes.d.ts +28 -0
  20. package/dist/lib/callgraph/lintTypes.js +2 -0
  21. package/dist/lib/callgraph/mdxMembers.d.ts +29 -0
  22. package/dist/lib/callgraph/mdxMembers.js +97 -0
  23. package/dist/lib/callgraph/referenceIndex.d.ts +179 -0
  24. package/dist/lib/callgraph/referenceIndex.js +584 -0
  25. package/dist/lib/callgraph/rulesLinter.d.ts +55 -0
  26. package/dist/lib/callgraph/rulesLinter.js +776 -0
  27. package/dist/lib/callgraph/rulesParser.d.ts +26 -0
  28. package/dist/lib/callgraph/rulesParser.js +71 -0
  29. package/dist/lib/callgraph/subsetUsage.d.ts +16 -0
  30. package/dist/lib/callgraph/subsetUsage.js +134 -0
  31. package/dist/lib/callgraph/tiParser.d.ts +21 -0
  32. package/dist/lib/callgraph/tiParser.js +672 -0
  33. package/dist/lib/callgraph/tiSignatures.d.ts +32 -0
  34. package/dist/lib/callgraph/tiSignatures.js +6185 -0
  35. package/dist/lib/callgraph/tm1-adapter.d.ts +32 -0
  36. package/dist/lib/callgraph/tm1-adapter.js +159 -0
  37. package/dist/lib/callgraph/types.d.ts +53 -0
  38. package/dist/lib/callgraph/types.js +2 -0
  39. package/dist/lib/callgraph/variableEnv.d.ts +86 -0
  40. package/dist/lib/callgraph/variableEnv.js +214 -0
  41. package/dist/lib/cell-address.d.ts +12 -0
  42. package/dist/lib/cell-address.js +71 -0
  43. package/dist/lib/complexity/antipatterns.d.ts +22 -0
  44. package/dist/lib/complexity/antipatterns.js +302 -0
  45. package/dist/lib/complexity/comment-classifier.d.ts +24 -0
  46. package/dist/lib/complexity/comment-classifier.js +43 -0
  47. package/dist/lib/complexity/cross-process.d.ts +78 -0
  48. package/dist/lib/complexity/cross-process.js +114 -0
  49. package/dist/lib/complexity/process-metrics.d.ts +78 -0
  50. package/dist/lib/complexity/process-metrics.js +278 -0
  51. package/dist/lib/complexity/rules-metrics.d.ts +31 -0
  52. package/dist/lib/complexity/rules-metrics.js +99 -0
  53. package/dist/lib/concurrency.d.ts +11 -0
  54. package/dist/lib/concurrency.js +27 -0
  55. package/dist/lib/control-name.d.ts +10 -0
  56. package/dist/lib/control-name.js +10 -0
  57. package/dist/lib/coordinate-error.d.ts +3 -0
  58. package/dist/lib/coordinate-error.js +29 -0
  59. package/dist/lib/credential-format.d.ts +23 -0
  60. package/dist/lib/credential-format.js +25 -0
  61. package/dist/lib/cube-stats/fetcher.d.ts +106 -0
  62. package/dist/lib/cube-stats/fetcher.js +194 -0
  63. package/dist/lib/feeders/brackets.d.ts +47 -0
  64. package/dist/lib/feeders/brackets.js +195 -0
  65. package/dist/lib/feeders/element-type-cache.d.ts +42 -0
  66. package/dist/lib/feeders/element-type-cache.js +86 -0
  67. package/dist/lib/feeders/static-heuristics.d.ts +101 -0
  68. package/dist/lib/feeders/static-heuristics.js +202 -0
  69. package/dist/lib/git-process.d.ts +67 -0
  70. package/dist/lib/git-process.js +243 -0
  71. package/dist/lib/mask-secrets.d.ts +10 -0
  72. package/dist/lib/mask-secrets.js +99 -0
  73. package/dist/lib/mdx.d.ts +3 -0
  74. package/dist/lib/mdx.js +13 -0
  75. package/dist/lib/naming/odata-filter.d.ts +15 -0
  76. package/dist/lib/naming/odata-filter.js +81 -0
  77. package/dist/lib/naming/rules.d.ts +34 -0
  78. package/dist/lib/naming/rules.js +215 -0
  79. package/dist/lib/pro-parser.d.ts +19 -0
  80. package/dist/lib/pro-parser.js +260 -0
  81. package/dist/lib/pro-serializer.d.ts +19 -0
  82. package/dist/lib/pro-serializer.js +170 -0
  83. package/dist/lib/process-parts-schema.d.ts +45 -0
  84. package/dist/lib/process-parts-schema.js +46 -0
  85. package/dist/lib/process-refs.d.ts +88 -0
  86. package/dist/lib/process-refs.js +441 -0
  87. package/dist/lib/rules-outline.d.ts +29 -0
  88. package/dist/lib/rules-outline.js +68 -0
  89. package/dist/lib/rules-patch.d.ts +6 -0
  90. package/dist/lib/rules-patch.js +59 -0
  91. package/dist/lib/safe-regex.d.ts +15 -0
  92. package/dist/lib/safe-regex.js +37 -0
  93. package/dist/lib/sample-cells.d.ts +48 -0
  94. package/dist/lib/sample-cells.js +146 -0
  95. package/dist/lib/slim-json-schema.d.ts +20 -0
  96. package/dist/lib/slim-json-schema.js +68 -0
  97. package/dist/lib/strip-comments.d.ts +23 -0
  98. package/dist/lib/strip-comments.js +61 -0
  99. package/dist/lib/tm1-events.d.ts +16 -0
  100. package/dist/lib/tm1-events.js +29 -0
  101. package/dist/lib/v12-compat/deprecated-ti.d.ts +17 -0
  102. package/dist/lib/v12-compat/deprecated-ti.js +257 -0
  103. package/dist/lib/v12-compat/scanner.d.ts +10 -0
  104. package/dist/lib/v12-compat/scanner.js +43 -0
  105. package/dist/lib/variables-ui-data.d.ts +26 -0
  106. package/dist/lib/variables-ui-data.js +77 -0
  107. package/dist/load-env.d.ts +2 -0
  108. package/dist/load-env.js +29 -0
  109. package/dist/logger.d.ts +4 -0
  110. package/dist/logger.js +60 -0
  111. package/dist/prompts/index.d.ts +3 -0
  112. package/dist/prompts/index.js +141 -0
  113. package/dist/resources/index.d.ts +5 -0
  114. package/dist/resources/index.js +237 -0
  115. package/dist/resources/list-handler.d.ts +40 -0
  116. package/dist/resources/list-handler.js +86 -0
  117. package/dist/resources/subscriptions.d.ts +19 -0
  118. package/dist/resources/subscriptions.js +80 -0
  119. package/dist/schemas/cells.d.ts +17 -0
  120. package/dist/schemas/cells.js +13 -0
  121. package/dist/schemas/common.d.ts +16 -0
  122. package/dist/schemas/common.js +14 -0
  123. package/dist/schemas/index.d.ts +10 -0
  124. package/dist/schemas/index.js +23 -0
  125. package/dist/schemas/metadata.d.ts +70 -0
  126. package/dist/schemas/metadata.js +47 -0
  127. package/dist/schemas/monitoring.d.ts +95 -0
  128. package/dist/schemas/monitoring.js +69 -0
  129. package/dist/schemas/processes.d.ts +74 -0
  130. package/dist/schemas/processes.js +66 -0
  131. package/dist/schemas/scheduling.d.ts +13 -0
  132. package/dist/schemas/scheduling.js +13 -0
  133. package/dist/schemas/security.d.ts +19 -0
  134. package/dist/schemas/security.js +16 -0
  135. package/dist/schemas/subsets.d.ts +12 -0
  136. package/dist/schemas/subsets.js +12 -0
  137. package/dist/schemas/views.d.ts +9 -0
  138. package/dist/schemas/views.js +9 -0
  139. package/dist/session-manager.d.ts +79 -0
  140. package/dist/session-manager.js +281 -0
  141. package/dist/tm1-client/connection/profile.d.ts +13 -0
  142. package/dist/tm1-client/connection/profile.js +99 -0
  143. package/dist/tm1-client/dispatcher.d.ts +5 -0
  144. package/dist/tm1-client/dispatcher.js +31 -0
  145. package/dist/tm1-client/http.d.ts +81 -0
  146. package/dist/tm1-client/http.js +547 -0
  147. package/dist/tm1-client/services/batch-service.d.ts +123 -0
  148. package/dist/tm1-client/services/batch-service.js +455 -0
  149. package/dist/tm1-client/services/cell-service.d.ts +71 -0
  150. package/dist/tm1-client/services/cell-service.js +333 -0
  151. package/dist/tm1-client/services/cellset-transform.d.ts +26 -0
  152. package/dist/tm1-client/services/cellset-transform.js +80 -0
  153. package/dist/tm1-client/services/chore-service.d.ts +68 -0
  154. package/dist/tm1-client/services/chore-service.js +179 -0
  155. package/dist/tm1-client/services/chore-status.d.ts +11 -0
  156. package/dist/tm1-client/services/chore-status.js +127 -0
  157. package/dist/tm1-client/services/cube-service.d.ts +134 -0
  158. package/dist/tm1-client/services/cube-service.js +294 -0
  159. package/dist/tm1-client/services/dimension-service.d.ts +118 -0
  160. package/dist/tm1-client/services/dimension-service.js +249 -0
  161. package/dist/tm1-client/services/element-service.d.ts +245 -0
  162. package/dist/tm1-client/services/element-service.js +809 -0
  163. package/dist/tm1-client/services/fallback.d.ts +44 -0
  164. package/dist/tm1-client/services/fallback.js +72 -0
  165. package/dist/tm1-client/services/file-service.d.ts +53 -0
  166. package/dist/tm1-client/services/file-service.js +218 -0
  167. package/dist/tm1-client/services/hierarchy-service.d.ts +129 -0
  168. package/dist/tm1-client/services/hierarchy-service.js +332 -0
  169. package/dist/tm1-client/services/monitoring-service.d.ts +34 -0
  170. package/dist/tm1-client/services/monitoring-service.js +123 -0
  171. package/dist/tm1-client/services/odata-page.d.ts +71 -0
  172. package/dist/tm1-client/services/odata-page.js +87 -0
  173. package/dist/tm1-client/services/process-service.d.ts +278 -0
  174. package/dist/tm1-client/services/process-service.js +874 -0
  175. package/dist/tm1-client/services/process-status.d.ts +21 -0
  176. package/dist/tm1-client/services/process-status.js +89 -0
  177. package/dist/tm1-client/services/security-service.d.ts +50 -0
  178. package/dist/tm1-client/services/security-service.js +93 -0
  179. package/dist/tm1-client/services/server-service.d.ts +116 -0
  180. package/dist/tm1-client/services/server-service.js +504 -0
  181. package/dist/tm1-client/services/subset-service.d.ts +37 -0
  182. package/dist/tm1-client/services/subset-service.js +122 -0
  183. package/dist/tm1-client/services/view-service.d.ts +46 -0
  184. package/dist/tm1-client/services/view-service.js +287 -0
  185. package/dist/tm1-client.d.ts +56 -0
  186. package/dist/tm1-client.js +126 -0
  187. package/dist/tools/analysis/analyze-callgraph.d.ts +28 -0
  188. package/dist/tools/analysis/analyze-callgraph.js +350 -0
  189. package/dist/tools/analysis/analyze-chore-graph.d.ts +2 -0
  190. package/dist/tools/analysis/analyze-chore-graph.js +148 -0
  191. package/dist/tools/analysis/analyze-object-usage.d.ts +2 -0
  192. package/dist/tools/analysis/analyze-object-usage.js +143 -0
  193. package/dist/tools/analysis/audit-complexity.d.ts +2 -0
  194. package/dist/tools/analysis/audit-complexity.js +255 -0
  195. package/dist/tools/analysis/audit-feeders.d.ts +2 -0
  196. package/dist/tools/analysis/audit-feeders.js +417 -0
  197. package/dist/tools/analysis/audit-naming.d.ts +2 -0
  198. package/dist/tools/analysis/audit-naming.js +379 -0
  199. package/dist/tools/analysis/check-v12-readiness.d.ts +2 -0
  200. package/dist/tools/analysis/check-v12-readiness.js +136 -0
  201. package/dist/tools/analysis/find-orphan-dimensions.d.ts +2 -0
  202. package/dist/tools/analysis/find-orphan-dimensions.js +55 -0
  203. package/dist/tools/analysis/invalidate-callgraph-cache.d.ts +2 -0
  204. package/dist/tools/analysis/invalidate-callgraph-cache.js +40 -0
  205. package/dist/tools/analysis/trace-data-flow.d.ts +2 -0
  206. package/dist/tools/analysis/trace-data-flow.js +138 -0
  207. package/dist/tools/annotations.d.ts +12 -0
  208. package/dist/tools/annotations.js +61 -0
  209. package/dist/tools/celldata/check-feeders.d.ts +2 -0
  210. package/dist/tools/celldata/check-feeders.js +48 -0
  211. package/dist/tools/celldata/check-writable-coords.d.ts +2 -0
  212. package/dist/tools/celldata/check-writable-coords.js +126 -0
  213. package/dist/tools/celldata/execute-mdx.d.ts +17 -0
  214. package/dist/tools/celldata/execute-mdx.js +126 -0
  215. package/dist/tools/celldata/get-cell-value.d.ts +2 -0
  216. package/dist/tools/celldata/get-cell-value.js +30 -0
  217. package/dist/tools/celldata/get-view-definition.d.ts +2 -0
  218. package/dist/tools/celldata/get-view-definition.js +29 -0
  219. package/dist/tools/celldata/get-view.d.ts +2 -0
  220. package/dist/tools/celldata/get-view.js +55 -0
  221. package/dist/tools/celldata/sample-cells.d.ts +2 -0
  222. package/dist/tools/celldata/sample-cells.js +101 -0
  223. package/dist/tools/celldata/trace-cell-calculation.d.ts +2 -0
  224. package/dist/tools/celldata/trace-cell-calculation.js +53 -0
  225. package/dist/tools/celldata/trace-feeders.d.ts +2 -0
  226. package/dist/tools/celldata/trace-feeders.js +44 -0
  227. package/dist/tools/celldata/write-cells.d.ts +2 -0
  228. package/dist/tools/celldata/write-cells.js +65 -0
  229. package/dist/tools/confirm.d.ts +10 -0
  230. package/dist/tools/confirm.js +64 -0
  231. package/dist/tools/define-tool.d.ts +51 -0
  232. package/dist/tools/define-tool.js +49 -0
  233. package/dist/tools/dimension-management/bulk-upsert-elements.d.ts +2 -0
  234. package/dist/tools/dimension-management/bulk-upsert-elements.js +103 -0
  235. package/dist/tools/dimension-management/create-dimension.d.ts +2 -0
  236. package/dist/tools/dimension-management/create-dimension.js +22 -0
  237. package/dist/tools/dimension-management/create-element-attribute.d.ts +2 -0
  238. package/dist/tools/dimension-management/create-element-attribute.js +26 -0
  239. package/dist/tools/dimension-management/create-element.d.ts +2 -0
  240. package/dist/tools/dimension-management/create-element.js +31 -0
  241. package/dist/tools/dimension-management/create-hierarchy.d.ts +2 -0
  242. package/dist/tools/dimension-management/create-hierarchy.js +22 -0
  243. package/dist/tools/dimension-management/delete-dimension.d.ts +2 -0
  244. package/dist/tools/dimension-management/delete-dimension.js +25 -0
  245. package/dist/tools/dimension-management/delete-element.d.ts +2 -0
  246. package/dist/tools/dimension-management/delete-element.js +26 -0
  247. package/dist/tools/dimension-management/delete-elements.d.ts +2 -0
  248. package/dist/tools/dimension-management/delete-elements.js +44 -0
  249. package/dist/tools/dimension-management/delete-hierarchy.d.ts +2 -0
  250. package/dist/tools/dimension-management/delete-hierarchy.js +35 -0
  251. package/dist/tools/dimension-management/get-element-attribute-values.d.ts +2 -0
  252. package/dist/tools/dimension-management/get-element-attribute-values.js +77 -0
  253. package/dist/tools/dimension-management/list-element-attributes.d.ts +2 -0
  254. package/dist/tools/dimension-management/list-element-attributes.js +31 -0
  255. package/dist/tools/dimension-management/move-element.d.ts +2 -0
  256. package/dist/tools/dimension-management/move-element.js +28 -0
  257. package/dist/tools/dimension-management/update-element-attribute-value.d.ts +2 -0
  258. package/dist/tools/dimension-management/update-element-attribute-value.js +80 -0
  259. package/dist/tools/dimension-management/update-element.d.ts +2 -0
  260. package/dist/tools/dimension-management/update-element.js +35 -0
  261. package/dist/tools/error-format.d.ts +22 -0
  262. package/dist/tools/error-format.js +130 -0
  263. package/dist/tools/fileops/delete-file.d.ts +2 -0
  264. package/dist/tools/fileops/delete-file.js +32 -0
  265. package/dist/tools/fileops/get-file-content.d.ts +2 -0
  266. package/dist/tools/fileops/get-file-content.js +76 -0
  267. package/dist/tools/fileops/list-files.d.ts +2 -0
  268. package/dist/tools/fileops/list-files.js +43 -0
  269. package/dist/tools/fileops/search-files.d.ts +2 -0
  270. package/dist/tools/fileops/search-files.js +76 -0
  271. package/dist/tools/fileops/upload-file.d.ts +2 -0
  272. package/dist/tools/fileops/upload-file.js +69 -0
  273. package/dist/tools/format.d.ts +57 -0
  274. package/dist/tools/format.js +157 -0
  275. package/dist/tools/hierarchy.d.ts +6 -0
  276. package/dist/tools/hierarchy.js +27 -0
  277. package/dist/tools/index.d.ts +4 -0
  278. package/dist/tools/index.js +263 -0
  279. package/dist/tools/local-file.d.ts +16 -0
  280. package/dist/tools/local-file.js +88 -0
  281. package/dist/tools/metadata/get-ancestors.d.ts +2 -0
  282. package/dist/tools/metadata/get-ancestors.js +36 -0
  283. package/dist/tools/metadata/get-descendants.d.ts +2 -0
  284. package/dist/tools/metadata/get-descendants.js +64 -0
  285. package/dist/tools/metadata/get-hierarchy.d.ts +2 -0
  286. package/dist/tools/metadata/get-hierarchy.js +130 -0
  287. package/dist/tools/metadata/list-chores.d.ts +2 -0
  288. package/dist/tools/metadata/list-chores.js +62 -0
  289. package/dist/tools/metadata/list-cubes.d.ts +2 -0
  290. package/dist/tools/metadata/list-cubes.js +128 -0
  291. package/dist/tools/metadata/list-dimensions.d.ts +2 -0
  292. package/dist/tools/metadata/list-dimensions.js +131 -0
  293. package/dist/tools/metadata/list-processes-grouped.d.ts +2 -0
  294. package/dist/tools/metadata/list-processes-grouped.js +96 -0
  295. package/dist/tools/metadata/list-processes.d.ts +2 -0
  296. package/dist/tools/metadata/list-processes.js +108 -0
  297. package/dist/tools/metadata/resolve-default-members.d.ts +2 -0
  298. package/dist/tools/metadata/resolve-default-members.js +46 -0
  299. package/dist/tools/model-building/check-cube-rule.d.ts +2 -0
  300. package/dist/tools/model-building/check-cube-rule.js +51 -0
  301. package/dist/tools/model-building/clear-cube.d.ts +2 -0
  302. package/dist/tools/model-building/clear-cube.js +46 -0
  303. package/dist/tools/model-building/create-cube.d.ts +2 -0
  304. package/dist/tools/model-building/create-cube.js +34 -0
  305. package/dist/tools/model-building/delete-cube.d.ts +2 -0
  306. package/dist/tools/model-building/delete-cube.js +27 -0
  307. package/dist/tools/model-building/get-all-cube-rules.d.ts +2 -0
  308. package/dist/tools/model-building/get-all-cube-rules.js +149 -0
  309. package/dist/tools/model-building/get-cube-rules.d.ts +2 -0
  310. package/dist/tools/model-building/get-cube-rules.js +69 -0
  311. package/dist/tools/model-building/rules-source.d.ts +21 -0
  312. package/dist/tools/model-building/rules-source.js +49 -0
  313. package/dist/tools/model-building/search-rules.d.ts +2 -0
  314. package/dist/tools/model-building/search-rules.js +132 -0
  315. package/dist/tools/model-building/set-cube-rules.d.ts +2 -0
  316. package/dist/tools/model-building/set-cube-rules.js +81 -0
  317. package/dist/tools/model-building/unload-cube.d.ts +2 -0
  318. package/dist/tools/model-building/unload-cube.js +23 -0
  319. package/dist/tools/operations/diagnose-process-error.d.ts +2 -0
  320. package/dist/tools/operations/diagnose-process-error.js +178 -0
  321. package/dist/tools/operations/error-log-helpers.d.ts +25 -0
  322. package/dist/tools/operations/error-log-helpers.js +57 -0
  323. package/dist/tools/operations/get-audit-log.d.ts +2 -0
  324. package/dist/tools/operations/get-audit-log.js +70 -0
  325. package/dist/tools/operations/get-cube-stats.d.ts +2 -0
  326. package/dist/tools/operations/get-cube-stats.js +107 -0
  327. package/dist/tools/operations/get-error-log-content.d.ts +2 -0
  328. package/dist/tools/operations/get-error-log-content.js +164 -0
  329. package/dist/tools/operations/get-jobs.d.ts +3 -0
  330. package/dist/tools/operations/get-jobs.js +51 -0
  331. package/dist/tools/operations/get-message-log.d.ts +2 -0
  332. package/dist/tools/operations/get-message-log.js +63 -0
  333. package/dist/tools/operations/get-server-info.d.ts +2 -0
  334. package/dist/tools/operations/get-server-info.js +180 -0
  335. package/dist/tools/operations/get-server-state.d.ts +2 -0
  336. package/dist/tools/operations/get-server-state.js +129 -0
  337. package/dist/tools/operations/get-sessions.d.ts +2 -0
  338. package/dist/tools/operations/get-sessions.js +76 -0
  339. package/dist/tools/operations/get-threads.d.ts +3 -0
  340. package/dist/tools/operations/get-threads.js +50 -0
  341. package/dist/tools/operations/get-transaction-log.d.ts +2 -0
  342. package/dist/tools/operations/get-transaction-log.js +63 -0
  343. package/dist/tools/operations/list-error-logs.d.ts +8 -0
  344. package/dist/tools/operations/list-error-logs.js +157 -0
  345. package/dist/tools/operations/save-data.d.ts +2 -0
  346. package/dist/tools/operations/save-data.js +50 -0
  347. package/dist/tools/pagination.d.ts +32 -0
  348. package/dist/tools/pagination.js +116 -0
  349. package/dist/tools/scheduling/create-chore.d.ts +2 -0
  350. package/dist/tools/scheduling/create-chore.js +93 -0
  351. package/dist/tools/scheduling/delete-chore.d.ts +2 -0
  352. package/dist/tools/scheduling/delete-chore.js +22 -0
  353. package/dist/tools/scheduling/execute-chore.d.ts +2 -0
  354. package/dist/tools/scheduling/execute-chore.js +52 -0
  355. package/dist/tools/scheduling/toggle-chore.d.ts +2 -0
  356. package/dist/tools/scheduling/toggle-chore.js +22 -0
  357. package/dist/tools/scheduling/update-chore.d.ts +2 -0
  358. package/dist/tools/scheduling/update-chore.js +71 -0
  359. package/dist/tools/schemas/common.d.ts +10 -0
  360. package/dist/tools/schemas/common.js +23 -0
  361. package/dist/tools/schemas/items-analysis.d.ts +394 -0
  362. package/dist/tools/schemas/items-analysis.js +419 -0
  363. package/dist/tools/schemas/items-cells.d.ts +70 -0
  364. package/dist/tools/schemas/items-cells.js +65 -0
  365. package/dist/tools/schemas/items-common.d.ts +18 -0
  366. package/dist/tools/schemas/items-common.js +39 -0
  367. package/dist/tools/schemas/items-fileops.d.ts +11 -0
  368. package/dist/tools/schemas/items-fileops.js +13 -0
  369. package/dist/tools/schemas/items-metadata.d.ts +262 -0
  370. package/dist/tools/schemas/items-metadata.js +184 -0
  371. package/dist/tools/schemas/items-monitoring.d.ts +79 -0
  372. package/dist/tools/schemas/items-monitoring.js +78 -0
  373. package/dist/tools/schemas/items-processes.d.ts +279 -0
  374. package/dist/tools/schemas/items-processes.js +235 -0
  375. package/dist/tools/schemas/items-scheduling.d.ts +25 -0
  376. package/dist/tools/schemas/items-scheduling.js +26 -0
  377. package/dist/tools/schemas/items-security.d.ts +19 -0
  378. package/dist/tools/schemas/items-security.js +12 -0
  379. package/dist/tools/schemas/items-subsets.d.ts +2 -0
  380. package/dist/tools/schemas/items-subsets.js +4 -0
  381. package/dist/tools/schemas/items-views.d.ts +38 -0
  382. package/dist/tools/schemas/items-views.js +26 -0
  383. package/dist/tools/schemas/items.d.ts +12 -0
  384. package/dist/tools/schemas/items.js +23 -0
  385. package/dist/tools/schemas/markdown-capable.d.ts +21 -0
  386. package/dist/tools/schemas/markdown-capable.js +58 -0
  387. package/dist/tools/schemas/output-schema.d.ts +24 -0
  388. package/dist/tools/schemas/output-schema.js +25 -0
  389. package/dist/tools/security/assign-client-group.d.ts +2 -0
  390. package/dist/tools/security/assign-client-group.js +20 -0
  391. package/dist/tools/security/create-client.d.ts +2 -0
  392. package/dist/tools/security/create-client.js +28 -0
  393. package/dist/tools/security/delete-client.d.ts +2 -0
  394. package/dist/tools/security/delete-client.js +22 -0
  395. package/dist/tools/security/get-client.d.ts +2 -0
  396. package/dist/tools/security/get-client.js +20 -0
  397. package/dist/tools/security/list-clients.d.ts +2 -0
  398. package/dist/tools/security/list-clients.js +86 -0
  399. package/dist/tools/security/list-groups.d.ts +2 -0
  400. package/dist/tools/security/list-groups.js +43 -0
  401. package/dist/tools/security/remove-client-group.d.ts +2 -0
  402. package/dist/tools/security/remove-client-group.js +27 -0
  403. package/dist/tools/security/update-client.d.ts +2 -0
  404. package/dist/tools/security/update-client.js +22 -0
  405. package/dist/tools/subsets/create-subset.d.ts +2 -0
  406. package/dist/tools/subsets/create-subset.js +44 -0
  407. package/dist/tools/subsets/delete-subset.d.ts +2 -0
  408. package/dist/tools/subsets/delete-subset.js +26 -0
  409. package/dist/tools/subsets/get-subset.d.ts +2 -0
  410. package/dist/tools/subsets/get-subset.js +29 -0
  411. package/dist/tools/subsets/list-subsets.d.ts +2 -0
  412. package/dist/tools/subsets/list-subsets.js +36 -0
  413. package/dist/tools/subsets/update-subset.d.ts +2 -0
  414. package/dist/tools/subsets/update-subset.js +33 -0
  415. package/dist/tools/ti-development/check-process-code.d.ts +2 -0
  416. package/dist/tools/ti-development/check-process-code.js +96 -0
  417. package/dist/tools/ti-development/compile-process.d.ts +2 -0
  418. package/dist/tools/ti-development/compile-process.js +32 -0
  419. package/dist/tools/ti-development/copy-process.d.ts +2 -0
  420. package/dist/tools/ti-development/copy-process.js +32 -0
  421. package/dist/tools/ti-development/delete-process.d.ts +2 -0
  422. package/dist/tools/ti-development/delete-process.js +26 -0
  423. package/dist/tools/ti-development/diff-process-with-file.d.ts +2 -0
  424. package/dist/tools/ti-development/diff-process-with-file.js +208 -0
  425. package/dist/tools/ti-development/diff-processes.d.ts +2 -0
  426. package/dist/tools/ti-development/diff-processes.js +312 -0
  427. package/dist/tools/ti-development/execute-process.d.ts +8 -0
  428. package/dist/tools/ti-development/execute-process.js +109 -0
  429. package/dist/tools/ti-development/export-process-to-git.d.ts +2 -0
  430. package/dist/tools/ti-development/export-process-to-git.js +113 -0
  431. package/dist/tools/ti-development/export-process-to-pro.d.ts +2 -0
  432. package/dist/tools/ti-development/export-process-to-pro.js +117 -0
  433. package/dist/tools/ti-development/get-all-processes-code.d.ts +2 -0
  434. package/dist/tools/ti-development/get-all-processes-code.js +131 -0
  435. package/dist/tools/ti-development/get-process-code.d.ts +2 -0
  436. package/dist/tools/ti-development/get-process-code.js +100 -0
  437. package/dist/tools/ti-development/get-process-datasource.d.ts +2 -0
  438. package/dist/tools/ti-development/get-process-datasource.js +20 -0
  439. package/dist/tools/ti-development/get-process-parameters.d.ts +2 -0
  440. package/dist/tools/ti-development/get-process-parameters.js +25 -0
  441. package/dist/tools/ti-development/get-process-variables.d.ts +2 -0
  442. package/dist/tools/ti-development/get-process-variables.js +38 -0
  443. package/dist/tools/ti-development/get-process.d.ts +2 -0
  444. package/dist/tools/ti-development/get-process.js +163 -0
  445. package/dist/tools/ti-development/import-pro-file.d.ts +2 -0
  446. package/dist/tools/ti-development/import-pro-file.js +153 -0
  447. package/dist/tools/ti-development/import-process-from-git.d.ts +2 -0
  448. package/dist/tools/ti-development/import-process-from-git.js +198 -0
  449. package/dist/tools/ti-development/install-pro-bundle.d.ts +2 -0
  450. package/dist/tools/ti-development/install-pro-bundle.js +288 -0
  451. package/dist/tools/ti-development/preflight.d.ts +39 -0
  452. package/dist/tools/ti-development/preflight.js +56 -0
  453. package/dist/tools/ti-development/process-backup.d.ts +29 -0
  454. package/dist/tools/ti-development/process-backup.js +118 -0
  455. package/dist/tools/ti-development/search-code.d.ts +2 -0
  456. package/dist/tools/ti-development/search-code.js +208 -0
  457. package/dist/tools/ti-development/upsert-process.d.ts +2 -0
  458. package/dist/tools/ti-development/upsert-process.js +167 -0
  459. package/dist/tools/ti-development/validate-process-refs.d.ts +2 -0
  460. package/dist/tools/ti-development/validate-process-refs.js +73 -0
  461. package/dist/tools/views/create-mdx-view.d.ts +2 -0
  462. package/dist/tools/views/create-mdx-view.js +21 -0
  463. package/dist/tools/views/create-native-view.d.ts +2 -0
  464. package/dist/tools/views/create-native-view.js +81 -0
  465. package/dist/tools/views/delete-view.d.ts +2 -0
  466. package/dist/tools/views/delete-view.js +23 -0
  467. package/dist/tools/views/list-views.d.ts +2 -0
  468. package/dist/tools/views/list-views.js +32 -0
  469. package/dist/tools/with-annotations.d.ts +6 -0
  470. package/dist/tools/with-annotations.js +339 -0
  471. package/dist/types.d.ts +409 -0
  472. package/dist/types.js +91 -0
  473. package/dist/version.d.ts +4 -0
  474. package/dist/version.js +18 -0
  475. package/package.json +107 -0
@@ -0,0 +1,157 @@
1
+ import { z } from "zod";
2
+ import { FORMAT_SCHEMA, pageResponse, wrappedPageResponse, columnsOf, } from "../format.js";
3
+ import { PAGINATION_SCHEMA, paginate } from "../pagination.js";
4
+ import { ErrorLogFileSchema, ErrorLogGroupSchema } from "../schemas/items.js";
5
+ import { READ_ONLY } from "../annotations.js";
6
+ import { defineTool } from "../define-tool.js";
7
+ import { pageShapeFor } from "../schemas/common.js";
8
+ // Best-effort extraction of {process, ts} from an error-log filename.
9
+ // Two known patterns (see server-service.listErrorLogFiles):
10
+ // modern v11: TM1ProcessError_<ts>_<id>_<proc>(_<hash>)?.log
11
+ // legacy: <proc>_<ts>.log
12
+ // Process names may contain underscores, so the modern parse greedily captures
13
+ // the tail and strips a trailing session-hash token (_<hex6+>). This is a
14
+ // heuristic — good enough for audit triage, not a guaranteed exact split.
15
+ export function parseLogName(filename) {
16
+ const modern = filename.match(/^TM1ProcessError_(\d{14})_\d+_(.+)\.log$/i);
17
+ if (modern) {
18
+ // Strip the trailing TM1 session-hash token. Real-world v11 hashes are
19
+ // lowercase base36 (e.g. "_mp2su7f4sybb"), not just hex, so match any
20
+ // lowercase-alphanumeric token of length >= 8 that contains at least one
21
+ // digit (the digit requirement avoids stripping real word suffixes like
22
+ // "_export"). Collapses TIRecord_<proc>_<hash> variants onto one process.
23
+ const proc = modern[2].replace(/_(?=[a-z0-9]*\d)[a-z0-9]{8,}$/, "");
24
+ return { ts: modern[1], process: proc };
25
+ }
26
+ const legacy = filename.match(/^(.+)_(\d{8,14})\.log$/i);
27
+ if (legacy) {
28
+ return { ts: legacy[2], process: legacy[1] };
29
+ }
30
+ return { process: null, ts: null };
31
+ }
32
+ // "20260615123045" → "2026-06-15T12:30:45" (best-effort; shorter ts left as-is).
33
+ export function formatTs(ts) {
34
+ if (!ts || ts.length < 8)
35
+ return null;
36
+ const y = ts.slice(0, 4);
37
+ const mo = ts.slice(4, 6);
38
+ const d = ts.slice(6, 8);
39
+ const h = ts.slice(8, 10) || "00";
40
+ const mi = ts.slice(10, 12) || "00";
41
+ const s = ts.slice(12, 14) || "00";
42
+ return `${y}-${mo}-${d}T${h}:${mi}:${s}`;
43
+ }
44
+ // Whole-day count between two 14-digit timestamps, inclusive (min 1).
45
+ export function spanDays(firstTs, lastTs) {
46
+ const toDate = (ts) => {
47
+ const iso = formatTs(ts);
48
+ return iso ? new Date(iso) : null;
49
+ };
50
+ const a = toDate(firstTs);
51
+ const b = toDate(lastTs);
52
+ if (!a || !b || Number.isNaN(a.getTime()) || Number.isNaN(b.getTime()))
53
+ return 1;
54
+ const diffDays = Math.floor((b.getTime() - a.getTime()) / 86_400_000);
55
+ return Math.max(1, diffDays + 1);
56
+ }
57
+ export const registerListErrorLogs = defineTool({
58
+ name: "tm1_list_error_logs",
59
+ description: [
60
+ "List TI process error log files on the TM1 server, newest first. Paginated (default 50/page).",
61
+ "For one-call diagnosis of a failed process prefer tm1_diagnose_process_error (list + fetch combined); use this to browse the catalogue, then tm1_get_error_log_content for raw text.",
62
+ "groupBy='process' returns a per-process audit summary instead of individual files.",
63
+ ],
64
+ annotations: READ_ONLY,
65
+ output: pageShapeFor(z.union([ErrorLogFileSchema, ErrorLogGroupSchema])),
66
+ input: {
67
+ processName: z
68
+ .string()
69
+ .optional()
70
+ .describe("Optional process-name filter — matches both modern v11 'TM1ProcessError_<ts>_<id>_<processName>_<hash>.log' and legacy '<processName>_<ts>.log' filename patterns."),
71
+ since: z
72
+ .string()
73
+ .optional()
74
+ .describe("Only logs with LastUpdated >= this ISO timestamp, e.g. '2026-05-01T00:00:00'"),
75
+ groupBy: z
76
+ .literal("process")
77
+ .optional()
78
+ .describe("Set to 'process' for an aggregated audit summary instead of individual files: " +
79
+ "per process {count, firstSeen, lastSeen, spanDays, perDay}, sorted by count desc. " +
80
+ "Answers 'which processes fail regularly' in one call. Process name is extracted from the " +
81
+ "filename heuristically; unparseable names bucket under '(unparsed)'."),
82
+ ...PAGINATION_SCHEMA,
83
+ ...FORMAT_SCHEMA,
84
+ },
85
+ handler: async ({ processName, since, groupBy, limit, offset, fetchAll, format }, tm1Client) => {
86
+ // Pull a generous slice from the server (top=500); pagination is applied client-side
87
+ // so callers always see total + has_more even if they limit to a small page.
88
+ const files = await tm1Client.server.listErrorLogFiles({
89
+ processName,
90
+ since,
91
+ top: 500,
92
+ });
93
+ if (groupBy === "process") {
94
+ const acc = new Map();
95
+ for (const f of files) {
96
+ const { process, ts } = parseLogName(f.filename);
97
+ const key = process ?? "(unparsed)";
98
+ let g = acc.get(key);
99
+ if (!g) {
100
+ g = { count: 0, first: null, last: null };
101
+ acc.set(key, g);
102
+ }
103
+ g.count++;
104
+ if (ts) {
105
+ if (g.first === null || ts < g.first)
106
+ g.first = ts;
107
+ if (g.last === null || ts > g.last)
108
+ g.last = ts;
109
+ }
110
+ }
111
+ const allGroups = [...acc.entries()]
112
+ .map(([process, g]) => {
113
+ const span = g.first && g.last ? spanDays(g.first, g.last) : 1;
114
+ return {
115
+ process,
116
+ count: g.count,
117
+ firstSeen: formatTs(g.first),
118
+ lastSeen: formatTs(g.last),
119
+ spanDays: span,
120
+ perDay: Math.round((g.count / span) * 100) / 100,
121
+ };
122
+ })
123
+ .sort((a, b) => b.count - a.count || a.process.localeCompare(b.process));
124
+ const groupPage = paginate(allGroups, limit, offset, fetchAll);
125
+ const wrapper = {
126
+ groupBy: "process",
127
+ processName,
128
+ since,
129
+ totalFiles: files.length,
130
+ groupCount: allGroups.length,
131
+ ...groupPage,
132
+ };
133
+ const groupColumns = columnsOf([
134
+ "process",
135
+ "count",
136
+ "firstSeen",
137
+ "lastSeen",
138
+ "spanDays",
139
+ "perDay",
140
+ ]);
141
+ return wrappedPageResponse(wrapper, groupPage, format, {
142
+ title: "Error log summary (by process)",
143
+ columns: groupColumns,
144
+ });
145
+ }
146
+ const page = paginate(files, limit, offset, fetchAll);
147
+ const columns = columnsOf([
148
+ "filename",
149
+ {
150
+ header: "lastUpdated",
151
+ get: (f) => f.lastUpdated ?? formatTs(parseLogName(f.filename).ts) ?? "",
152
+ },
153
+ ]);
154
+ return pageResponse(page, format, { title: "Error logs", columns });
155
+ },
156
+ });
157
+ //# sourceMappingURL=list-error-logs.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerSaveData: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=save-data.d.ts.map
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ import { withToolHint } from "../error-format.js";
3
+ import { IDEMPOTENT_WRITE, withVersion } from "../annotations.js";
4
+ import { MutationResultSchema } from "../schemas/items.js";
5
+ import { defineTool } from "../define-tool.js";
6
+ export const registerSaveData = defineTool({
7
+ name: "tm1_save_data",
8
+ description: [
9
+ "Persist in-memory cube data to disk: SaveDataAll (all cubes) or CubeSaveData when `cube` is given.",
10
+ "Run after write sessions (tm1_write_cells, TI loads) — unsaved changes are lost on server crash.",
11
+ "Persists in-memory data to disk only; it does not clear or truncate the transaction log.",
12
+ "v11 only — v12 removed SaveDataAll/CubeSaveData (cloud engine persists automatically).",
13
+ "Executes as an unbound TI process via ExecuteProcessWithReturn; no process object is created on the server.",
14
+ ],
15
+ annotations: withVersion(IDEMPOTENT_WRITE, "v11"),
16
+ enabled: (tm1Client) => tm1Client.version === 11,
17
+ output: MutationResultSchema,
18
+ input: {
19
+ cube: z
20
+ .string()
21
+ .optional()
22
+ .describe("Save only this cube (CubeSaveData). Omit to save all cubes (SaveDataAll)."),
23
+ timeoutMs: z
24
+ .number()
25
+ .int()
26
+ .min(1000)
27
+ .max(3600000)
28
+ .optional()
29
+ .describe("Override the default request timeout (ms, 1000–3600000). SaveDataAll on large models can take minutes."),
30
+ },
31
+ handler: async ({ cube, timeoutMs }, tm1Client, extra) => {
32
+ const result = await withToolHint(tm1Client.processes.saveData(cube, {
33
+ signal: extra?.signal,
34
+ ...(timeoutMs ? { timeoutMs } : {}),
35
+ }), "SaveData failed. On v12 this tool is unsupported (SaveDataAll removed). Check tm1_get_server_info for productVersion; for a single cube verify the name via tm1_list_cubes.");
36
+ return {
37
+ content: [
38
+ {
39
+ type: "text",
40
+ text: JSON.stringify({ ...result, scope: cube ?? "all" }),
41
+ },
42
+ ],
43
+ // A failed SaveData is a data-persistence failure (in-memory data not
44
+ // written to disk) — surface it as an MCP error, not a success payload
45
+ // carrying success:false, so the caller can't silently miss data loss.
46
+ ...(result.success === false ? { isError: true } : {}),
47
+ };
48
+ },
49
+ });
50
+ //# sourceMappingURL=save-data.js.map
@@ -0,0 +1,32 @@
1
+ import { z } from "zod";
2
+ export declare const UNBOUNDED_MAX_ITEMS = 5000;
3
+ export declare const PAGINATION_SCHEMA: {
4
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
5
+ offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
6
+ fetchAll: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
7
+ };
8
+ export interface Page<T> {
9
+ total: number;
10
+ count: number;
11
+ offset: number;
12
+ has_more: boolean;
13
+ next_offset: number | null;
14
+ items: T[];
15
+ }
16
+ export declare function paginate<T>(items: readonly T[], limit: number, offset: number, fetchAll?: boolean): Page<T>;
17
+ /**
18
+ * Wrap an already-server-sliced page (`$top`/`$skip`) in the same `Page<T>`
19
+ * envelope `paginate()` produces, using the server's `@odata.count` as `total`.
20
+ *
21
+ * `has_more` is derived from `offset + count < total`, never from
22
+ * `count === limit` — the latter is off by one whenever the last page happens
23
+ * to be exactly `limit` long.
24
+ *
25
+ * Only call this when every active filter was expressed in `$filter`.
26
+ * `@odata.count` counts post-filter rows; if a filter ran client-side, `total`
27
+ * would exceed what the caller can actually reach and `has_more` would promise
28
+ * pages that come back empty. Fall back to `paginate()` over a full fetch in
29
+ * that case.
30
+ */
31
+ export declare function pageFromServer<T>(items: readonly T[], total: number, offset: number): Page<T>;
32
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1,116 @@
1
+ // Pagination helpers for list_* MCP tools. Two shapes of one envelope:
2
+ //
3
+ // paginate() — slices an in-memory array. Used when the handler had to
4
+ // fetch the whole collection anyway (a filter TM1 cannot
5
+ // express, fetchAll, limit=0).
6
+ // pageFromServer() — wraps a page TM1 already sliced via $top/$skip, with
7
+ // `total` taken from `@odata.count`.
8
+ //
9
+ // Both produce a byte-identical `Page<T>`, so the push-down decision is
10
+ // invisible to callers and needs no output-schema change. Which one a handler
11
+ // may use is a correctness question, not a performance one: `@odata.count` is
12
+ // computed after `$filter`, so it equals the true total only when *every*
13
+ // active filter was pushed down. Any filter that stays client-side must force
14
+ // the paginate() path.
15
+ import { z } from "zod";
16
+ // Hard ceiling for the unbounded modes (`fetchAll`, `limit=0`). Not a page
17
+ // size — a backstop. 5000 rows of a typical list item already run into six
18
+ // figures of characters; past that the response stops being usable by the
19
+ // agent that asked for it, and the honest answer is "here is the first slab,
20
+ // keep paging" rather than a response nobody can read.
21
+ export const UNBOUNDED_MAX_ITEMS = 5000;
22
+ // Descriptions are deliberately terse: this block is inlined into 19 tool input
23
+ // schemas, so every byte is paid 19x in every `tools/list` payload. Anything
24
+ // JSON Schema already emits structurally (`default`, `minimum`, `maximum`) is
25
+ // NOT repeated in prose — only semantics the schema cannot express (0 = all,
26
+ // fetchAll's payload cost and its cap) stay in the text.
27
+ export const PAGINATION_SCHEMA = {
28
+ limit: z
29
+ .number()
30
+ .int()
31
+ .min(0)
32
+ .max(500)
33
+ .optional()
34
+ .default(50)
35
+ .describe("Page size; 0 = all."),
36
+ offset: z
37
+ .number()
38
+ .int()
39
+ .min(0)
40
+ .optional()
41
+ .default(0)
42
+ .describe("Items to skip."),
43
+ fetchAll: z
44
+ .boolean()
45
+ .optional()
46
+ .default(false)
47
+ // Terse on purpose: this string ships 19x in every tools/list (see the
48
+ // note above and the 60-char gate in tests/unit/pagination.test.ts). The
49
+ // cap is not expressible in JSON Schema — it only applies on this branch —
50
+ // so it has to be prose, but short prose.
51
+ .describe(`All items, ignoring limit/offset. Capped ${UNBOUNDED_MAX_ITEMS}.`),
52
+ };
53
+ export function paginate(items, limit, offset, fetchAll = false) {
54
+ if (fetchAll || limit === 0) {
55
+ // Bounded even here. `fetchAll` / `limit=0` are escape hatches from the
56
+ // page SIZE, not from every limit: a dimension with 200k elements would
57
+ // otherwise serialize 200k rows into one response and exhaust the caller's
58
+ // context long before TM1 breaks a sweat.
59
+ //
60
+ // The cap reuses the normal envelope instead of inventing a new signal —
61
+ // has_more/next_offset already mean "more rows exist, resume here", so a
62
+ // capped fetchAll is simply a first page the caller can walk on from.
63
+ // Nothing disappears silently.
64
+ const slice = items.slice(0, UNBOUNDED_MAX_ITEMS);
65
+ const has_more = slice.length < items.length;
66
+ return {
67
+ total: items.length,
68
+ count: slice.length,
69
+ offset: 0,
70
+ has_more,
71
+ next_offset: has_more ? slice.length : null,
72
+ items: slice,
73
+ };
74
+ }
75
+ const safeOffset = Math.max(0, Math.min(offset, items.length));
76
+ const slice = items.slice(safeOffset, safeOffset + limit);
77
+ const has_more = safeOffset + slice.length < items.length;
78
+ return {
79
+ total: items.length,
80
+ count: slice.length,
81
+ offset: safeOffset,
82
+ has_more,
83
+ next_offset: has_more ? safeOffset + slice.length : null,
84
+ items: slice,
85
+ };
86
+ }
87
+ /**
88
+ * Wrap an already-server-sliced page (`$top`/`$skip`) in the same `Page<T>`
89
+ * envelope `paginate()` produces, using the server's `@odata.count` as `total`.
90
+ *
91
+ * `has_more` is derived from `offset + count < total`, never from
92
+ * `count === limit` — the latter is off by one whenever the last page happens
93
+ * to be exactly `limit` long.
94
+ *
95
+ * Only call this when every active filter was expressed in `$filter`.
96
+ * `@odata.count` counts post-filter rows; if a filter ran client-side, `total`
97
+ * would exceed what the caller can actually reach and `has_more` would promise
98
+ * pages that come back empty. Fall back to `paginate()` over a full fetch in
99
+ * that case.
100
+ */
101
+ export function pageFromServer(items, total, offset) {
102
+ const safeOffset = Math.max(0, offset);
103
+ // A server total below what we already hold means the collection shrank
104
+ // between the count and the slice; trust the rows we actually have.
105
+ const safeTotal = Math.max(total, safeOffset + items.length);
106
+ const has_more = safeOffset + items.length < safeTotal;
107
+ return {
108
+ total: safeTotal,
109
+ count: items.length,
110
+ offset: safeOffset,
111
+ has_more,
112
+ next_offset: has_more ? safeOffset + items.length : null,
113
+ items: [...items],
114
+ };
115
+ }
116
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerCreateChore: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=create-chore.d.ts.map
@@ -0,0 +1,93 @@
1
+ import { z } from "zod";
2
+ import { actionResponse } from "../format.js";
3
+ import { MutationResultSchema } from "../schemas/items.js";
4
+ import { WRITE } from "../annotations.js";
5
+ import { defineTool } from "../define-tool.js";
6
+ // TM1's chore endpoint rejects DateTimeOffset strings without a UTC marker. If the caller
7
+ // omits the offset we append 'Z' and report it back so they can fix the input upstream.
8
+ function coerceUtc(iso) {
9
+ const hasOffset = /(?:Z|[+-]\d{2}:?\d{2})$/.test(iso);
10
+ return hasOffset
11
+ ? { value: iso, coerced: false }
12
+ : { value: `${iso}Z`, coerced: true };
13
+ }
14
+ const ChoreStepSchema = z.object({
15
+ process: z.string().describe("TI process name"),
16
+ parameters: z
17
+ .array(z.object({
18
+ name: z.string(),
19
+ value: z.union([z.string(), z.number()]),
20
+ }))
21
+ .optional()
22
+ .default([]),
23
+ });
24
+ export const registerCreateChore = defineTool({
25
+ name: "tm1_create_chore",
26
+ description: [
27
+ "Create a new TM1 chore with a schedule and list of TI processes to run.",
28
+ "Fails if a chore with the same name already exists; use tm1_update_chore for idempotent edits.",
29
+ "After: tm1_toggle_chore to activate scheduling, tm1_execute_chore to run immediately.",
30
+ ],
31
+ annotations: WRITE,
32
+ output: MutationResultSchema,
33
+ input: {
34
+ choreName: z.string().describe("Chore name"),
35
+ startTime: z
36
+ .string()
37
+ .describe("Start time in ISO 8601 format with timezone (Z or ±HH:MM). If no offset is given, UTC ('Z') is auto-appended. Example: '2025-01-01T06:00:00Z'."),
38
+ active: z
39
+ .boolean()
40
+ .optional()
41
+ .default(false)
42
+ .describe("Whether to activate the chore immediately (default: false)"),
43
+ dstSensitive: z
44
+ .boolean()
45
+ .optional()
46
+ .default(true)
47
+ .describe("Whether the schedule adjusts for daylight saving time (default: true)"),
48
+ executionMode: z
49
+ .enum(["SingleCommit", "MultipleCommit"])
50
+ .optional()
51
+ .default("MultipleCommit")
52
+ .describe("SingleCommit: the chore commits once at the end. MultipleCommit: each step commits independently. " +
53
+ "Measured (12.5.9): the mode changes only how far a ProcessRollback reaches — under SingleCommit it discards everything the chore wrote up to that point, under MultipleCommit only the rolling-back step. " +
54
+ "Under NEITHER mode does a failing step stop the chore: later steps still run and still commit."),
55
+ frequency: z
56
+ .object({
57
+ days: z.number().int().min(0).default(1),
58
+ hours: z.number().int().min(0).max(23).default(0),
59
+ minutes: z.number().int().min(0).max(59).default(0),
60
+ seconds: z.number().int().min(0).max(59).default(0),
61
+ })
62
+ .describe("How often the chore runs"),
63
+ steps: z
64
+ .array(ChoreStepSchema)
65
+ .min(1)
66
+ .describe("Ordered list of TI processes to execute"),
67
+ },
68
+ handler: async ({ choreName, startTime, active, dstSensitive, executionMode, frequency, steps, }, tm1Client) => {
69
+ const { value: normalizedStartTime, coerced } = coerceUtc(startTime);
70
+ await tm1Client.chores.create({
71
+ name: choreName,
72
+ startTime: normalizedStartTime,
73
+ active,
74
+ dstSensitive,
75
+ executionMode,
76
+ frequency,
77
+ steps,
78
+ });
79
+ return actionResponse({
80
+ success: true,
81
+ name: choreName,
82
+ stepCount: steps.length,
83
+ active,
84
+ startTime: normalizedStartTime,
85
+ ...(coerced
86
+ ? {
87
+ warning: `startTime had no timezone offset; auto-appended 'Z' → '${normalizedStartTime}'. Pass an explicit offset to silence this.`,
88
+ }
89
+ : {}),
90
+ });
91
+ },
92
+ });
93
+ //# sourceMappingURL=create-chore.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerDeleteChore: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=delete-chore.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ import { CONFIRM_SCHEMA, requireConfirm } from "../confirm.js";
3
+ import { actionResponse } from "../format.js";
4
+ import { DESTRUCTIVE } from "../annotations.js";
5
+ import { MutationResultSchema } from "../schemas/items.js";
6
+ import { defineTool } from "../define-tool.js";
7
+ export const registerDeleteChore = defineTool({
8
+ name: "tm1_delete_chore",
9
+ description: "Delete a TM1 chore permanently. Irreversible — pass confirm=<chore name verbatim>.",
10
+ annotations: DESTRUCTIVE,
11
+ output: MutationResultSchema,
12
+ input: {
13
+ choreName: z.string().describe("Chore name (case-sensitive)"),
14
+ ...CONFIRM_SCHEMA,
15
+ },
16
+ handler: async ({ choreName, confirm }, tm1Client) => {
17
+ requireConfirm(confirm, choreName, "chore");
18
+ await tm1Client.chores.delete(choreName);
19
+ return actionResponse({ success: true, choreName });
20
+ },
21
+ });
22
+ //# sourceMappingURL=delete-chore.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerExecuteChore: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=execute-chore.d.ts.map
@@ -0,0 +1,52 @@
1
+ import { z } from "zod";
2
+ import { CONFIRM_SCHEMA, requireConfirm } from "../confirm.js";
3
+ import { DESTRUCTIVE } from "../annotations.js";
4
+ import { ChoreResultSchema } from "../schemas/items.js";
5
+ import { defineTool } from "../define-tool.js";
6
+ export const registerExecuteChore = defineTool({
7
+ name: "tm1_execute_chore",
8
+ description: [
9
+ "Execute a TM1 chore immediately, bypassing its schedule. Runs synchronously — the call returns when the chore is done, so raise timeoutMs for long chains.",
10
+ "Non-idempotent: runs every chained process. Before: tm1_analyze_chore_graph to preview the call chain.",
11
+ "Chores do NOT stop at a failing step (measured): later steps still run and still commit. Read `outcome`, not `success` alone — `completed_with_errors` means a step failed AND the chore's writes were committed, so re-running duplicates them. A step that aborts commits inside a chore, unlike the same process run on its own.",
12
+ "`rolled_back` (ChoreExecuteStatusCode ProcessRollbackCalled) discards the whole chore so far under ExecutionMode SingleCommit, only the rolling-back step under MultipleCommit.",
13
+ "`statusUnavailable: true` means the server cannot report chore status (v11, and v12 before 12.5.0): the chore ran, the outcome is unknown.",
14
+ "On failure: tm1_diagnose_process_error for the failing step.",
15
+ ],
16
+ annotations: DESTRUCTIVE,
17
+ output: ChoreResultSchema,
18
+ input: {
19
+ choreName: z.string().describe("Chore name (case-sensitive)"),
20
+ timeoutMs: z
21
+ .number()
22
+ .int()
23
+ .min(1000)
24
+ .max(3600000)
25
+ .optional()
26
+ .describe("Override the default 30s request timeout for this call (ms, 1000–3600000). Use for chores running long TI chains."),
27
+ ...CONFIRM_SCHEMA,
28
+ },
29
+ handler: async ({ choreName, timeoutMs, confirm }, tm1Client, extra) => {
30
+ // Runs every chained process; undoing the call does not undo the writes.
31
+ // Guards against accidental invocation — not a security control.
32
+ requireConfirm(confirm, choreName, "chore");
33
+ const result = await tm1Client.chores.execute(choreName, {
34
+ signal: extra?.signal,
35
+ ...(timeoutMs ? { timeoutMs } : {}),
36
+ });
37
+ return {
38
+ content: [{ type: "text", text: JSON.stringify(result) }],
39
+ // Same rule as tm1_execute_process: a chore that ran and reported failure
40
+ // is a tool failure, not a successful call carrying success:false.
41
+ //
42
+ // `statusUnavailable` is the exception and must NOT flag. It also has
43
+ // success:false, but it means "this build cannot report chore status" —
44
+ // on v11 that is EVERY chore run. Flagging it would turn a known API
45
+ // limitation into an error on every single call.
46
+ ...(result.success === false && result.statusUnavailable !== true
47
+ ? { isError: true }
48
+ : {}),
49
+ };
50
+ },
51
+ });
52
+ //# sourceMappingURL=execute-chore.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerToggleChore: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=toggle-chore.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ import { actionResponse } from "../format.js";
3
+ import { IDEMPOTENT_WRITE } from "../annotations.js";
4
+ import { MutationResultSchema } from "../schemas/items.js";
5
+ import { defineTool } from "../define-tool.js";
6
+ export const registerToggleChore = defineTool({
7
+ name: "tm1_toggle_chore",
8
+ description: "Activate or deactivate a TM1 chore (enable/disable its schedule).",
9
+ annotations: IDEMPOTENT_WRITE,
10
+ output: MutationResultSchema,
11
+ input: {
12
+ choreName: z.string().describe("Chore name (case-sensitive)"),
13
+ active: z
14
+ .boolean()
15
+ .describe("true to activate scheduling, false to deactivate"),
16
+ },
17
+ handler: async ({ choreName, active }, tm1Client) => {
18
+ await tm1Client.chores.toggleActive(choreName, active);
19
+ return actionResponse({ success: true, choreName, active });
20
+ },
21
+ });
22
+ //# sourceMappingURL=toggle-chore.js.map
@@ -0,0 +1,2 @@
1
+ export declare const registerUpdateChore: import("../define-tool.js").ToolRegistrar;
2
+ //# sourceMappingURL=update-chore.d.ts.map
@@ -0,0 +1,71 @@
1
+ import { z } from "zod";
2
+ import { actionResponse } from "../format.js";
3
+ import { IDEMPOTENT_WRITE } from "../annotations.js";
4
+ import { MutationResultSchema } from "../schemas/items.js";
5
+ import { defineTool } from "../define-tool.js";
6
+ export const registerUpdateChore = defineTool({
7
+ name: "tm1_update_chore",
8
+ description: "Update an existing TM1 chore. Only the provided fields are changed.",
9
+ annotations: IDEMPOTENT_WRITE,
10
+ output: MutationResultSchema,
11
+ input: {
12
+ choreName: z.string().describe("Chore name (case-sensitive)"),
13
+ startTime: z
14
+ .string()
15
+ .optional()
16
+ .describe("New start time in ISO 8601 format"),
17
+ active: z
18
+ .boolean()
19
+ .optional()
20
+ .describe("Enable or disable the chore schedule"),
21
+ dstSensitive: z
22
+ .boolean()
23
+ .optional()
24
+ .describe("Adjust for daylight saving time"),
25
+ executionMode: z.enum(["SingleCommit", "MultipleCommit"]).optional(),
26
+ frequency: z
27
+ .object({
28
+ days: z.number().int().min(0),
29
+ hours: z.number().int().min(0).max(23),
30
+ minutes: z.number().int().min(0).max(59),
31
+ seconds: z.number().int().min(0).max(59),
32
+ })
33
+ .optional(),
34
+ steps: z
35
+ .array(z.object({
36
+ process: z.string(),
37
+ parameters: z
38
+ .array(z.object({
39
+ name: z.string(),
40
+ value: z.union([z.string(), z.number()]),
41
+ }))
42
+ .optional()
43
+ .default([]),
44
+ }))
45
+ .optional()
46
+ .describe("Replace all steps (full replacement, not partial)"),
47
+ },
48
+ handler: async ({ choreName, ...updates }, tm1Client) => {
49
+ let coerced = false;
50
+ if (updates.startTime !== undefined &&
51
+ !/(?:Z|[+-]\d{2}:?\d{2})$/.test(updates.startTime)) {
52
+ updates.startTime = `${updates.startTime}Z`;
53
+ coerced = true;
54
+ }
55
+ await tm1Client.chores.update(choreName, updates);
56
+ const payload = {
57
+ success: true,
58
+ choreName,
59
+ ...(updates.startTime !== undefined
60
+ ? { startTime: updates.startTime }
61
+ : {}),
62
+ ...(coerced
63
+ ? {
64
+ warning: `startTime had no timezone offset; auto-appended 'Z' → '${updates.startTime}'. Pass an explicit offset to silence this.`,
65
+ }
66
+ : {}),
67
+ };
68
+ return actionResponse(payload);
69
+ },
70
+ });
71
+ //# sourceMappingURL=update-chore.js.map
@@ -0,0 +1,10 @@
1
+ import { z, type ZodTypeAny } from "zod";
2
+ export declare function pageShapeFor<T extends ZodTypeAny>(itemSchema: T): {
3
+ total: z.ZodNumber;
4
+ count: z.ZodNumber;
5
+ offset: z.ZodNumber;
6
+ has_more: z.ZodBoolean;
7
+ next_offset: z.ZodNullable<z.ZodNumber>;
8
+ items: z.ZodArray<T>;
9
+ };
10
+ //# sourceMappingURL=common.d.ts.map