@langwatch/server 3.1.0-beta.4 → 3.1.0-beta.6

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 (328) hide show
  1. package/langwatch/ee/admin/ImpersonationBanner.tsx +61 -0
  2. package/langwatch/ee/admin/ImpersonationSwitchBackMenuItem.tsx +30 -0
  3. package/langwatch/ee/admin/__tests__/ImpersonationBanner.integration.test.tsx +82 -0
  4. package/langwatch/ee/admin/__tests__/impersonation.service.unit.test.ts +231 -0
  5. package/langwatch/ee/admin/backoffice/BackofficeTable.tsx +200 -0
  6. package/langwatch/ee/admin/backoffice/__tests__/adminClient.unit.test.ts +147 -0
  7. package/langwatch/ee/admin/backoffice/__tests__/dateInputToISO.unit.test.ts +42 -0
  8. package/langwatch/ee/admin/backoffice/__tests__/userVisibility.unit.test.ts +174 -0
  9. package/langwatch/ee/admin/backoffice/adminClient.ts +114 -0
  10. package/langwatch/ee/admin/backoffice/resources/OrganizationFeaturesView.tsx +373 -0
  11. package/langwatch/ee/admin/backoffice/resources/OrganizationsView.tsx +677 -0
  12. package/langwatch/ee/admin/backoffice/resources/ProjectsView.tsx +647 -0
  13. package/langwatch/ee/admin/backoffice/resources/SubscriptionsView.tsx +628 -0
  14. package/langwatch/ee/admin/backoffice/resources/UsersView.tsx +556 -0
  15. package/langwatch/ee/admin/backoffice/useAdminResource.ts +104 -0
  16. package/langwatch/ee/admin/backoffice/userVisibility.ts +105 -0
  17. package/langwatch/ee/admin/impersonation.service.ts +170 -0
  18. package/langwatch/ee/admin/isAdmin.ts +9 -0
  19. package/langwatch/ee/admin/routes/admin.ts +531 -0
  20. package/langwatch/ee/admin/safeSelects.ts +64 -0
  21. package/langwatch/ee/billing/__tests__/customerService.unit.test.ts +183 -0
  22. package/langwatch/ee/billing/__tests__/growthSeatEvent.unit.test.ts +213 -0
  23. package/langwatch/ee/billing/__tests__/licensePurchaseHandler.unit.test.ts +250 -0
  24. package/langwatch/ee/billing/__tests__/notification.service.unit.test.ts +768 -0
  25. package/langwatch/ee/billing/__tests__/planLimits.unit.test.ts +19 -0
  26. package/langwatch/ee/billing/__tests__/planProvider.unit.test.ts +440 -0
  27. package/langwatch/ee/billing/__tests__/planTypes.unit.test.ts +32 -0
  28. package/langwatch/ee/billing/__tests__/pricing.unit.test.ts +54 -0
  29. package/langwatch/ee/billing/__tests__/seatEventSubscription.unit.test.ts +717 -0
  30. package/langwatch/ee/billing/__tests__/stripe.integration.test.ts +344 -0
  31. package/langwatch/ee/billing/__tests__/stripePrices.types.unit.test.ts +27 -0
  32. package/langwatch/ee/billing/__tests__/stripePricesLoader.unit.test.ts +72 -0
  33. package/langwatch/ee/billing/__tests__/subscription.service.unit.test.ts +730 -0
  34. package/langwatch/ee/billing/__tests__/subscriptionItemCalculator.unit.test.ts +176 -0
  35. package/langwatch/ee/billing/__tests__/usage-limit.service.unit.test.ts +706 -0
  36. package/langwatch/ee/billing/__tests__/usageReportingService.integration.test.ts +421 -0
  37. package/langwatch/ee/billing/__tests__/usageReportingService.unit.test.ts +515 -0
  38. package/langwatch/ee/billing/__tests__/webhookService.unit.test.ts +958 -0
  39. package/langwatch/ee/billing/currencyRouter.ts +18 -0
  40. package/langwatch/ee/billing/errors.ts +129 -0
  41. package/langwatch/ee/billing/index.ts +67 -0
  42. package/langwatch/ee/billing/middleware.ts +17 -0
  43. package/langwatch/ee/billing/notifications/notification.service.ts +651 -0
  44. package/langwatch/ee/billing/notifications/repositories/notification.repository.ts +51 -0
  45. package/langwatch/ee/billing/notifications/types.ts +9 -0
  46. package/langwatch/ee/billing/notifications/usage-limit.service.ts +622 -0
  47. package/langwatch/ee/billing/nurturing/hooks/activityTracking.ts +90 -0
  48. package/langwatch/ee/billing/nurturing/hooks/activityTracking.unit.test.ts +237 -0
  49. package/langwatch/ee/billing/nurturing/hooks/featureAdoption.ts +120 -0
  50. package/langwatch/ee/billing/nurturing/hooks/featureAdoption.unit.test.ts +324 -0
  51. package/langwatch/ee/billing/nurturing/hooks/index.ts +17 -0
  52. package/langwatch/ee/billing/nurturing/hooks/productInterest.ts +68 -0
  53. package/langwatch/ee/billing/nurturing/hooks/productInterest.unit.test.ts +138 -0
  54. package/langwatch/ee/billing/nurturing/hooks/promptCreation.integration.test.ts +288 -0
  55. package/langwatch/ee/billing/nurturing/hooks/promptCreation.ts +131 -0
  56. package/langwatch/ee/billing/nurturing/hooks/promptCreation.unit.test.ts +134 -0
  57. package/langwatch/ee/billing/nurturing/hooks/signupIdentification.ts +101 -0
  58. package/langwatch/ee/billing/nurturing/hooks/signupIdentification.unit.test.ts +317 -0
  59. package/langwatch/ee/billing/nurturing/hooks/subscriptionSync.ts +49 -0
  60. package/langwatch/ee/billing/nurturing/hooks/subscriptionSync.unit.test.ts +170 -0
  61. package/langwatch/ee/billing/nurturing/hooks/userSync.ts +143 -0
  62. package/langwatch/ee/billing/nurturing/hooks/userSync.unit.test.ts +307 -0
  63. package/langwatch/ee/billing/nurturing/nurturing.service.ts +179 -0
  64. package/langwatch/ee/billing/nurturing/nurturing.service.unit.test.ts +266 -0
  65. package/langwatch/ee/billing/nurturing/nurturing.service.wiring.unit.test.ts +109 -0
  66. package/langwatch/ee/billing/nurturing/types.ts +125 -0
  67. package/langwatch/ee/billing/planLimits.ts +190 -0
  68. package/langwatch/ee/billing/planProvider.ts +119 -0
  69. package/langwatch/ee/billing/planTypes.ts +53 -0
  70. package/langwatch/ee/billing/pricing.ts +57 -0
  71. package/langwatch/ee/billing/services/billableEventsQuery.ts +248 -0
  72. package/langwatch/ee/billing/services/customerService.ts +90 -0
  73. package/langwatch/ee/billing/services/licensePurchaseHandler.ts +73 -0
  74. package/langwatch/ee/billing/services/seatEventSubscription.ts +351 -0
  75. package/langwatch/ee/billing/services/seatSyncService.ts +34 -0
  76. package/langwatch/ee/billing/services/subscription.repository.ts +203 -0
  77. package/langwatch/ee/billing/services/subscription.service.ts +549 -0
  78. package/langwatch/ee/billing/services/subscriptionItemCalculator.ts +249 -0
  79. package/langwatch/ee/billing/services/usageReportingService.ts +301 -0
  80. package/langwatch/ee/billing/services/webhookService.ts +858 -0
  81. package/langwatch/ee/billing/stripe/stripeCatalog.json +1781 -0
  82. package/langwatch/ee/billing/stripe/stripeClient.ts +13 -0
  83. package/langwatch/ee/billing/stripe/stripePriceCatalog.ts +70 -0
  84. package/langwatch/ee/billing/stripe/stripePrices.types.ts +118 -0
  85. package/langwatch/ee/billing/subscriptionRouter.ts +202 -0
  86. package/langwatch/ee/billing/types.ts +102 -0
  87. package/langwatch/ee/billing/utils/currency.ts +99 -0
  88. package/langwatch/ee/billing/utils/growthSeatEvent.ts +137 -0
  89. package/langwatch/ee/licensing/__tests__/constants.unit.test.ts +56 -0
  90. package/langwatch/ee/licensing/__tests__/defaults.unit.test.ts +192 -0
  91. package/langwatch/ee/licensing/__tests__/fixtures/testKeys.ts +86 -0
  92. package/langwatch/ee/licensing/__tests__/fixtures/testLicenses.ts +92 -0
  93. package/langwatch/ee/licensing/__tests__/licenseGenerationService.unit.test.ts +232 -0
  94. package/langwatch/ee/licensing/__tests__/licenseHandler.integration.test.ts +419 -0
  95. package/langwatch/ee/licensing/__tests__/planMapping.unit.test.ts +195 -0
  96. package/langwatch/ee/licensing/__tests__/planTemplates.unit.test.ts +193 -0
  97. package/langwatch/ee/licensing/__tests__/signing.unit.test.ts +164 -0
  98. package/langwatch/ee/licensing/__tests__/validation.unit.test.ts +281 -0
  99. package/langwatch/ee/licensing/client.ts +29 -0
  100. package/langwatch/ee/licensing/constants.ts +195 -0
  101. package/langwatch/ee/licensing/defaults.ts +55 -0
  102. package/langwatch/ee/licensing/errors.ts +11 -0
  103. package/langwatch/ee/licensing/index.ts +52 -0
  104. package/langwatch/ee/licensing/licenseGenerationService.ts +87 -0
  105. package/langwatch/ee/licensing/licenseHandler.ts +308 -0
  106. package/langwatch/ee/licensing/planInfo.ts +46 -0
  107. package/langwatch/ee/licensing/planMapping.ts +37 -0
  108. package/langwatch/ee/licensing/planTemplates.ts +109 -0
  109. package/langwatch/ee/licensing/server.ts +43 -0
  110. package/langwatch/ee/licensing/signing.ts +43 -0
  111. package/langwatch/ee/licensing/types.ts +156 -0
  112. package/langwatch/ee/licensing/validation.ts +107 -0
  113. package/langwatch/ee/managed-providers/ManagedModelProviderAlert.tsx +29 -0
  114. package/langwatch/ee/managed-providers/managedBedrockConfig.ts +226 -0
  115. package/langwatch/ee/saas/ExtraFooterComponents.tsx +169 -0
  116. package/langwatch/package.json +1 -1
  117. package/langwatch/pnpm-workspace.yaml +0 -1
  118. package/mcp-server/.env.example +2 -0
  119. package/mcp-server/.eslintrc.cjs +36 -0
  120. package/mcp-server/CHANGELOG.md +165 -0
  121. package/mcp-server/CONTRIBUTING.md +96 -0
  122. package/mcp-server/README.md +172 -0
  123. package/mcp-server/dist/archive-scenario-WJ2A7ETN.js +19 -0
  124. package/mcp-server/dist/archive-suite-4JOM4SSL.js +15 -0
  125. package/mcp-server/dist/assign-prompt-tag-GL7EAAF3.js +19 -0
  126. package/mcp-server/dist/chunk-2GT7IFWK.js +40 -0
  127. package/mcp-server/dist/chunk-2WPLXEKF.js +127 -0
  128. package/mcp-server/dist/chunk-4AUB2BIA.js +71 -0
  129. package/mcp-server/dist/chunk-BWWY5KEF.js +71 -0
  130. package/mcp-server/dist/chunk-CCWCIJJ3.js +22 -0
  131. package/mcp-server/dist/chunk-EGH5RPXM.js +25 -0
  132. package/mcp-server/dist/chunk-EUQDVOSU.js +39 -0
  133. package/mcp-server/dist/chunk-HYMIWO3U.js +44 -0
  134. package/mcp-server/dist/chunk-IE4M5OGE.js +42 -0
  135. package/mcp-server/dist/chunk-LUMEZEHL.js +48 -0
  136. package/mcp-server/dist/chunk-NUFPTHKU.js +9 -0
  137. package/mcp-server/dist/chunk-UDHJYT6P.js +1567 -0
  138. package/mcp-server/dist/chunk-WQG2DFHX.js +86 -0
  139. package/mcp-server/dist/chunk-WVI5CJ6S.js +21 -0
  140. package/mcp-server/dist/chunk-ZVS4UKN2.js +35 -0
  141. package/mcp-server/dist/chunk-ZXKLPC2E.js +27 -0
  142. package/mcp-server/dist/config.d.ts +17 -0
  143. package/mcp-server/dist/config.js +13 -0
  144. package/mcp-server/dist/create-agent-MBOOT3XK.js +23 -0
  145. package/mcp-server/dist/create-annotation-XMV6A7ED.js +24 -0
  146. package/mcp-server/dist/create-dashboard-VRKLFVZJ.js +18 -0
  147. package/mcp-server/dist/create-dataset-7HQPZCRE.js +22 -0
  148. package/mcp-server/dist/create-dataset-records-2NIVFYTV.js +22 -0
  149. package/mcp-server/dist/create-evaluator-WYFRFLRC.js +27 -0
  150. package/mcp-server/dist/create-mcp-server.d.ts +8 -0
  151. package/mcp-server/dist/create-mcp-server.js +8 -0
  152. package/mcp-server/dist/create-prompt-IEN7O6JT.js +39 -0
  153. package/mcp-server/dist/create-prompt-tag-CAEZ45VO.js +17 -0
  154. package/mcp-server/dist/create-scenario-6YHSMGLP.js +26 -0
  155. package/mcp-server/dist/create-suite-H5XOFDE5.js +38 -0
  156. package/mcp-server/dist/delete-agent-JKTNBWAA.js +18 -0
  157. package/mcp-server/dist/delete-annotation-ACMDV6QO.js +17 -0
  158. package/mcp-server/dist/delete-dashboard-VJSR7CRU.js +18 -0
  159. package/mcp-server/dist/delete-dataset-RTTTWP4D.js +20 -0
  160. package/mcp-server/dist/delete-dataset-records-KNQTIPQK.js +21 -0
  161. package/mcp-server/dist/delete-evaluator-7FVC5WM4.js +15 -0
  162. package/mcp-server/dist/delete-prompt-tag-ZMZUAGFW.js +17 -0
  163. package/mcp-server/dist/delete-workflow-EYQ3T4RQ.js +17 -0
  164. package/mcp-server/dist/discover-evaluator-schema-H23XCLNE.js +1402 -0
  165. package/mcp-server/dist/discover-scenario-schema-MEEEVND7.js +65 -0
  166. package/mcp-server/dist/discover-schema-3T52ORPB.js +446 -0
  167. package/mcp-server/dist/get-agent-E3QSTVKG.js +28 -0
  168. package/mcp-server/dist/get-analytics-2OHV763I.js +72 -0
  169. package/mcp-server/dist/get-dashboard-PC7JDHH6.js +29 -0
  170. package/mcp-server/dist/get-dataset-H5IK5FVU.js +48 -0
  171. package/mcp-server/dist/get-evaluator-UWVUPYTM.js +47 -0
  172. package/mcp-server/dist/get-prompt-WZUOLLQC.js +45 -0
  173. package/mcp-server/dist/get-scenario-Q6LCNUYN.js +33 -0
  174. package/mcp-server/dist/get-simulation-run-Z2XKO256.js +56 -0
  175. package/mcp-server/dist/get-suite-BXK5TN7P.js +44 -0
  176. package/mcp-server/dist/get-trace-4EJAYVBG.js +50 -0
  177. package/mcp-server/dist/get-workflow-O34QJLHD.js +25 -0
  178. package/mcp-server/dist/http-server-RSTXN4CN.js +224 -0
  179. package/mcp-server/dist/index.d.ts +2 -0
  180. package/mcp-server/dist/index.js +67774 -0
  181. package/mcp-server/dist/langwatch-api-annotations-ERBG27RF.js +17 -0
  182. package/mcp-server/dist/langwatch-api-dashboards-G6TR7VVO.js +17 -0
  183. package/mcp-server/dist/langwatch-api-monitors-WSXZLS2B.js +52 -0
  184. package/mcp-server/dist/langwatch-api-secrets-RR5DKG2X.js +40 -0
  185. package/mcp-server/dist/langwatch-api-triggers-2RTNSWQY.js +30 -0
  186. package/mcp-server/dist/langwatch-api-workflows-VJRIIDZ7.js +15 -0
  187. package/mcp-server/dist/list-agents-AW3P6FJV.js +32 -0
  188. package/mcp-server/dist/list-annotations-QNCGWPQ3.js +33 -0
  189. package/mcp-server/dist/list-dashboards-R7RK2IXL.js +32 -0
  190. package/mcp-server/dist/list-dataset-records-WVCSQP7P.js +39 -0
  191. package/mcp-server/dist/list-datasets-KEXRLDEU.js +60 -0
  192. package/mcp-server/dist/list-evaluators-7R2LB4JH.js +34 -0
  193. package/mcp-server/dist/list-model-providers-OBYJCKBX.js +35 -0
  194. package/mcp-server/dist/list-prompt-tags-6LY3ZPYI.js +23 -0
  195. package/mcp-server/dist/list-prompts-VWEZ4CDE.js +32 -0
  196. package/mcp-server/dist/list-scenarios-TXD4W2ZJ.js +40 -0
  197. package/mcp-server/dist/list-simulation-runs-RHPOLMFI.js +43 -0
  198. package/mcp-server/dist/list-suites-FSGBX27Z.js +42 -0
  199. package/mcp-server/dist/list-workflows-VRGEZ3EN.js +35 -0
  200. package/mcp-server/dist/rename-prompt-tag-VOJJLX4M.js +18 -0
  201. package/mcp-server/dist/run-agent-KTCC7TB7.js +36 -0
  202. package/mcp-server/dist/run-evaluation-2X3V3Q6L.js +64 -0
  203. package/mcp-server/dist/run-suite-BTMHGI2D.js +29 -0
  204. package/mcp-server/dist/run-workflow-IGAYGKJL.js +36 -0
  205. package/mcp-server/dist/search-traces-VYFUIMXH.js +72 -0
  206. package/mcp-server/dist/set-model-provider-W5IUI326.js +33 -0
  207. package/mcp-server/dist/update-agent-4BB7EYLR.js +20 -0
  208. package/mcp-server/dist/update-dataset-CXBKZ4W3.js +22 -0
  209. package/mcp-server/dist/update-dataset-record-HOHAMHXG.js +19 -0
  210. package/mcp-server/dist/update-evaluator-IVOR6FTR.js +24 -0
  211. package/mcp-server/dist/update-prompt-OWQAKE7K.js +24 -0
  212. package/mcp-server/dist/update-scenario-GDFVILPN.js +27 -0
  213. package/mcp-server/dist/update-suite-BXYUYSPT.js +39 -0
  214. package/mcp-server/package.json +79 -0
  215. package/mcp-server/pnpm-lock.yaml +6103 -0
  216. package/mcp-server/pnpm-workspace.yaml +2 -0
  217. package/mcp-server/pyproject.toml +17 -0
  218. package/mcp-server/src/__tests__/all-tools.integration.test.ts +1681 -0
  219. package/mcp-server/src/__tests__/config.unit.test.ts +169 -0
  220. package/mcp-server/src/__tests__/datasets.integration.test.ts +603 -0
  221. package/mcp-server/src/__tests__/datasets.unit.test.ts +240 -0
  222. package/mcp-server/src/__tests__/date-parsing.unit.test.ts +78 -0
  223. package/mcp-server/src/__tests__/discover-evaluator-schema.unit.test.ts +89 -0
  224. package/mcp-server/src/__tests__/discover-schema.unit.test.ts +118 -0
  225. package/mcp-server/src/__tests__/docker.integration.test.ts +234 -0
  226. package/mcp-server/src/__tests__/evaluator-tools.unit.test.ts +262 -0
  227. package/mcp-server/src/__tests__/http-transport.integration.test.ts +397 -0
  228. package/mcp-server/src/__tests__/integration.integration.test.ts +288 -0
  229. package/mcp-server/src/__tests__/langwatch-api.unit.test.ts +455 -0
  230. package/mcp-server/src/__tests__/model-provider-tools.unit.test.ts +190 -0
  231. package/mcp-server/src/__tests__/scenario-tools.integration.test.ts +286 -0
  232. package/mcp-server/src/__tests__/scenario-tools.unit.test.ts +185 -0
  233. package/mcp-server/src/__tests__/schemas.unit.test.ts +85 -0
  234. package/mcp-server/src/__tests__/tools.unit.test.ts +900 -0
  235. package/mcp-server/src/config.d.ts +15 -0
  236. package/mcp-server/src/config.ts +107 -0
  237. package/mcp-server/src/create-mcp-server.d.ts +6 -0
  238. package/mcp-server/src/create-mcp-server.ts +1799 -0
  239. package/mcp-server/src/http-server.ts +329 -0
  240. package/mcp-server/src/index.ts +46 -0
  241. package/mcp-server/src/langwatch-api-agents.ts +108 -0
  242. package/mcp-server/src/langwatch-api-annotations.ts +49 -0
  243. package/mcp-server/src/langwatch-api-dashboards.ts +48 -0
  244. package/mcp-server/src/langwatch-api-datasets.ts +191 -0
  245. package/mcp-server/src/langwatch-api-evaluators.ts +80 -0
  246. package/mcp-server/src/langwatch-api-model-providers.ts +41 -0
  247. package/mcp-server/src/langwatch-api-monitors.ts +82 -0
  248. package/mcp-server/src/langwatch-api-scenarios.ts +67 -0
  249. package/mcp-server/src/langwatch-api-secrets.ts +48 -0
  250. package/mcp-server/src/langwatch-api-simulation-runs.ts +51 -0
  251. package/mcp-server/src/langwatch-api-suites.ts +118 -0
  252. package/mcp-server/src/langwatch-api-triggers.ts +48 -0
  253. package/mcp-server/src/langwatch-api-workflows.ts +41 -0
  254. package/mcp-server/src/langwatch-api.ts +299 -0
  255. package/mcp-server/src/schemas/analytics-groups.ts +78 -0
  256. package/mcp-server/src/schemas/analytics-metrics.ts +179 -0
  257. package/mcp-server/src/schemas/create-dataset.ts +48 -0
  258. package/mcp-server/src/schemas/filter-fields.ts +119 -0
  259. package/mcp-server/src/schemas/index.ts +4 -0
  260. package/mcp-server/src/tools/archive-scenario.ts +19 -0
  261. package/mcp-server/src/tools/archive-suite.ts +12 -0
  262. package/mcp-server/src/tools/assign-prompt-tag.ts +16 -0
  263. package/mcp-server/src/tools/create-agent.ts +15 -0
  264. package/mcp-server/src/tools/create-annotation.ts +18 -0
  265. package/mcp-server/src/tools/create-dashboard.ts +7 -0
  266. package/mcp-server/src/tools/create-dataset-records.ts +23 -0
  267. package/mcp-server/src/tools/create-dataset.ts +22 -0
  268. package/mcp-server/src/tools/create-evaluator.ts +33 -0
  269. package/mcp-server/src/tools/create-prompt-tag.ts +12 -0
  270. package/mcp-server/src/tools/create-prompt.ts +58 -0
  271. package/mcp-server/src/tools/create-scenario.ts +30 -0
  272. package/mcp-server/src/tools/create-suite.ts +42 -0
  273. package/mcp-server/src/tools/delete-agent.ts +7 -0
  274. package/mcp-server/src/tools/delete-annotation.ts +7 -0
  275. package/mcp-server/src/tools/delete-dashboard.ts +7 -0
  276. package/mcp-server/src/tools/delete-dataset-records.ts +22 -0
  277. package/mcp-server/src/tools/delete-dataset.ts +20 -0
  278. package/mcp-server/src/tools/delete-evaluator.ts +12 -0
  279. package/mcp-server/src/tools/delete-prompt-tag.ts +12 -0
  280. package/mcp-server/src/tools/delete-workflow.ts +7 -0
  281. package/mcp-server/src/tools/discover-evaluator-schema.ts +143 -0
  282. package/mcp-server/src/tools/discover-scenario-schema.ts +71 -0
  283. package/mcp-server/src/tools/discover-schema.ts +106 -0
  284. package/mcp-server/src/tools/format-dataset-mutation.ts +25 -0
  285. package/mcp-server/src/tools/get-agent.ts +21 -0
  286. package/mcp-server/src/tools/get-analytics.ts +98 -0
  287. package/mcp-server/src/tools/get-dashboard.ts +22 -0
  288. package/mcp-server/src/tools/get-dataset.ts +63 -0
  289. package/mcp-server/src/tools/get-evaluator.ts +53 -0
  290. package/mcp-server/src/tools/get-prompt.ts +54 -0
  291. package/mcp-server/src/tools/get-scenario.ts +36 -0
  292. package/mcp-server/src/tools/get-simulation-run.ts +60 -0
  293. package/mcp-server/src/tools/get-suite.ts +47 -0
  294. package/mcp-server/src/tools/get-trace.ts +61 -0
  295. package/mcp-server/src/tools/get-workflow.ts +17 -0
  296. package/mcp-server/src/tools/list-agents.ts +27 -0
  297. package/mcp-server/src/tools/list-annotations.ts +33 -0
  298. package/mcp-server/src/tools/list-dashboards.ts +27 -0
  299. package/mcp-server/src/tools/list-dataset-records.ts +46 -0
  300. package/mcp-server/src/tools/list-datasets.ts +80 -0
  301. package/mcp-server/src/tools/list-evaluators.ts +37 -0
  302. package/mcp-server/src/tools/list-model-providers.ts +40 -0
  303. package/mcp-server/src/tools/list-prompt-tags.ts +21 -0
  304. package/mcp-server/src/tools/list-prompts.ts +34 -0
  305. package/mcp-server/src/tools/list-scenarios.ts +47 -0
  306. package/mcp-server/src/tools/list-simulation-runs.ts +49 -0
  307. package/mcp-server/src/tools/list-suites.ts +43 -0
  308. package/mcp-server/src/tools/list-workflows.ts +31 -0
  309. package/mcp-server/src/tools/rename-prompt-tag.ts +14 -0
  310. package/mcp-server/src/tools/run-agent.ts +36 -0
  311. package/mcp-server/src/tools/run-evaluation.ts +87 -0
  312. package/mcp-server/src/tools/run-suite.ts +28 -0
  313. package/mcp-server/src/tools/run-workflow.ts +36 -0
  314. package/mcp-server/src/tools/search-traces.ts +91 -0
  315. package/mcp-server/src/tools/set-model-provider.ts +46 -0
  316. package/mcp-server/src/tools/update-agent.ts +13 -0
  317. package/mcp-server/src/tools/update-dataset-record.ts +21 -0
  318. package/mcp-server/src/tools/update-dataset.ts +23 -0
  319. package/mcp-server/src/tools/update-evaluator.ts +30 -0
  320. package/mcp-server/src/tools/update-prompt.ts +31 -0
  321. package/mcp-server/src/tools/update-scenario.ts +32 -0
  322. package/mcp-server/src/tools/update-suite.ts +44 -0
  323. package/mcp-server/src/utils/date-parsing.ts +31 -0
  324. package/mcp-server/src/utils/escape-markdown.ts +12 -0
  325. package/mcp-server/tsconfig.json +27 -0
  326. package/mcp-server/uv.lock +2731 -0
  327. package/package.json +2 -1
  328. package/packages/server/dist/cli.cjs +1 -1
@@ -0,0 +1,191 @@
1
+ import { makeRequest } from "./langwatch-api.js";
2
+
3
+ // --- Dataset types ---
4
+
5
+ export interface DatasetColumnType {
6
+ name: string;
7
+ type: string;
8
+ }
9
+
10
+ export interface DatasetSummary {
11
+ id: string;
12
+ name: string;
13
+ slug: string;
14
+ columnTypes: DatasetColumnType[];
15
+ recordCount?: number;
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ }
19
+
20
+ export interface DatasetListResponse {
21
+ data: DatasetSummary[];
22
+ pagination: {
23
+ total: number;
24
+ page: number;
25
+ limit: number;
26
+ totalPages: number;
27
+ };
28
+ }
29
+
30
+ export interface DatasetRecord {
31
+ id: string;
32
+ entry: Record<string, unknown>;
33
+ }
34
+
35
+ export interface DatasetDetailResponse {
36
+ id: string;
37
+ name: string;
38
+ slug: string;
39
+ columnTypes: DatasetColumnType[];
40
+ createdAt: string;
41
+ updatedAt: string;
42
+ data: DatasetRecord[];
43
+ }
44
+
45
+ export interface DatasetMutationResponse {
46
+ id: string;
47
+ name: string;
48
+ slug: string;
49
+ columnTypes: DatasetColumnType[];
50
+ createdAt: string;
51
+ updatedAt: string;
52
+ }
53
+
54
+ export interface DatasetArchiveResponse {
55
+ id: string;
56
+ archived: boolean;
57
+ }
58
+
59
+ export interface BatchCreateRecordsResponse {
60
+ data: DatasetRecord[];
61
+ }
62
+
63
+ export interface DeleteRecordsResponse {
64
+ deletedCount: number;
65
+ }
66
+
67
+ export interface DatasetRecordListResponse {
68
+ data: DatasetRecord[];
69
+ pagination: {
70
+ total: number;
71
+ page: number;
72
+ limit: number;
73
+ totalPages: number;
74
+ };
75
+ }
76
+
77
+ // --- Dataset API functions ---
78
+
79
+ /** Lists all datasets in the project (paginated). */
80
+ export async function listDatasets(params?: {
81
+ page?: number;
82
+ limit?: number;
83
+ }): Promise<DatasetListResponse> {
84
+ const query = new URLSearchParams();
85
+ if (params?.page != null) query.set("page", String(params.page));
86
+ if (params?.limit != null) query.set("limit", String(params.limit));
87
+ const qs = query.toString();
88
+ const path = qs ? `/api/dataset?${qs}` : "/api/dataset";
89
+ return makeRequest("GET", path) as Promise<DatasetListResponse>;
90
+ }
91
+
92
+ /** Retrieves a single dataset by slug or ID, including records. */
93
+ export async function getDataset(
94
+ slugOrId: string,
95
+ ): Promise<DatasetDetailResponse> {
96
+ return makeRequest(
97
+ "GET",
98
+ `/api/dataset/${encodeURIComponent(slugOrId)}`,
99
+ ) as Promise<DatasetDetailResponse>;
100
+ }
101
+
102
+ /** Creates a new dataset. */
103
+ export async function createDataset(data: {
104
+ name: string;
105
+ columnTypes?: DatasetColumnType[];
106
+ }): Promise<DatasetMutationResponse> {
107
+ return makeRequest(
108
+ "POST",
109
+ "/api/dataset",
110
+ data,
111
+ ) as Promise<DatasetMutationResponse>;
112
+ }
113
+
114
+ /** Updates an existing dataset by slug or ID. */
115
+ export async function updateDataset(params: {
116
+ slugOrId: string;
117
+ name?: string;
118
+ columnTypes?: DatasetColumnType[];
119
+ }): Promise<DatasetMutationResponse> {
120
+ const { slugOrId, ...data } = params;
121
+ return makeRequest(
122
+ "PATCH",
123
+ `/api/dataset/${encodeURIComponent(slugOrId)}`,
124
+ data,
125
+ ) as Promise<DatasetMutationResponse>;
126
+ }
127
+
128
+ /** Archives (soft-deletes) a dataset by slug or ID. */
129
+ export async function deleteDataset(
130
+ slugOrId: string,
131
+ ): Promise<DatasetArchiveResponse> {
132
+ return makeRequest(
133
+ "DELETE",
134
+ `/api/dataset/${encodeURIComponent(slugOrId)}`,
135
+ ) as Promise<DatasetArchiveResponse>;
136
+ }
137
+
138
+ /** Creates records in a dataset in batch. */
139
+ export async function createDatasetRecords(params: {
140
+ slugOrId: string;
141
+ entries: Record<string, unknown>[];
142
+ }): Promise<BatchCreateRecordsResponse> {
143
+ const { slugOrId, entries } = params;
144
+ return makeRequest(
145
+ "POST",
146
+ `/api/dataset/${encodeURIComponent(slugOrId)}/records`,
147
+ { entries },
148
+ ) as Promise<BatchCreateRecordsResponse>;
149
+ }
150
+
151
+ /** Updates or creates a single record in a dataset. */
152
+ export async function updateDatasetRecord(params: {
153
+ slugOrId: string;
154
+ recordId: string;
155
+ entry: Record<string, unknown>;
156
+ }): Promise<DatasetRecord> {
157
+ const { slugOrId, recordId, entry } = params;
158
+ return makeRequest(
159
+ "PATCH",
160
+ `/api/dataset/${encodeURIComponent(slugOrId)}/records/${encodeURIComponent(recordId)}`,
161
+ { entry },
162
+ ) as Promise<DatasetRecord>;
163
+ }
164
+
165
+ /** Deletes records from a dataset by IDs. */
166
+ export async function deleteDatasetRecords(params: {
167
+ slugOrId: string;
168
+ recordIds: string[];
169
+ }): Promise<DeleteRecordsResponse> {
170
+ const { slugOrId, recordIds } = params;
171
+ return makeRequest(
172
+ "DELETE",
173
+ `/api/dataset/${encodeURIComponent(slugOrId)}/records`,
174
+ { recordIds },
175
+ ) as Promise<DeleteRecordsResponse>;
176
+ }
177
+
178
+ /** Lists records in a dataset (paginated). */
179
+ export async function listDatasetRecords(params: {
180
+ slugOrId: string;
181
+ page?: number;
182
+ limit?: number;
183
+ }): Promise<DatasetRecordListResponse> {
184
+ const { slugOrId } = params;
185
+ const query = new URLSearchParams();
186
+ if (params.page != null) query.set("page", String(params.page));
187
+ if (params.limit != null) query.set("limit", String(params.limit));
188
+ const qs = query.toString();
189
+ const path = `/api/dataset/${encodeURIComponent(slugOrId)}/records${qs ? `?${qs}` : ""}`;
190
+ return makeRequest("GET", path) as Promise<DatasetRecordListResponse>;
191
+ }
@@ -0,0 +1,80 @@
1
+ import { makeRequest } from "./langwatch-api.js";
2
+
3
+ // --- Evaluator types ---
4
+
5
+ export interface EvaluatorSummary {
6
+ id: string;
7
+ projectId: string;
8
+ name: string;
9
+ slug: string | null;
10
+ type: string;
11
+ config: Record<string, unknown> | null;
12
+ workflowId: string | null;
13
+ copiedFromEvaluatorId: string | null;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ fields: Array<{ identifier: string; type: string; optional?: boolean }>;
17
+ outputFields: Array<{ identifier: string; type: string; optional?: boolean }>;
18
+ workflowName?: string;
19
+ workflowIcon?: string;
20
+ }
21
+
22
+ // --- Helpers ---
23
+
24
+ /**
25
+ * Extracts the evaluatorType from an evaluator's config.
26
+ * Centralises the cast so callers don't repeat it.
27
+ */
28
+ export function getEvaluatorType(
29
+ evaluator: Pick<EvaluatorSummary, "config">,
30
+ ): string | undefined {
31
+ return (evaluator.config as Record<string, unknown> | null)
32
+ ?.evaluatorType as string | undefined;
33
+ }
34
+
35
+ // --- Evaluator API functions ---
36
+
37
+ /** Lists all evaluators in the project. */
38
+ export async function listEvaluators(): Promise<EvaluatorSummary[]> {
39
+ return makeRequest("GET", "/api/evaluators") as Promise<EvaluatorSummary[]>;
40
+ }
41
+
42
+ /** Retrieves a single evaluator by ID or slug. */
43
+ export async function getEvaluator(idOrSlug: string): Promise<EvaluatorSummary> {
44
+ return makeRequest(
45
+ "GET",
46
+ `/api/evaluators/${encodeURIComponent(idOrSlug)}`,
47
+ ) as Promise<EvaluatorSummary>;
48
+ }
49
+
50
+ /** Creates a new evaluator. */
51
+ export async function createEvaluator(data: {
52
+ name: string;
53
+ config: Record<string, unknown>;
54
+ }): Promise<EvaluatorSummary> {
55
+ return makeRequest("POST", "/api/evaluators", data) as Promise<EvaluatorSummary>;
56
+ }
57
+
58
+ /** Updates an existing evaluator. */
59
+ export async function updateEvaluator(params: {
60
+ id: string;
61
+ name?: string;
62
+ config?: Record<string, unknown>;
63
+ }): Promise<EvaluatorSummary> {
64
+ const { id, ...data } = params;
65
+ return makeRequest(
66
+ "PUT",
67
+ `/api/evaluators/${encodeURIComponent(id)}`,
68
+ data,
69
+ ) as Promise<EvaluatorSummary>;
70
+ }
71
+
72
+ /** Archives (soft-deletes) an evaluator. */
73
+ export async function deleteEvaluator(
74
+ idOrSlug: string,
75
+ ): Promise<{ id: string; archived: boolean }> {
76
+ return makeRequest(
77
+ "DELETE",
78
+ `/api/evaluators/${encodeURIComponent(idOrSlug)}`,
79
+ ) as Promise<{ id: string; archived: boolean }>;
80
+ }
@@ -0,0 +1,41 @@
1
+ import { makeRequest } from "./langwatch-api.js";
2
+
3
+ // --- Model Provider types ---
4
+
5
+ export interface ModelProviderEntry {
6
+ id?: string;
7
+ provider: string;
8
+ enabled: boolean;
9
+ customKeys: Record<string, unknown> | null;
10
+ models?: string[] | null;
11
+ embeddingsModels?: string[] | null;
12
+ customModels?: unknown[] | null;
13
+ customEmbeddingsModels?: unknown[] | null;
14
+ disabledByDefault?: boolean;
15
+ deploymentMapping?: unknown;
16
+ extraHeaders?: Array<{ key: string; value: string }> | null;
17
+ }
18
+
19
+ // --- Model Provider API functions ---
20
+
21
+ /** Lists all model providers for the project, with masked API keys. */
22
+ export async function listModelProviders(): Promise<Record<string, ModelProviderEntry>> {
23
+ return makeRequest("GET", "/api/model-providers") as Promise<
24
+ Record<string, ModelProviderEntry>
25
+ >;
26
+ }
27
+
28
+ /** Creates or updates a model provider. */
29
+ export async function setModelProvider(params: {
30
+ provider: string;
31
+ enabled: boolean;
32
+ customKeys?: Record<string, unknown>;
33
+ defaultModel?: string;
34
+ }): Promise<Record<string, ModelProviderEntry>> {
35
+ const { provider, ...data } = params;
36
+ return makeRequest(
37
+ "PUT",
38
+ `/api/model-providers/${encodeURIComponent(provider)}`,
39
+ data,
40
+ ) as Promise<Record<string, ModelProviderEntry>>;
41
+ }
@@ -0,0 +1,82 @@
1
+ import { makeRequest } from "./langwatch-api.js";
2
+
3
+ export interface MonitorSummary {
4
+ id: string;
5
+ name: string;
6
+ slug: string;
7
+ checkType: string;
8
+ enabled: boolean;
9
+ executionMode: string;
10
+ sample: number;
11
+ level: string;
12
+ evaluatorId: string | null;
13
+ preconditions: unknown;
14
+ parameters: unknown;
15
+ mappings: unknown;
16
+ threadIdleTimeout: number | null;
17
+ createdAt: string;
18
+ updatedAt: string;
19
+ }
20
+
21
+ export async function listMonitors(): Promise<MonitorSummary[]> {
22
+ return makeRequest("GET", "/api/monitors") as Promise<MonitorSummary[]>;
23
+ }
24
+
25
+ export async function getMonitor(id: string): Promise<MonitorSummary> {
26
+ return makeRequest(
27
+ "GET",
28
+ `/api/monitors/${encodeURIComponent(id)}`
29
+ ) as Promise<MonitorSummary>;
30
+ }
31
+
32
+ export async function createMonitor(data: {
33
+ name: string;
34
+ checkType: string;
35
+ executionMode?: string;
36
+ sample?: number;
37
+ evaluatorId?: string;
38
+ level?: string;
39
+ parameters?: Record<string, unknown>;
40
+ }): Promise<MonitorSummary> {
41
+ return makeRequest("POST", "/api/monitors", {
42
+ ...data,
43
+ preconditions: [],
44
+ parameters: data.parameters ?? {},
45
+ }) as Promise<MonitorSummary>;
46
+ }
47
+
48
+ export async function updateMonitor(params: {
49
+ id: string;
50
+ name?: string;
51
+ enabled?: boolean;
52
+ executionMode?: string;
53
+ sample?: number;
54
+ parameters?: Record<string, unknown>;
55
+ }): Promise<MonitorSummary> {
56
+ const { id, ...data } = params;
57
+ return makeRequest(
58
+ "PATCH",
59
+ `/api/monitors/${encodeURIComponent(id)}`,
60
+ data
61
+ ) as Promise<MonitorSummary>;
62
+ }
63
+
64
+ export async function toggleMonitor(params: {
65
+ id: string;
66
+ enabled: boolean;
67
+ }): Promise<{ id: string; enabled: boolean }> {
68
+ return makeRequest(
69
+ "POST",
70
+ `/api/monitors/${encodeURIComponent(params.id)}/toggle`,
71
+ { enabled: params.enabled }
72
+ ) as Promise<{ id: string; enabled: boolean }>;
73
+ }
74
+
75
+ export async function deleteMonitor(
76
+ id: string
77
+ ): Promise<{ id: string; deleted: boolean }> {
78
+ return makeRequest(
79
+ "DELETE",
80
+ `/api/monitors/${encodeURIComponent(id)}`
81
+ ) as Promise<{ id: string; deleted: boolean }>;
82
+ }
@@ -0,0 +1,67 @@
1
+ import { makeRequest } from "./langwatch-api.js";
2
+
3
+ // --- Scenario types ---
4
+
5
+ export interface ScenarioSummary {
6
+ id: string;
7
+ name: string;
8
+ situation: string;
9
+ criteria: string[];
10
+ labels: string[];
11
+ }
12
+
13
+ export interface ScenarioArchiveResponse {
14
+ id: string;
15
+ archived: boolean;
16
+ }
17
+
18
+ // --- Scenario API functions ---
19
+
20
+ /** Lists all scenarios in the project. */
21
+ export async function listScenarios(): Promise<ScenarioSummary[]> {
22
+ return makeRequest("GET", "/api/scenarios") as Promise<ScenarioSummary[]>;
23
+ }
24
+
25
+ /** Retrieves a single scenario by ID. */
26
+ export async function getScenario(id: string): Promise<ScenarioSummary> {
27
+ return makeRequest(
28
+ "GET",
29
+ `/api/scenarios/${encodeURIComponent(id)}`
30
+ ) as Promise<ScenarioSummary>;
31
+ }
32
+
33
+ /** Creates a new scenario. */
34
+ export async function createScenario(data: {
35
+ name: string;
36
+ situation: string;
37
+ criteria?: string[];
38
+ labels?: string[];
39
+ }): Promise<ScenarioSummary> {
40
+ return makeRequest("POST", "/api/scenarios", data) as Promise<ScenarioSummary>;
41
+ }
42
+
43
+ /** Updates an existing scenario. */
44
+ export async function updateScenario(params: {
45
+ id: string;
46
+ name?: string;
47
+ situation?: string;
48
+ criteria?: string[];
49
+ labels?: string[];
50
+ }): Promise<ScenarioSummary> {
51
+ const { id, ...data } = params;
52
+ return makeRequest(
53
+ "PUT",
54
+ `/api/scenarios/${encodeURIComponent(id)}`,
55
+ data
56
+ ) as Promise<ScenarioSummary>;
57
+ }
58
+
59
+ /** Archives (soft-deletes) a scenario. */
60
+ export async function archiveScenario(
61
+ id: string
62
+ ): Promise<ScenarioArchiveResponse> {
63
+ return makeRequest(
64
+ "DELETE",
65
+ `/api/scenarios/${encodeURIComponent(id)}`
66
+ ) as Promise<ScenarioArchiveResponse>;
67
+ }
@@ -0,0 +1,48 @@
1
+ import { makeRequest } from "./langwatch-api.js";
2
+
3
+ export interface SecretSummary {
4
+ id: string;
5
+ projectId: string;
6
+ name: string;
7
+ createdAt: string;
8
+ updatedAt: string;
9
+ }
10
+
11
+ export async function listSecrets(): Promise<SecretSummary[]> {
12
+ return makeRequest("GET", "/api/secrets") as Promise<SecretSummary[]>;
13
+ }
14
+
15
+ export async function getSecret(id: string): Promise<SecretSummary> {
16
+ return makeRequest(
17
+ "GET",
18
+ `/api/secrets/${encodeURIComponent(id)}`
19
+ ) as Promise<SecretSummary>;
20
+ }
21
+
22
+ export async function createSecret(data: {
23
+ name: string;
24
+ value: string;
25
+ }): Promise<SecretSummary> {
26
+ return makeRequest("POST", "/api/secrets", data) as Promise<SecretSummary>;
27
+ }
28
+
29
+ export async function updateSecret(params: {
30
+ id: string;
31
+ value: string;
32
+ }): Promise<SecretSummary> {
33
+ const { id, value } = params;
34
+ return makeRequest(
35
+ "PUT",
36
+ `/api/secrets/${encodeURIComponent(id)}`,
37
+ { value }
38
+ ) as Promise<SecretSummary>;
39
+ }
40
+
41
+ export async function deleteSecret(
42
+ id: string
43
+ ): Promise<{ id: string; deleted: boolean }> {
44
+ return makeRequest(
45
+ "DELETE",
46
+ `/api/secrets/${encodeURIComponent(id)}`
47
+ ) as Promise<{ id: string; deleted: boolean }>;
48
+ }
@@ -0,0 +1,51 @@
1
+ import { makeRequest } from "./langwatch-api.js";
2
+
3
+ export interface SimulationRunSummary {
4
+ scenarioRunId: string;
5
+ scenarioId: string;
6
+ batchRunId: string;
7
+ name: string | null;
8
+ status: string;
9
+ durationInMs: number;
10
+ totalCost?: number;
11
+ results?: {
12
+ verdict?: string | null;
13
+ reasoning?: string | null;
14
+ metCriteria?: string[];
15
+ unmetCriteria?: string[];
16
+ error?: string | null;
17
+ } | null;
18
+ messages?: Array<{ role: string; content: string }>;
19
+ timestamp: number;
20
+ updatedAt: number;
21
+ }
22
+
23
+ export interface SimulationRunListResponse {
24
+ runs: SimulationRunSummary[];
25
+ hasMore?: boolean;
26
+ nextCursor?: string;
27
+ }
28
+
29
+ /** Lists simulation runs, optionally filtered by scenario set or batch. */
30
+ export async function listSimulationRuns(params?: {
31
+ scenarioSetId?: string;
32
+ batchRunId?: string;
33
+ limit?: number;
34
+ }): Promise<SimulationRunListResponse> {
35
+ const query = new URLSearchParams();
36
+ if (params?.scenarioSetId) query.set("scenarioSetId", params.scenarioSetId);
37
+ if (params?.batchRunId) query.set("batchRunId", params.batchRunId);
38
+ if (params?.limit) query.set("limit", String(params.limit));
39
+ const qs = query.toString() ? `?${query}` : "";
40
+ return makeRequest("GET", `/api/simulation-runs${qs}`) as Promise<SimulationRunListResponse>;
41
+ }
42
+
43
+ /** Gets a single simulation run by its ID. */
44
+ export async function getSimulationRun(
45
+ scenarioRunId: string,
46
+ ): Promise<SimulationRunSummary> {
47
+ return makeRequest(
48
+ "GET",
49
+ `/api/simulation-runs/${encodeURIComponent(scenarioRunId)}`,
50
+ ) as Promise<SimulationRunSummary>;
51
+ }
@@ -0,0 +1,118 @@
1
+ import { makeRequest } from "./langwatch-api.js";
2
+
3
+ // --- Suite types ---
4
+
5
+ export interface SuiteTarget {
6
+ type: "prompt" | "http" | "code" | "workflow";
7
+ referenceId: string;
8
+ }
9
+
10
+ export interface SuiteSummary {
11
+ id: string;
12
+ name: string;
13
+ slug: string;
14
+ description: string | null;
15
+ scenarioIds: string[];
16
+ targets: SuiteTarget[];
17
+ repeatCount: number;
18
+ labels: string[];
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ }
22
+
23
+ export interface SuiteRunResult {
24
+ scheduled: boolean;
25
+ batchRunId: string;
26
+ setId: string;
27
+ jobCount: number;
28
+ skippedArchived: {
29
+ scenarios: string[];
30
+ targets: string[];
31
+ };
32
+ items: Array<{
33
+ scenarioRunId: string;
34
+ scenarioId: string;
35
+ target: SuiteTarget;
36
+ name: string | null;
37
+ }>;
38
+ }
39
+
40
+ export interface SuiteArchiveResponse {
41
+ id: string;
42
+ archived: boolean;
43
+ }
44
+
45
+ // --- Suite API functions ---
46
+
47
+ /** Lists all suites (run plans) in the project. */
48
+ export async function listSuites(): Promise<SuiteSummary[]> {
49
+ return makeRequest("GET", "/api/suites") as Promise<SuiteSummary[]>;
50
+ }
51
+
52
+ /** Retrieves a single suite by ID. */
53
+ export async function getSuite(id: string): Promise<SuiteSummary> {
54
+ return makeRequest(
55
+ "GET",
56
+ `/api/suites/${encodeURIComponent(id)}`
57
+ ) as Promise<SuiteSummary>;
58
+ }
59
+
60
+ /** Creates a new suite. */
61
+ export async function createSuite(data: {
62
+ name: string;
63
+ description?: string;
64
+ scenarioIds: string[];
65
+ targets: SuiteTarget[];
66
+ repeatCount?: number;
67
+ labels?: string[];
68
+ }): Promise<SuiteSummary> {
69
+ return makeRequest("POST", "/api/suites", data) as Promise<SuiteSummary>;
70
+ }
71
+
72
+ /** Updates an existing suite. */
73
+ export async function updateSuite(params: {
74
+ id: string;
75
+ name?: string;
76
+ description?: string | null;
77
+ scenarioIds?: string[];
78
+ targets?: SuiteTarget[];
79
+ repeatCount?: number;
80
+ labels?: string[];
81
+ }): Promise<SuiteSummary> {
82
+ const { id, ...data } = params;
83
+ return makeRequest(
84
+ "PATCH",
85
+ `/api/suites/${encodeURIComponent(id)}`,
86
+ data
87
+ ) as Promise<SuiteSummary>;
88
+ }
89
+
90
+ /** Duplicates a suite. */
91
+ export async function duplicateSuite(id: string): Promise<SuiteSummary> {
92
+ return makeRequest(
93
+ "POST",
94
+ `/api/suites/${encodeURIComponent(id)}/duplicate`
95
+ ) as Promise<SuiteSummary>;
96
+ }
97
+
98
+ /** Triggers a suite run. */
99
+ export async function runSuite(
100
+ id: string,
101
+ idempotencyKey?: string
102
+ ): Promise<SuiteRunResult> {
103
+ return makeRequest(
104
+ "POST",
105
+ `/api/suites/${encodeURIComponent(id)}/run`,
106
+ { idempotencyKey: idempotencyKey ?? `mcp-${Date.now()}-${Math.random().toString(36).slice(2)}` }
107
+ ) as Promise<SuiteRunResult>;
108
+ }
109
+
110
+ /** Archives (soft-deletes) a suite. */
111
+ export async function archiveSuite(
112
+ id: string
113
+ ): Promise<SuiteArchiveResponse> {
114
+ return makeRequest(
115
+ "DELETE",
116
+ `/api/suites/${encodeURIComponent(id)}`
117
+ ) as Promise<SuiteArchiveResponse>;
118
+ }