@langwatch/mcp-server 2.2.0 → 3.1.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 (253) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/add-dashboard-widget-3IE3W5RR.js +46 -0
  3. package/dist/add-dashboard-widget-XNAIGV37.js +45 -0
  4. package/dist/{archive-project-KWFM3I5Z.js → archive-project-LAWWNKTX.js} +4 -4
  5. package/dist/{archive-project-SPVHXK6A.js → archive-project-X64627XS.js} +4 -4
  6. package/dist/{archive-run-plan-Z4SYE6BP.js → archive-run-plan-3HKFL5MS.js} +4 -4
  7. package/dist/{archive-run-plan-65QN3XRX.js → archive-run-plan-C35EJACZ.js} +4 -4
  8. package/dist/{archive-scenario-A6QV5LOW.js → archive-scenario-3DOXHOJJ.js} +4 -4
  9. package/dist/{archive-scenario-FXEYQNEH.js → archive-scenario-7KDGEZM5.js} +4 -4
  10. package/dist/{archive-test-suite-NKZDZY3D.js → archive-test-suite-KZOESY2Y.js} +4 -4
  11. package/dist/{archive-test-suite-5ADQ3KPQ.js → archive-test-suite-RPJ6ZKBV.js} +4 -4
  12. package/dist/{assign-prompt-tag-5IUZXJ2T.js → assign-prompt-tag-2A25CXB7.js} +3 -3
  13. package/dist/{assign-prompt-tag-HBZLBIFD.js → assign-prompt-tag-TQRV6D6V.js} +3 -3
  14. package/dist/{chunk-Y34DHR5K.js → chunk-27SS5FBC.js} +2 -2
  15. package/dist/chunk-2RLDGMPZ.js +79 -0
  16. package/dist/{chunk-VMWJD732.js → chunk-3GVTJ7NK.js} +2 -2
  17. package/dist/chunk-6DF65T3B.js +36 -0
  18. package/dist/{chunk-3OCG3QPU.js → chunk-6OLI3LFY.js} +2 -2
  19. package/dist/{chunk-B4J3PJLX.js → chunk-7HJSQOSZ.js} +2 -6
  20. package/dist/{chunk-UWLE5T2F.js → chunk-7MNQDTKJ.js} +46 -27
  21. package/dist/{chunk-I7ATIZED.js → chunk-BHCYKMRH.js} +2 -2
  22. package/dist/{chunk-H6WGMG2T.js → chunk-DULFP3MK.js} +1 -1
  23. package/dist/{chunk-NKMTIHIJ.js → chunk-FSU2ZBUM.js} +2 -2
  24. package/dist/{chunk-SXFC3FNH.js → chunk-I2Z5CBOU.js} +2 -2
  25. package/dist/{chunk-J7PQKBLD.js → chunk-JEMUBKLJ.js} +533 -402
  26. package/dist/{chunk-7VNSRCXO.js → chunk-JOFSQFCN.js} +2 -2
  27. package/dist/{chunk-HGELNIVY.js → chunk-JQN3VXPH.js} +3 -3
  28. package/dist/{chunk-UTJCWXPZ.js → chunk-LXBQK3J3.js} +2 -2
  29. package/dist/{chunk-JRJPH75H.js → chunk-MQRTYXHJ.js} +2 -2
  30. package/dist/{chunk-YCARO42Z.js → chunk-P2JRKSYI.js} +3 -3
  31. package/dist/{chunk-PTDR56Z3.js → chunk-QF7ZGYVI.js} +2 -2
  32. package/dist/{chunk-UNJM3BIL.js → chunk-QTAHHJH3.js} +2 -2
  33. package/dist/chunk-SLRQHMJZ.js +41 -0
  34. package/dist/{chunk-SUPUUC4W.js → chunk-YQWZ4CDN.js} +5 -3
  35. package/dist/{config-EAKW6F26.js → config-2WQGMAEN.js} +2 -2
  36. package/dist/config.js +1 -1
  37. package/dist/{create-agent-S5ZBCEFT.js → create-agent-IE7Q2Z4C.js} +4 -4
  38. package/dist/{create-agent-AYZ3LB3V.js → create-agent-JMCQ5WZC.js} +4 -4
  39. package/dist/create-analytics-report-4X5N7EOT.js +19 -0
  40. package/dist/create-analytics-report-IKWZRS2O.js +18 -0
  41. package/dist/{create-annotation-VUSXULQK.js → create-annotation-IZ53SJOX.js} +4 -4
  42. package/dist/{create-annotation-LHNCLHYP.js → create-annotation-JR6DBHPW.js} +4 -4
  43. package/dist/{create-api-key-T4KSNPKB.js → create-api-key-IKMOTWCD.js} +4 -4
  44. package/dist/{create-api-key-NNYKARMG.js → create-api-key-YUDAGOWL.js} +4 -4
  45. package/dist/{create-dataset-2MC4SD4O.js → create-dataset-54FJCX45.js} +4 -4
  46. package/dist/{create-dataset-LUP5PVDM.js → create-dataset-ONX3RADL.js} +4 -4
  47. package/dist/{create-dataset-records-W4GLN2FV.js → create-dataset-records-HPLMFDJY.js} +4 -4
  48. package/dist/{create-dataset-records-NSKBZP3G.js → create-dataset-records-QZZZF64Z.js} +4 -4
  49. package/dist/{create-evaluator-HMTYO5SS.js → create-evaluator-I5I52HOQ.js} +4 -4
  50. package/dist/{create-evaluator-643G6LXL.js → create-evaluator-L66QGSDX.js} +4 -4
  51. package/dist/create-mcp-server.cjs +851 -597
  52. package/dist/create-mcp-server.js +523 -392
  53. package/dist/{create-project-6N7PIYRY.js → create-project-UPZGETN5.js} +4 -4
  54. package/dist/{create-project-KAIC46UY.js → create-project-Y5EGJKDG.js} +4 -4
  55. package/dist/{create-prompt-PKJ7EDRR.js → create-prompt-RNUJOL25.js} +3 -3
  56. package/dist/{create-prompt-E67LXIYT.js → create-prompt-WGQLJASD.js} +3 -3
  57. package/dist/{create-prompt-tag-OPQUEXWB.js → create-prompt-tag-3ZCA7M7O.js} +3 -3
  58. package/dist/{create-prompt-tag-4YO3FSJ3.js → create-prompt-tag-R6KIAZTB.js} +3 -3
  59. package/dist/{create-scenario-UEM77OE7.js → create-scenario-WIMKZLQO.js} +4 -4
  60. package/dist/{create-scenario-5PJBMAXO.js → create-scenario-WO5NWXVQ.js} +4 -4
  61. package/dist/{create-test-suite-4IPXVSFQ.js → create-test-suite-AVSR7IIM.js} +4 -4
  62. package/dist/{create-test-suite-SZEPVXSE.js → create-test-suite-LRKCNIJA.js} +4 -4
  63. package/dist/{create-trigger-5HZSCRAN.js → create-trigger-CBO2XDYC.js} +4 -4
  64. package/dist/{create-trigger-PRELMT6J.js → create-trigger-M3VFK5UH.js} +4 -4
  65. package/dist/dashboards-4X6QUT3E.js +90 -0
  66. package/dist/dashboards-CX2T6RKH.js +91 -0
  67. package/dist/{delete-agent-QMEK3XHK.js → delete-agent-QUVDMSOC.js} +4 -4
  68. package/dist/{delete-agent-JUIZWAXG.js → delete-agent-Y4QTEQ3B.js} +4 -4
  69. package/dist/delete-analytics-report-T4GIMEOA.js +18 -0
  70. package/dist/delete-analytics-report-WIP24EXV.js +19 -0
  71. package/dist/{delete-annotation-VKIQWUYW.js → delete-annotation-BWO5ZEZY.js} +4 -4
  72. package/dist/{delete-annotation-HY3O2OGR.js → delete-annotation-ESUH3RWN.js} +4 -4
  73. package/dist/{delete-dataset-WKRUW4FP.js → delete-dataset-N4AEYIAA.js} +4 -4
  74. package/dist/{delete-dataset-HQCR66MG.js → delete-dataset-ZRD23FLO.js} +4 -4
  75. package/dist/{delete-dataset-records-SDUHQLLM.js → delete-dataset-records-HC7VLBT7.js} +4 -4
  76. package/dist/{delete-dataset-records-C2IQFFVQ.js → delete-dataset-records-XC2DFVXD.js} +4 -4
  77. package/dist/{delete-evaluator-QP3QHTLN.js → delete-evaluator-27P5XLNV.js} +4 -4
  78. package/dist/{delete-evaluator-4SNSCLEE.js → delete-evaluator-LJII4YLC.js} +4 -4
  79. package/dist/{delete-prompt-tag-YYQ4VMAD.js → delete-prompt-tag-DH7IQO4X.js} +3 -3
  80. package/dist/{delete-prompt-tag-NZ4JQMYG.js → delete-prompt-tag-OC57CN32.js} +3 -3
  81. package/dist/{delete-workflow-5J46T73T.js → delete-workflow-I4IXK3ZL.js} +4 -4
  82. package/dist/{delete-workflow-JSWABL5F.js → delete-workflow-JXREDDW7.js} +4 -4
  83. package/dist/{discover-schema-A33SLMXW.js → discover-schema-ME5BAD2S.js} +4 -4
  84. package/dist/{discover-schema-55YJBFGQ.js → discover-schema-OHYBG3CY.js} +4 -4
  85. package/dist/{get-agent-LJQX7OF4.js → get-agent-6GKIKKL7.js} +4 -4
  86. package/dist/{get-agent-OTIYUFZA.js → get-agent-UKZUBVPB.js} +4 -4
  87. package/dist/{get-analytics-IQZKJHLW.js → get-analytics-TI2U3JLA.js} +3 -3
  88. package/dist/{get-analytics-DCS72353.js → get-analytics-ZGQ4LY3I.js} +3 -3
  89. package/dist/get-analytics-report-PD6XZ4ZA.js +29 -0
  90. package/dist/get-analytics-report-QMXNQ7VA.js +30 -0
  91. package/dist/{get-dataset-ALSP7RTX.js → get-dataset-5QORNVOZ.js} +4 -4
  92. package/dist/{get-dataset-X4B5JDG2.js → get-dataset-E5WLIPNK.js} +4 -4
  93. package/dist/{get-evaluator-XEUZGZCH.js → get-evaluator-GYQFB4F3.js} +4 -4
  94. package/dist/{get-evaluator-ISMC4LLI.js → get-evaluator-QQV65MQB.js} +4 -4
  95. package/dist/{get-project-5VKROSDH.js → get-project-43SGQCAT.js} +4 -4
  96. package/dist/{get-project-RM6FRCBK.js → get-project-W5DCKXZP.js} +4 -4
  97. package/dist/{get-prompt-OWXJZHQQ.js → get-prompt-IUTPSRRI.js} +3 -3
  98. package/dist/{get-prompt-W52DY36E.js → get-prompt-ZTCWGYJV.js} +3 -3
  99. package/dist/{get-run-plan-BE3M2AUX.js → get-run-plan-M3LVXMGO.js} +4 -4
  100. package/dist/{get-run-plan-RUXQ6PAX.js → get-run-plan-MEPEU353.js} +4 -4
  101. package/dist/{get-scenario-RNM7BAX2.js → get-scenario-2DM4XR44.js} +4 -4
  102. package/dist/{get-scenario-YM4ODWW6.js → get-scenario-D6EPSSPW.js} +4 -4
  103. package/dist/{get-simulation-run-6GIATQE5.js → get-simulation-run-53WM2XOO.js} +4 -4
  104. package/dist/{get-simulation-run-LCFSMPGQ.js → get-simulation-run-RKQ52TKP.js} +4 -4
  105. package/dist/{get-test-suite-P5LJ6VLF.js → get-test-suite-DP2HNOQZ.js} +4 -4
  106. package/dist/{get-test-suite-GC2O7YH6.js → get-test-suite-MUSY2CDJ.js} +4 -4
  107. package/dist/{get-trace-SEF3FMR5.js → get-trace-5Z2BIZ3V.js} +3 -3
  108. package/dist/{get-trace-KBRVV4NN.js → get-trace-THPWSLD3.js} +3 -3
  109. package/dist/{get-workflow-YXULW4GC.js → get-workflow-63E7BNLY.js} +4 -4
  110. package/dist/{get-workflow-7PVED7JE.js → get-workflow-R6XUKTZ7.js} +4 -4
  111. package/dist/{http-server-IR4QOS43.js → http-server-4JHSQN56.js} +245 -45
  112. package/dist/index.js +1847 -899
  113. package/dist/langwatch-api-analytics-reports-IIHGTTQA.js +17 -0
  114. package/dist/langwatch-api-analytics-reports-IQ6CHM5Y.js +18 -0
  115. package/dist/{langwatch-api-annotations-TBHLCQ5R.js → langwatch-api-annotations-CN2KYV3Z.js} +4 -4
  116. package/dist/{langwatch-api-annotations-6SA4OB4C.js → langwatch-api-annotations-CRI6JTQR.js} +4 -4
  117. package/dist/{langwatch-api-monitors-CBF3FGIM.js → langwatch-api-monitors-66O5Z5LB.js} +3 -3
  118. package/dist/{langwatch-api-monitors-YNWA2M5Y.js → langwatch-api-monitors-GNHQRPMR.js} +3 -3
  119. package/dist/{langwatch-api-secrets-RNFO4LF2.js → langwatch-api-secrets-B7BURV76.js} +3 -3
  120. package/dist/{langwatch-api-secrets-ADTOJELP.js → langwatch-api-secrets-P6SHZOHE.js} +3 -3
  121. package/dist/{langwatch-api-triggers-KQDQC6L5.js → langwatch-api-triggers-6FR4VWDL.js} +4 -4
  122. package/dist/{langwatch-api-triggers-QS7HDIVW.js → langwatch-api-triggers-VKNGXSJH.js} +4 -4
  123. package/dist/langwatch-api-workflows-22RQFYO7.js +15 -0
  124. package/dist/{langwatch-api-workflows-OKC4FXIF.js → langwatch-api-workflows-KDACD36L.js} +4 -4
  125. package/dist/{list-agents-RBAOCF53.js → list-agents-SVXWLLO7.js} +4 -4
  126. package/dist/{list-agents-HVYWEQMI.js → list-agents-XM5JNCVK.js} +4 -4
  127. package/dist/list-analytics-reports-DEKKC6BU.js +32 -0
  128. package/dist/list-analytics-reports-E7QFC22G.js +33 -0
  129. package/dist/{list-annotations-J4UAHSUN.js → list-annotations-5CGNOIKI.js} +4 -4
  130. package/dist/{list-annotations-HJH4NBLD.js → list-annotations-P26ELIAO.js} +4 -4
  131. package/dist/{list-api-keys-A2PMV435.js → list-api-keys-B4YL7STE.js} +4 -4
  132. package/dist/{list-api-keys-7UTJRZDG.js → list-api-keys-ZIJJH755.js} +4 -4
  133. package/dist/list-dashboards-F4YJPDKD.js +29 -0
  134. package/dist/list-dashboards-XHYTXEQK.js +30 -0
  135. package/dist/{list-dataset-records-WFM7F33C.js → list-dataset-records-SWCEDRPX.js} +4 -4
  136. package/dist/{list-dataset-records-M5TKA6LK.js → list-dataset-records-YWGROVKC.js} +4 -4
  137. package/dist/{list-datasets-B5X4P7BQ.js → list-datasets-32SCF66H.js} +4 -4
  138. package/dist/{list-datasets-THUKQHPX.js → list-datasets-YYADWT4D.js} +4 -4
  139. package/dist/{list-evaluators-MYH2OVCI.js → list-evaluators-KKQKBJKN.js} +4 -4
  140. package/dist/{list-evaluators-NLVWF6K7.js → list-evaluators-V6LP6ZQA.js} +4 -4
  141. package/dist/{list-model-providers-3JUGP4YI.js → list-model-providers-RCPVT7R4.js} +4 -4
  142. package/dist/{list-model-providers-H3XKORFO.js → list-model-providers-TMBSB6EE.js} +4 -4
  143. package/dist/{list-projects-YNNSRMLC.js → list-projects-4Y74TFDZ.js} +4 -4
  144. package/dist/{list-projects-6EJ5YYEW.js → list-projects-R4MTRF3C.js} +4 -4
  145. package/dist/{list-prompt-tags-NVFQO6WX.js → list-prompt-tags-C345AGM2.js} +3 -3
  146. package/dist/{list-prompt-tags-XUQTTAH4.js → list-prompt-tags-RITKQDC5.js} +3 -3
  147. package/dist/{list-prompts-IRI6AIXO.js → list-prompts-DSJ2LUSU.js} +3 -3
  148. package/dist/{list-prompts-HSIMMHTF.js → list-prompts-F7C5L5XK.js} +3 -3
  149. package/dist/{list-run-plans-PX2XI6EK.js → list-run-plans-YPGLC5QG.js} +4 -4
  150. package/dist/{list-run-plans-QALLCN2K.js → list-run-plans-ZHRZHCDL.js} +4 -4
  151. package/dist/{list-scenarios-SSJQEMJP.js → list-scenarios-6HN72TMW.js} +4 -4
  152. package/dist/{list-scenarios-QZRPVHS4.js → list-scenarios-HCYFOTSL.js} +4 -4
  153. package/dist/{list-simulation-runs-OEADLLQR.js → list-simulation-runs-BKVMQQMT.js} +4 -4
  154. package/dist/{list-simulation-runs-KNOLGMDV.js → list-simulation-runs-JNST5PQU.js} +4 -4
  155. package/dist/{list-test-suites-N4WVLBKK.js → list-test-suites-4ZVYYKVB.js} +4 -4
  156. package/dist/{list-test-suites-ANAQBLDG.js → list-test-suites-YY4J3L7H.js} +4 -4
  157. package/dist/{list-trigger-fires-WTW4DVIW.js → list-trigger-fires-3XM6YZWG.js} +4 -4
  158. package/dist/{list-trigger-fires-JV3WFYYG.js → list-trigger-fires-5C5XM2KQ.js} +4 -4
  159. package/dist/{list-triggers-V4Y356AK.js → list-triggers-DARBIIRA.js} +4 -4
  160. package/dist/{list-triggers-SQNIG35Q.js → list-triggers-MRSWN7RR.js} +4 -4
  161. package/dist/{list-workflows-ZHTX5LCL.js → list-workflows-BGUSQUJX.js} +4 -4
  162. package/dist/{list-workflows-IMSX7SXU.js → list-workflows-NXOWP3XS.js} +4 -4
  163. package/dist/{rename-prompt-tag-IQI7MHOI.js → rename-prompt-tag-F3WT4FB4.js} +3 -3
  164. package/dist/{rename-prompt-tag-PA2BRIE6.js → rename-prompt-tag-HR5HZZI2.js} +3 -3
  165. package/dist/{rename-test-suite-NNVLMLKY.js → rename-test-suite-2ZRXG5O7.js} +4 -4
  166. package/dist/{rename-test-suite-4J7UX5S2.js → rename-test-suite-PWXKE7Z4.js} +4 -4
  167. package/dist/{report-issue-AS34ZMJF.js → report-issue-HG7XCPOY.js} +28 -2
  168. package/dist/{report-issue-DCZFLGDO.js → report-issue-TWRFUPGB.js} +28 -2
  169. package/dist/{rerun-run-plan-TG2V4WM4.js → rerun-run-plan-BFRZFEJB.js} +4 -4
  170. package/dist/{rerun-run-plan-ZI5OY3VA.js → rerun-run-plan-LXM3RFZC.js} +4 -4
  171. package/dist/{revoke-api-key-3J3ZA4UB.js → revoke-api-key-GR55PUP4.js} +4 -4
  172. package/dist/{revoke-api-key-SFMEFWJC.js → revoke-api-key-KCDOYPUK.js} +4 -4
  173. package/dist/{run-agent-YNV6ZHW4.js → run-agent-HRVRHRHI.js} +4 -4
  174. package/dist/{run-agent-W4VJP72Z.js → run-agent-WS6TADJQ.js} +4 -4
  175. package/dist/{run-plan-6C77GWG4.js → run-plan-G24DBB5D.js} +4 -4
  176. package/dist/{run-plan-PAARQSI4.js → run-plan-NSXMBEC5.js} +4 -4
  177. package/dist/{run-query-T4QW2Z5O.js → run-query-6YVOA5NV.js} +19 -5
  178. package/dist/{run-query-KJDH544C.js → run-query-7QIYSDVI.js} +19 -5
  179. package/dist/{run-test-suite-STB6NUJM.js → run-test-suite-NTKLJZCJ.js} +4 -4
  180. package/dist/{run-test-suite-SQJELEZX.js → run-test-suite-P33XFQ6H.js} +4 -4
  181. package/dist/{run-workflow-D6PQNBI6.js → run-workflow-E5ZRSXUB.js} +4 -4
  182. package/dist/{run-workflow-SP32SO5M.js → run-workflow-HDF6CRLM.js} +4 -4
  183. package/dist/{search-traces-HCBGOG6R.js → search-traces-X7NSRTTP.js} +3 -3
  184. package/dist/{search-traces-HSTQ6WTQ.js → search-traces-XWZYOZOM.js} +3 -3
  185. package/dist/{set-model-provider-GF7NXUJA.js → set-model-provider-XJF47L6H.js} +4 -4
  186. package/dist/{set-model-provider-KDQ7C4EZ.js → set-model-provider-YPUCFEXG.js} +4 -4
  187. package/dist/{update-agent-MXNOBS4H.js → update-agent-6FHGWOO7.js} +4 -4
  188. package/dist/{update-agent-DWG43T2P.js → update-agent-VEDXQRSM.js} +4 -4
  189. package/dist/update-dashboard-widget-VOKXN7JA.js +64 -0
  190. package/dist/update-dashboard-widget-VUIQZ7F5.js +63 -0
  191. package/dist/{update-dataset-SQZ6T4WX.js → update-dataset-7AQ24NRS.js} +4 -4
  192. package/dist/{update-dataset-DQH3OHOU.js → update-dataset-GHKDCJJQ.js} +4 -4
  193. package/dist/{update-dataset-record-3AT4IPBC.js → update-dataset-record-IRD6FH2C.js} +4 -4
  194. package/dist/{update-dataset-record-7PLDGTMR.js → update-dataset-record-ZZUPG7AS.js} +4 -4
  195. package/dist/{update-evaluator-4LFTKFPT.js → update-evaluator-O6EJFTQJ.js} +4 -4
  196. package/dist/{update-evaluator-IGTX6PX4.js → update-evaluator-PUJFU5LT.js} +4 -4
  197. package/dist/{update-project-PLJIOZS6.js → update-project-HO53IHXC.js} +4 -4
  198. package/dist/{update-project-QVHSJRUP.js → update-project-VTVU6KNP.js} +4 -4
  199. package/dist/{update-prompt-GDKRYJI3.js → update-prompt-FABVQCAC.js} +3 -3
  200. package/dist/{update-prompt-MY263DYF.js → update-prompt-MNRLCLBA.js} +3 -3
  201. package/dist/{update-scenario-MOHRQKAQ.js → update-scenario-MQZZM5CP.js} +4 -4
  202. package/dist/{update-scenario-7KA3JDXA.js → update-scenario-XIZNUH4I.js} +4 -4
  203. package/package.json +2 -2
  204. package/pyproject.toml +17 -2
  205. package/src/config.d.ts +2 -0
  206. package/src/config.ts +2 -0
  207. package/src/create-mcp-server.ts +165 -41
  208. package/src/langwatch-api-analytics-reports.ts +62 -0
  209. package/src/langwatch-api-dashboard-widgets.ts +4 -68
  210. package/src/langwatch-api-dashboards.ts +110 -28
  211. package/src/langwatch-api-projects.ts +0 -17
  212. package/src/langwatch-api-query.ts +6 -0
  213. package/src/langwatch-api.ts +60 -27
  214. package/src/schemas/widget-sources.ts +69 -0
  215. package/src/tools/add-dashboard-widget.ts +23 -32
  216. package/src/tools/create-analytics-report.ts +7 -0
  217. package/src/tools/dashboard-widget-queries.ts +22 -0
  218. package/src/tools/dashboards.ts +104 -0
  219. package/src/tools/delete-analytics-report.ts +7 -0
  220. package/src/tools/get-analytics-report.ts +23 -0
  221. package/src/tools/list-analytics-reports.ts +27 -0
  222. package/src/tools/list-dashboards.ts +20 -21
  223. package/src/tools/report-issue.ts +2 -0
  224. package/src/tools/run-experiment.ts +5 -1
  225. package/src/tools/run-query.ts +23 -1
  226. package/src/tools/update-dashboard-widget.ts +32 -40
  227. package/uv.lock +667 -341
  228. package/dist/add-dashboard-widget-4ZC5UN73.js +0 -50
  229. package/dist/add-dashboard-widget-ACC6QYBG.js +0 -49
  230. package/dist/chunk-5FNCQRCX.js +0 -91
  231. package/dist/chunk-ILZDO25L.js +0 -36
  232. package/dist/chunk-K2I7Z3LZ.js +0 -28
  233. package/dist/create-dashboard-DHVFMEU4.js +0 -18
  234. package/dist/create-dashboard-WTKKS5Z6.js +0 -19
  235. package/dist/delete-dashboard-76N66XXL.js +0 -18
  236. package/dist/delete-dashboard-JVIVHNJM.js +0 -19
  237. package/dist/get-dashboard-5NYJEIX2.js +0 -29
  238. package/dist/get-dashboard-QMTYDQAZ.js +0 -30
  239. package/dist/langwatch-api-dashboards-6EO2VVZW.js +0 -17
  240. package/dist/langwatch-api-dashboards-NHU5BZD7.js +0 -18
  241. package/dist/langwatch-api-workflows-XGJE6SR5.js +0 -15
  242. package/dist/list-dashboard-boards-OPWROHMG.js +0 -33
  243. package/dist/list-dashboard-boards-U2GJ7GC5.js +0 -34
  244. package/dist/list-dashboards-ROSYFLDQ.js +0 -33
  245. package/dist/list-dashboards-RQ635ZU7.js +0 -32
  246. package/dist/update-dashboard-widget-CJKJLCDY.js +0 -71
  247. package/dist/update-dashboard-widget-CYQDS2NR.js +0 -70
  248. package/src/langwatch-api-boards.ts +0 -46
  249. package/src/tools/create-dashboard.ts +0 -7
  250. package/src/tools/dashboard-exists.ts +0 -25
  251. package/src/tools/delete-dashboard.ts +0 -7
  252. package/src/tools/get-dashboard.ts +0 -22
  253. package/src/tools/list-dashboard-boards.ts +0 -28
@@ -31,7 +31,7 @@ var init_package = __esm({
31
31
  "package.json"() {
32
32
  package_default = {
33
33
  name: "@langwatch/mcp-server",
34
- version: "2.2.0",
34
+ version: "3.1.0",
35
35
  description: "An MCP server for Langwatch.",
36
36
  license: "MIT",
37
37
  author: "",
@@ -534,6 +534,10 @@ var init_triggers = __esm({
534
534
  });
535
535
 
536
536
  // src/langwatch-api.ts
537
+ function detailsOf(meta) {
538
+ const { reasons: _reasons, target: _target, fields: _fields, ...details } = meta;
539
+ return Object.keys(details).length > 0 ? details : void 0;
540
+ }
537
541
  function parseErrorBody(responseBody) {
538
542
  try {
539
543
  const parsed = JSON.parse(responseBody);
@@ -550,8 +554,10 @@ function parseErrorBody(responseBody) {
550
554
  const tips = readStringArray(body.tips);
551
555
  const docsUrl = typeof body.docsUrl === "string" ? body.docsUrl : void 0;
552
556
  const fault = VALID_FAULTS.includes(body.fault) ? body.fault : void 0;
553
- const reasons = Array.isArray(body.reasons) && body.reasons.every((r) => !!r && typeof r === "object") ? body.reasons : void 0;
554
- return { code, message, tips, docsUrl, fault, reasons };
557
+ const meta = isRecord(body.meta) ? body.meta : {};
558
+ const rawReasons = Array.isArray(body.reasons) ? body.reasons : meta.reasons;
559
+ const reasons = Array.isArray(rawReasons) && rawReasons.every((r) => !!r && typeof r === "object") ? rawReasons : void 0;
560
+ return { code, message, tips, docsUrl, fault, reasons, meta: detailsOf(meta) };
555
561
  } catch {
556
562
  return {};
557
563
  }
@@ -585,16 +591,46 @@ function describeReason(reason) {
585
591
  }
586
592
  return parts.join(" \u2014 ");
587
593
  }
594
+ function apiErrorOf({
595
+ status,
596
+ responseBody
597
+ }) {
598
+ const parsed = parseErrorBody(responseBody);
599
+ const lines = [`LangWatch API error ${status}: ${parsed.message ?? responseBody}`];
600
+ if (parsed.code) lines.push(`Code: ${parsed.code}`);
601
+ if (parsed.meta) lines.push(`Details: ${JSON.stringify(parsed.meta)}`);
602
+ const reasonLines = (parsed.reasons ?? []).map(describeReason).filter((line) => line !== null);
603
+ if (reasonLines.length > 0) {
604
+ lines.push("Rejected fields:", ...reasonLines);
605
+ }
606
+ if (parsed.tips && parsed.tips.length > 0) {
607
+ lines.push("Tips:", ...parsed.tips.map((tip) => `- ${tip}`));
608
+ }
609
+ if (parsed.docsUrl) {
610
+ lines.push(`Docs: ${parsed.docsUrl}`);
611
+ }
612
+ return new LangWatchApiError(lines.join("\n"), status, responseBody, {
613
+ code: parsed.code,
614
+ tips: parsed.tips,
615
+ docsUrl: parsed.docsUrl,
616
+ fault: parsed.fault,
617
+ reasons: parsed.reasons
618
+ });
619
+ }
588
620
  async function makeRequest(method, path, body) {
589
621
  const config = getConfig();
590
622
  const url = config.endpoint + path;
591
623
  const headers = {
592
624
  ...MCP_IDENTITY_HEADERS,
625
+ "X-API-Version": LANGWATCH_API_VERSION,
593
626
  "X-Auth-Token": requireApiKey()
594
627
  };
595
628
  if (config.projectId) {
596
629
  headers["X-Project-Id"] = config.projectId;
597
630
  }
631
+ if (config.hosted) {
632
+ headers[HOSTED_MCP_HEADER] = "hosted";
633
+ }
598
634
  if (body !== void 0) {
599
635
  headers["Content-Type"] = "application/json";
600
636
  }
@@ -603,28 +639,8 @@ async function makeRequest(method, path, body) {
603
639
  headers,
604
640
  ...body !== void 0 ? { body: JSON.stringify(body) } : {}
605
641
  });
606
- if (!response.ok) {
607
- const responseBody = await response.text();
608
- const parsed = parseErrorBody(responseBody);
609
- const lines = [`LangWatch API error ${response.status}: ${parsed.message ?? responseBody}`];
610
- const reasonLines = (parsed.reasons ?? []).map(describeReason).filter((line) => line !== null);
611
- if (reasonLines.length > 0) {
612
- lines.push("Rejected fields:", ...reasonLines);
613
- }
614
- if (parsed.tips && parsed.tips.length > 0) {
615
- lines.push("Tips:", ...parsed.tips.map((tip) => `- ${tip}`));
616
- }
617
- if (parsed.docsUrl) {
618
- lines.push(`Docs: ${parsed.docsUrl}`);
619
- }
620
- throw new LangWatchApiError(lines.join("\n"), response.status, responseBody, {
621
- code: parsed.code,
622
- tips: parsed.tips,
623
- docsUrl: parsed.docsUrl,
624
- fault: parsed.fault,
625
- reasons: parsed.reasons
626
- });
627
- }
642
+ if (!response.ok)
643
+ throw apiErrorOf({ status: response.status, responseBody: await response.text() });
628
644
  if (response.status === 204 || response.headers?.get("content-length") === "0") {
629
645
  return null;
630
646
  }
@@ -705,7 +721,7 @@ async function renamePromptTag({
705
721
  async function deletePromptTag(tag) {
706
722
  return makeRequest("DELETE", `/api/v1/prompts/tags/${encodeURIComponent(tag)}`);
707
723
  }
708
- var MCP_IDENTITY_HEADERS, LangWatchApiError, VALID_FAULTS;
724
+ var MCP_IDENTITY_HEADERS, LANGWATCH_API_VERSION, HOSTED_MCP_HEADER, LangWatchApiError, VALID_FAULTS;
709
725
  var init_langwatch_api = __esm({
710
726
  "src/langwatch-api.ts"() {
711
727
  "use strict";
@@ -717,6 +733,8 @@ var init_langwatch_api = __esm({
717
733
  "X-LangWatch-SDK-Language": "typescript",
718
734
  "X-LangWatch-SDK-Version": package_default.version
719
735
  };
736
+ LANGWATCH_API_VERSION = "2026-10-26";
737
+ HOSTED_MCP_HEADER = "X-LangWatch-MCP-Host";
720
738
  LangWatchApiError = class extends Error {
721
739
  constructor(message, status, responseBody, options = {}) {
722
740
  super(message);
@@ -1287,16 +1305,16 @@ async function runAgent({
1287
1305
  async function deleteAgent(id) {
1288
1306
  return makeRequest("DELETE", `/api/v1/agents/${encodeURIComponent(id)}`);
1289
1307
  }
1290
- var import_zod5, agentCallParamsSchema, isMessageList;
1308
+ var import_zod6, agentCallParamsSchema, isMessageList;
1291
1309
  var init_langwatch_api_agents = __esm({
1292
1310
  "src/langwatch-api-agents.ts"() {
1293
1311
  "use strict";
1294
- import_zod5 = require("zod");
1312
+ import_zod6 = require("zod");
1295
1313
  init_langwatch_api();
1296
1314
  init_public_http_request();
1297
- agentCallParamsSchema = import_zod5.z.record(
1298
- import_zod5.z.string(),
1299
- import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number(), import_zod5.z.boolean()])
1315
+ agentCallParamsSchema = import_zod6.z.record(
1316
+ import_zod6.z.string(),
1317
+ import_zod6.z.union([import_zod6.z.string(), import_zod6.z.number(), import_zod6.z.boolean()])
1300
1318
  );
1301
1319
  isMessageList = (value) => Array.isArray(value) && value.every(
1302
1320
  (item) => typeof item === "object" && item !== null && typeof item.role === "string"
@@ -1509,8 +1527,23 @@ function isKeyShapedBody(body) {
1509
1527
  }
1510
1528
  const { lower, upper, digit } = countCharClasses(body);
1511
1529
  if (lower < 2 || upper < 2 || digit < 2) return false;
1530
+ if (isWordSlug(body)) return false;
1512
1531
  return shannonEntropyBits(body) >= SHAPED_TOKEN_MIN_ENTROPY;
1513
1532
  }
1533
+ function isWordSlug(body) {
1534
+ const segments = body.split(/[-_]/);
1535
+ if (segments.length < SLUG_MIN_SEGMENTS) return false;
1536
+ let words = 0;
1537
+ let randomLooking = 0;
1538
+ for (const segment of segments) {
1539
+ if (!SLUG_LETTERS_SEGMENT.test(segment) && !SLUG_TAG_SEGMENT.test(segment)) {
1540
+ return false;
1541
+ }
1542
+ if (SLUG_WORD_SEGMENT.test(segment)) words += 1;
1543
+ if (SLUG_RANDOM_SEGMENT.test(segment)) randomLooking += 1;
1544
+ }
1545
+ return words >= SLUG_MIN_WORDS && randomLooking <= SLUG_MAX_RANDOM_SEGMENTS;
1546
+ }
1514
1547
  function isNonCredentialPrefix(prefix) {
1515
1548
  const lower = prefix.toLowerCase();
1516
1549
  return DIGEST_PREFIXES.has(lower) || IDENTIFIER_PREFIXES.has(lower) || RECORD_ID_PREFIXES.has(lower) || PUBLIC_KEY_PREFIXES.has(lower);
@@ -1649,7 +1682,7 @@ function redactOneSlice(text, customPatterns, skipped) {
1649
1682
  }
1650
1683
  return { text: result, redactedCount };
1651
1684
  }
1652
- var SECRETS_REDACTION_MARKER, REPLACEMENT, MAX_SCAN_LENGTH, ENTROPY_SAMPLE_LENGTH, TOKEN_START, TOKEN_END, VENDOR_KEY_PATTERNS, VENDOR_KEY_REGEX, SHAPED_TOKEN_MIN_BODY, SHAPED_TOKEN_MAX_BODY, SHAPED_TOKEN_MIN_ENTROPY, DIGEST_PREFIXES, HEX_BODY_CREDENTIAL_SEGMENTS, IDENTIFIER_PREFIXES, RECORD_ID_PREFIXES, PUBLIC_KEY_PREFIXES, HEX_BODY_MIN, HEX_BODY_MAX, PLACEHOLDER_VALUE_REGEX, ENV_REFERENCE_REGEX, CODE_EXPRESSION_REGEX, PATH_LIKE_REGEX, CONTEXT_VALUE_MIN_LENGTH, CONTEXT_VALUE_MIN_ENTROPY, VERSION_STRING_REGEX, LOOSE_VALUE_MIN_LENGTH, LOOSE_VALUE_MIN_ENTROPY, CREDENTIAL_QUALIFIERS, QUALIFIER_ALTERNATION, CREDENTIAL_KEYWORD, VALUE_RULES, BUILTIN_SECRET_RULES, SENSITIVE_KEY_REGEX, CREDENTIAL_NOUNS, VALUE_BOUNDARY, CUSTOM_VALUE_BOUNDARY, SAFE_CUT_LOOKAHEAD, PEM_BEGIN, PEM_END;
1685
+ var SECRETS_REDACTION_MARKER, REPLACEMENT, MAX_SCAN_LENGTH, ENTROPY_SAMPLE_LENGTH, TOKEN_START, TOKEN_END, VENDOR_KEY_PATTERNS, VENDOR_KEY_REGEX, SHAPED_TOKEN_MIN_BODY, SHAPED_TOKEN_MAX_BODY, SHAPED_TOKEN_MIN_ENTROPY, SLUG_MIN_SEGMENTS, SLUG_LETTERS_SEGMENT, SLUG_TAG_SEGMENT, SLUG_WORD_SEGMENT, SLUG_RANDOM_SEGMENT, SLUG_MAX_RANDOM_SEGMENTS, SLUG_MIN_WORDS, DIGEST_PREFIXES, HEX_BODY_CREDENTIAL_SEGMENTS, IDENTIFIER_PREFIXES, RECORD_ID_PREFIXES, PUBLIC_KEY_PREFIXES, HEX_BODY_MIN, HEX_BODY_MAX, PLACEHOLDER_VALUE_REGEX, ENV_REFERENCE_REGEX, CODE_EXPRESSION_REGEX, PATH_LIKE_REGEX, CONTEXT_VALUE_MIN_LENGTH, CONTEXT_VALUE_MIN_ENTROPY, VERSION_STRING_REGEX, LOOSE_VALUE_MIN_LENGTH, LOOSE_VALUE_MIN_ENTROPY, CREDENTIAL_QUALIFIERS, QUALIFIER_ALTERNATION, CREDENTIAL_KEYWORD, VALUE_RULES, BUILTIN_SECRET_RULES, SENSITIVE_KEY_REGEX, CREDENTIAL_NOUNS, VALUE_BOUNDARY, CUSTOM_VALUE_BOUNDARY, SAFE_CUT_LOOKAHEAD, PEM_BEGIN, PEM_END;
1653
1686
  var init_secrets = __esm({
1654
1687
  "../../packages/redaction/src/secrets.ts"() {
1655
1688
  "use strict";
@@ -1715,6 +1748,13 @@ var init_secrets = __esm({
1715
1748
  SHAPED_TOKEN_MIN_BODY = 26;
1716
1749
  SHAPED_TOKEN_MAX_BODY = 120;
1717
1750
  SHAPED_TOKEN_MIN_ENTROPY = 3.9;
1751
+ SLUG_MIN_SEGMENTS = 4;
1752
+ SLUG_LETTERS_SEGMENT = /^[A-Za-z]{1,12}$/;
1753
+ SLUG_TAG_SEGMENT = /^[A-Za-z0-9]{1,6}$/;
1754
+ SLUG_WORD_SEGMENT = /^(?:[a-z]{4,}|[A-Z]{4,}|[A-Z][a-z]{3,})$/;
1755
+ SLUG_RANDOM_SEGMENT = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/;
1756
+ SLUG_MAX_RANDOM_SEGMENTS = 1;
1757
+ SLUG_MIN_WORDS = 2;
1718
1758
  DIGEST_PREFIXES = /* @__PURE__ */ new Set([
1719
1759
  "sha1",
1720
1760
  "sha224",
@@ -2290,6 +2330,7 @@ async function deliverReport(report, params) {
2290
2330
  method: "POST",
2291
2331
  headers: {
2292
2332
  "content-type": "application/json",
2333
+ "x-api-version": LANGWATCH_API_VERSION,
2293
2334
  ...config.apiKey ? { authorization: `Bearer ${config.apiKey}` } : {}
2294
2335
  },
2295
2336
  body: JSON.stringify({
@@ -2342,6 +2383,7 @@ var init_report_issue = __esm({
2342
2383
  "use strict";
2343
2384
  init_src();
2344
2385
  init_config();
2386
+ init_langwatch_api();
2345
2387
  MAX_SESSION_BYTES = 8 * 1024 * 1024;
2346
2388
  REQUEST_TIMEOUT_MS2 = 6e4;
2347
2389
  }
@@ -2617,7 +2659,9 @@ var init_discover_evaluator_schema = __esm({
2617
2659
  async function runQuery(params) {
2618
2660
  return makeRequest("POST", "/api/v1/query", {
2619
2661
  sql: params.sql,
2620
- ...params.parameters ? { parameters: params.parameters } : {}
2662
+ ...params.parameters ? { parameters: params.parameters } : {},
2663
+ ...params.projects ? { projects: params.projects } : {},
2664
+ ...params.sources ? { sources: params.sources } : {}
2621
2665
  });
2622
2666
  }
2623
2667
  async function getQueryReference() {
@@ -3151,7 +3195,12 @@ __export(run_query_exports, {
3151
3195
  handleRunQuery: () => handleRunQuery
3152
3196
  });
3153
3197
  async function handleRunQuery(params) {
3154
- const result = await runQuery(params);
3198
+ const result = await runQuery(params).catch((error) => {
3199
+ if (error instanceof LangWatchApiError && error.code === "projects_required") {
3200
+ throw new Error(PROJECTS_REQUIRED_MESSAGE);
3201
+ }
3202
+ throw error;
3203
+ });
3155
3204
  const headers = result.columns.map((column) => column.name);
3156
3205
  const shown = result.rows.slice(0, RUN_QUERY_ROW_CAP);
3157
3206
  const lines = [];
@@ -3179,15 +3228,23 @@ async function handleRunQuery(params) {
3179
3228
  for (const diagnostic of result.diagnostics) {
3180
3229
  lines.push(`${diagnostic.code}: ${diagnostic.message}`);
3181
3230
  }
3231
+ if (result.params) lines.push("", describeParams(result.params));
3182
3232
  return lines.join("\n");
3183
3233
  }
3184
- var RUN_QUERY_ROW_CAP;
3234
+ function describeParams(params) {
3235
+ return ["Ran with these placeholders:", "```json", JSON.stringify(params, null, 2), "```"].join(
3236
+ "\n"
3237
+ );
3238
+ }
3239
+ var RUN_QUERY_ROW_CAP, PROJECTS_REQUIRED_MESSAGE;
3185
3240
  var init_run_query = __esm({
3186
3241
  "src/tools/run-query.ts"() {
3187
3242
  "use strict";
3188
3243
  init_langwatch_api_query();
3244
+ init_langwatch_api();
3189
3245
  init_markdown_table();
3190
3246
  RUN_QUERY_ROW_CAP = 50;
3247
+ PROJECTS_REQUIRED_MESSAGE = 'Name the projects to query: pass `projects`, a list of project ids, or "all"';
3191
3248
  }
3192
3249
  });
3193
3250
 
@@ -5240,318 +5297,273 @@ async function handleRunAgent({
5240
5297
  }
5241
5298
  return lines.join("\n");
5242
5299
  }
5243
- var import_zod6, jsonObjectSchema;
5300
+ var import_zod7, jsonObjectSchema;
5244
5301
  var init_run_agent = __esm({
5245
5302
  "src/tools/run-agent.ts"() {
5246
5303
  "use strict";
5247
- import_zod6 = require("zod");
5304
+ import_zod7 = require("zod");
5248
5305
  init_langwatch_api_agents();
5249
- jsonObjectSchema = import_zod6.z.looseObject({});
5306
+ jsonObjectSchema = import_zod7.z.looseObject({});
5250
5307
  }
5251
5308
  });
5252
5309
 
5253
- // src/langwatch-api-dashboards.ts
5254
- var langwatch_api_dashboards_exports = {};
5255
- __export(langwatch_api_dashboards_exports, {
5256
- createDashboard: () => createDashboard,
5257
- deleteDashboard: () => deleteDashboard,
5258
- getDashboard: () => getDashboard,
5259
- listDashboards: () => listDashboards,
5260
- renameDashboard: () => renameDashboard
5310
+ // src/langwatch-api-analytics-reports.ts
5311
+ var langwatch_api_analytics_reports_exports = {};
5312
+ __export(langwatch_api_analytics_reports_exports, {
5313
+ createAnalyticsReport: () => createAnalyticsReport,
5314
+ deleteAnalyticsReport: () => deleteAnalyticsReport,
5315
+ getAnalyticsReport: () => getAnalyticsReport,
5316
+ listAnalyticsReports: () => listAnalyticsReports,
5317
+ renameAnalyticsReport: () => renameAnalyticsReport
5261
5318
  });
5262
- async function listDashboards() {
5263
- return makeRequest("GET", "/api/v1/dashboards");
5319
+ async function listAnalyticsReports() {
5320
+ return makeRequest("GET", "/api/v1/analytics/reports");
5264
5321
  }
5265
- async function getDashboard(id) {
5266
- return makeRequest(
5267
- "GET",
5268
- `/api/v1/dashboards/${encodeURIComponent(id)}`
5269
- );
5322
+ async function getAnalyticsReport({
5323
+ reportId
5324
+ }) {
5325
+ return makeRequest("GET", reportPath(reportId));
5270
5326
  }
5271
- async function createDashboard(data) {
5272
- return makeRequest("POST", "/api/v1/dashboards", data);
5327
+ async function createAnalyticsReport({
5328
+ name
5329
+ }) {
5330
+ return makeRequest("POST", "/api/v1/analytics/reports", {
5331
+ name
5332
+ });
5273
5333
  }
5274
- async function renameDashboard(id, data) {
5275
- return makeRequest(
5276
- "PATCH",
5277
- `/api/v1/dashboards/${encodeURIComponent(id)}`,
5278
- data
5279
- );
5334
+ async function renameAnalyticsReport({
5335
+ reportId,
5336
+ name
5337
+ }) {
5338
+ return makeRequest("PATCH", reportPath(reportId), { name });
5280
5339
  }
5281
- async function deleteDashboard(id) {
5282
- return makeRequest("DELETE", `/api/v1/dashboards/${encodeURIComponent(id)}`);
5340
+ async function deleteAnalyticsReport({
5341
+ reportId
5342
+ }) {
5343
+ return makeRequest("DELETE", reportPath(reportId));
5283
5344
  }
5284
- var init_langwatch_api_dashboards = __esm({
5285
- "src/langwatch-api-dashboards.ts"() {
5345
+ var reportPath;
5346
+ var init_langwatch_api_analytics_reports = __esm({
5347
+ "src/langwatch-api-analytics-reports.ts"() {
5286
5348
  "use strict";
5287
5349
  init_langwatch_api();
5350
+ reportPath = (reportId) => `/api/v1/analytics/reports/${encodeURIComponent(reportId)}`;
5288
5351
  }
5289
5352
  });
5290
5353
 
5291
- // src/tools/list-dashboards.ts
5292
- var list_dashboards_exports = {};
5293
- __export(list_dashboards_exports, {
5294
- handleListDashboards: () => handleListDashboards
5354
+ // src/tools/list-analytics-reports.ts
5355
+ var list_analytics_reports_exports = {};
5356
+ __export(list_analytics_reports_exports, {
5357
+ handleListAnalyticsReports: () => handleListAnalyticsReports
5295
5358
  });
5296
- async function handleListDashboards() {
5297
- const result = await listDashboards();
5298
- const dashboards = result.data;
5299
- if (!Array.isArray(dashboards) || dashboards.length === 0) {
5300
- return "No dashboards found in this project.\n\n> Tip: Use `platform_create_dashboard` to create a new dashboard.";
5359
+ async function handleListAnalyticsReports() {
5360
+ const result = await listAnalyticsReports();
5361
+ const reports = result.data;
5362
+ if (!Array.isArray(reports) || reports.length === 0) {
5363
+ return "No Analytics Reports found in this project.\n\n> Tip: Use `platform_create_analytics_report` to create a new Analytics Report.";
5301
5364
  }
5302
5365
  const lines = [];
5303
- lines.push(`# Dashboards (${dashboards.length} total)
5366
+ lines.push(`# Analytics Reports (${reports.length} total)
5304
5367
  `);
5305
- for (const d of dashboards) {
5306
- lines.push(`## ${d.name}`);
5307
- lines.push(`**ID**: ${d.id}`);
5308
- lines.push(`**Graphs**: ${d.graphCount}`);
5309
- lines.push(`**Updated**: ${d.updatedAt}`);
5368
+ for (const report of reports) {
5369
+ lines.push(`## ${report.name}`);
5370
+ lines.push(`**ID**: ${report.id}`);
5371
+ lines.push(`**Graphs**: ${report.graphCount}`);
5372
+ lines.push(`**Updated**: ${report.updatedAt}`);
5310
5373
  lines.push("");
5311
5374
  }
5312
5375
  lines.push(
5313
- "> Use `platform_get_dashboard` with the ID to see dashboard details including graphs."
5376
+ "> Use `platform_get_analytics_report` with the ID to see the Analytics Report's details including graphs."
5314
5377
  );
5315
5378
  return lines.join("\n");
5316
5379
  }
5317
- var init_list_dashboards = __esm({
5318
- "src/tools/list-dashboards.ts"() {
5380
+ var init_list_analytics_reports = __esm({
5381
+ "src/tools/list-analytics-reports.ts"() {
5319
5382
  "use strict";
5320
- init_langwatch_api_dashboards();
5383
+ init_langwatch_api_analytics_reports();
5321
5384
  }
5322
5385
  });
5323
5386
 
5324
- // src/tools/get-dashboard.ts
5325
- var get_dashboard_exports = {};
5326
- __export(get_dashboard_exports, {
5327
- handleGetDashboard: () => handleGetDashboard
5387
+ // src/tools/get-analytics-report.ts
5388
+ var get_analytics_report_exports = {};
5389
+ __export(get_analytics_report_exports, {
5390
+ handleGetAnalyticsReport: () => handleGetAnalyticsReport
5328
5391
  });
5329
- async function handleGetDashboard(params) {
5330
- const dashboard = await getDashboard(params.id);
5392
+ async function handleGetAnalyticsReport(params) {
5393
+ const report = await getAnalyticsReport({ reportId: params.reportId });
5331
5394
  const lines = [];
5332
- lines.push(`# ${dashboard.name}
5395
+ lines.push(`# ${report.name}
5333
5396
  `);
5334
- lines.push(`**ID**: ${dashboard.id}`);
5335
- lines.push(`**Order**: ${dashboard.order}`);
5336
- lines.push(`**Graphs**: ${Array.isArray(dashboard.graphs) ? dashboard.graphs.length : 0}`);
5337
- lines.push(`**Created**: ${dashboard.createdAt}`);
5338
- lines.push(`**Updated**: ${dashboard.updatedAt}`);
5339
- if (Array.isArray(dashboard.graphs) && dashboard.graphs.length > 0) {
5397
+ lines.push(`**ID**: ${report.id}`);
5398
+ lines.push(`**Order**: ${report.order}`);
5399
+ lines.push(`**Graphs**: ${Array.isArray(report.graphs) ? report.graphs.length : 0}`);
5400
+ lines.push(`**Created**: ${report.createdAt}`);
5401
+ lines.push(`**Updated**: ${report.updatedAt}`);
5402
+ if (Array.isArray(report.graphs) && report.graphs.length > 0) {
5340
5403
  lines.push("\n## Graphs\n");
5341
5404
  lines.push("```json");
5342
- lines.push(JSON.stringify(dashboard.graphs, null, 2));
5405
+ lines.push(JSON.stringify(report.graphs, null, 2));
5343
5406
  lines.push("```");
5344
5407
  }
5345
5408
  return lines.join("\n");
5346
5409
  }
5347
- var init_get_dashboard = __esm({
5348
- "src/tools/get-dashboard.ts"() {
5410
+ var init_get_analytics_report = __esm({
5411
+ "src/tools/get-analytics-report.ts"() {
5349
5412
  "use strict";
5350
- init_langwatch_api_dashboards();
5413
+ init_langwatch_api_analytics_reports();
5351
5414
  }
5352
5415
  });
5353
5416
 
5354
- // src/tools/create-dashboard.ts
5355
- var create_dashboard_exports = {};
5356
- __export(create_dashboard_exports, {
5357
- handleCreateDashboard: () => handleCreateDashboard
5417
+ // src/tools/create-analytics-report.ts
5418
+ var create_analytics_report_exports = {};
5419
+ __export(create_analytics_report_exports, {
5420
+ handleCreateAnalyticsReport: () => handleCreateAnalyticsReport
5358
5421
  });
5359
- async function handleCreateDashboard(params) {
5360
- const dashboard = await createDashboard({ name: params.name });
5361
- return `Dashboard created successfully!
5422
+ async function handleCreateAnalyticsReport(params) {
5423
+ const report = await createAnalyticsReport({ name: params.name });
5424
+ return `Analytics Report created successfully!
5362
5425
 
5363
- **Name**: ${dashboard.name}
5364
- **ID**: ${dashboard.id}`;
5426
+ **Name**: ${report.name}
5427
+ **ID**: ${report.id}`;
5365
5428
  }
5366
- var init_create_dashboard = __esm({
5367
- "src/tools/create-dashboard.ts"() {
5429
+ var init_create_analytics_report = __esm({
5430
+ "src/tools/create-analytics-report.ts"() {
5368
5431
  "use strict";
5369
- init_langwatch_api_dashboards();
5432
+ init_langwatch_api_analytics_reports();
5370
5433
  }
5371
5434
  });
5372
5435
 
5373
- // src/tools/delete-dashboard.ts
5374
- var delete_dashboard_exports = {};
5375
- __export(delete_dashboard_exports, {
5376
- handleDeleteDashboard: () => handleDeleteDashboard
5436
+ // src/tools/delete-analytics-report.ts
5437
+ var delete_analytics_report_exports = {};
5438
+ __export(delete_analytics_report_exports, {
5439
+ handleDeleteAnalyticsReport: () => handleDeleteAnalyticsReport
5377
5440
  });
5378
- async function handleDeleteDashboard(params) {
5379
- const result = await deleteDashboard(params.id);
5380
- return `Dashboard deleted successfully!
5441
+ async function handleDeleteAnalyticsReport(params) {
5442
+ const result = await deleteAnalyticsReport({ reportId: params.reportId });
5443
+ return `Analytics Report deleted successfully!
5381
5444
 
5382
5445
  **Name**: ${result.name}
5383
5446
  **ID**: ${result.id}`;
5384
5447
  }
5385
- var init_delete_dashboard = __esm({
5386
- "src/tools/delete-dashboard.ts"() {
5448
+ var init_delete_analytics_report = __esm({
5449
+ "src/tools/delete-analytics-report.ts"() {
5387
5450
  "use strict";
5388
- init_langwatch_api_dashboards();
5451
+ init_langwatch_api_analytics_reports();
5389
5452
  }
5390
5453
  });
5391
5454
 
5392
- // src/langwatch-api-boards.ts
5393
- async function listBoards({
5394
- projectId: projectId2
5455
+ // src/langwatch-api-dashboards.ts
5456
+ async function listDashboards() {
5457
+ return makeRequest("GET", "/api/v1/dashboards");
5458
+ }
5459
+ async function getDashboard({ dashboardId }) {
5460
+ return makeRequest("GET", dashboardPath(dashboardId));
5461
+ }
5462
+ async function createDashboard({ name }) {
5463
+ return makeRequest("POST", "/api/v1/dashboards", { name });
5464
+ }
5465
+ async function updateDashboard({
5466
+ dashboardId,
5467
+ ...changes
5395
5468
  }) {
5396
- return makeRequest(
5397
- "GET",
5398
- `/api/v1/projects/${encodeURIComponent(projectId2)}/analytics/boards`
5399
- );
5469
+ return makeRequest("PATCH", dashboardPath(dashboardId), changes);
5400
5470
  }
5401
- async function getBoard({
5402
- projectId: projectId2,
5403
- boardId
5471
+ async function deleteDashboard({
5472
+ dashboardId
5404
5473
  }) {
5405
- return makeRequest(
5406
- "GET",
5407
- `/api/v1/projects/${encodeURIComponent(projectId2)}/analytics/boards/${encodeURIComponent(boardId)}`
5408
- );
5474
+ return makeRequest("DELETE", dashboardPath(dashboardId));
5409
5475
  }
5410
- var init_langwatch_api_boards = __esm({
5411
- "src/langwatch-api-boards.ts"() {
5412
- "use strict";
5413
- init_langwatch_api();
5414
- }
5415
- });
5416
-
5417
- // src/langwatch-api-projects.ts
5418
- async function listProjects(params) {
5419
- const query = new URLSearchParams();
5420
- if (params?.page) query.set("page", String(params.page));
5421
- if (params?.limit) query.set("limit", String(params.limit));
5422
- const qs = query.toString() ? `?${query}` : "";
5423
- return makeRequest("GET", `/api/v1/projects${qs}`);
5476
+ async function listWidgetsOnDashboard({
5477
+ dashboardId
5478
+ }) {
5479
+ return makeRequest("GET", `${dashboardPath(dashboardId)}/widgets`);
5424
5480
  }
5425
- async function getProject(id) {
5481
+ async function createWidgetOnDashboard({
5482
+ dashboardId,
5483
+ ...data
5484
+ }) {
5426
5485
  return makeRequest(
5427
- "GET",
5428
- `/api/v1/projects/${encodeURIComponent(id)}`
5486
+ "POST",
5487
+ `${dashboardPath(dashboardId)}/widgets`,
5488
+ data
5429
5489
  );
5430
5490
  }
5431
- async function getCurrentProject() {
5432
- return makeRequest("GET", "/api/v1/me/project");
5433
- }
5434
- async function createProject(data) {
5435
- return makeRequest("POST", "/api/v1/projects", data);
5491
+ async function getWidgetOnDashboard({
5492
+ dashboardId,
5493
+ widgetId
5494
+ }) {
5495
+ return makeRequest("GET", widgetPath(dashboardId, widgetId));
5436
5496
  }
5437
- async function updateProject(params) {
5438
- const { id, ...data } = params;
5497
+ async function updateWidgetOnDashboard({
5498
+ dashboardId,
5499
+ widgetId,
5500
+ ...changes
5501
+ }) {
5439
5502
  return makeRequest(
5440
5503
  "PATCH",
5441
- `/api/v1/projects/${encodeURIComponent(id)}`,
5442
- data
5504
+ widgetPath(dashboardId, widgetId),
5505
+ changes
5443
5506
  );
5444
5507
  }
5445
- async function archiveProject(id) {
5446
- return makeRequest("DELETE", `/api/v1/projects/${encodeURIComponent(id)}`);
5508
+ async function deleteWidgetOnDashboard({
5509
+ dashboardId,
5510
+ widgetId
5511
+ }) {
5512
+ await makeRequest("DELETE", widgetPath(dashboardId, widgetId));
5447
5513
  }
5448
- var init_langwatch_api_projects = __esm({
5449
- "src/langwatch-api-projects.ts"() {
5514
+ var dashboardPath, widgetPath;
5515
+ var init_langwatch_api_dashboards = __esm({
5516
+ "src/langwatch-api-dashboards.ts"() {
5450
5517
  "use strict";
5451
5518
  init_langwatch_api();
5519
+ dashboardPath = (dashboardId) => `/api/v1/dashboards/${encodeURIComponent(dashboardId)}`;
5520
+ widgetPath = (dashboardId, widgetId) => `${dashboardPath(dashboardId)}/widgets/${encodeURIComponent(widgetId)}`;
5452
5521
  }
5453
5522
  });
5454
5523
 
5455
- // src/tools/list-dashboard-boards.ts
5456
- var list_dashboard_boards_exports = {};
5457
- __export(list_dashboard_boards_exports, {
5458
- handleListDashboardBoards: () => handleListDashboardBoards
5524
+ // src/tools/list-dashboards.ts
5525
+ var list_dashboards_exports = {};
5526
+ __export(list_dashboards_exports, {
5527
+ handleListDashboards: () => handleListDashboards
5459
5528
  });
5460
- async function handleListDashboardBoards() {
5461
- const project = await getCurrentProject();
5462
- const { data: boards } = await listBoards({ projectId: project.id });
5463
- if (boards.length === 0) {
5529
+ async function handleListDashboards() {
5530
+ const { data: dashboards } = await listDashboards();
5531
+ if (dashboards.length === 0) {
5464
5532
  return "No dashboards found in this project. Create one in the Dashboards area first.";
5465
5533
  }
5466
5534
  return [
5467
- `# Dashboards (${boards.length} total)
5535
+ `# Dashboards (${dashboards.length} total)
5468
5536
  `,
5469
- ...boards.flatMap((board) => [
5470
- `## ${board.name}`,
5471
- `**ID**: ${board.id}`,
5472
- `**Widgets**: ${board.widgetCount}`,
5473
- `**URL**: ${board.platformUrl}`,
5537
+ ...dashboards.flatMap((dashboard) => [
5538
+ `## ${dashboard.name}`,
5539
+ `**ID**: ${dashboard.id}`,
5540
+ `**Widgets**: ${dashboard.widgetCount}`,
5541
+ `**URL**: ${dashboard.platformUrl}`,
5474
5542
  ""
5475
5543
  ]),
5476
5544
  "> Pass the ID to `add_dashboard_widget` to add a widget to that dashboard."
5477
5545
  ].join("\n");
5478
5546
  }
5479
- var init_list_dashboard_boards = __esm({
5480
- "src/tools/list-dashboard-boards.ts"() {
5481
- "use strict";
5482
- init_langwatch_api_boards();
5483
- init_langwatch_api_projects();
5484
- }
5485
- });
5486
-
5487
- // src/langwatch-api-dashboard-widgets.ts
5488
- async function createDashboardWidget(params) {
5489
- const { projectId: projectId2, ...data } = params;
5490
- return makeRequest(
5491
- "POST",
5492
- `/api/v1/projects/${encodeURIComponent(projectId2)}/analytics/dashboard-widgets`,
5493
- data
5494
- );
5495
- }
5496
- async function getDashboardWidget(params) {
5497
- return makeRequest(
5498
- "GET",
5499
- `/api/v1/projects/${encodeURIComponent(params.projectId)}/analytics/dashboard-widgets/${encodeURIComponent(params.widgetId)}`
5500
- );
5501
- }
5502
- async function updateDashboardWidget(params) {
5503
- const { projectId: projectId2, widgetId, ...data } = params;
5504
- return makeRequest(
5505
- "PATCH",
5506
- `/api/v1/projects/${encodeURIComponent(projectId2)}/analytics/dashboard-widgets/${encodeURIComponent(widgetId)}`,
5507
- data
5508
- );
5509
- }
5510
- async function assignDashboardWidgetToDashboard(params) {
5511
- return makeRequest(
5512
- "POST",
5513
- `/api/v1/projects/${encodeURIComponent(params.projectId)}/analytics/dashboard-widgets/${encodeURIComponent(params.widgetId)}/dashboard`,
5514
- { dashboardId: params.dashboardId }
5515
- );
5516
- }
5517
- async function deleteDashboardWidget(params) {
5518
- await makeRequest(
5519
- "DELETE",
5520
- `/api/v1/projects/${encodeURIComponent(params.projectId)}/analytics/dashboard-widgets/${encodeURIComponent(params.widgetId)}`
5521
- );
5522
- }
5523
- var init_langwatch_api_dashboard_widgets = __esm({
5524
- "src/langwatch-api-dashboard-widgets.ts"() {
5547
+ var init_list_dashboards = __esm({
5548
+ "src/tools/list-dashboards.ts"() {
5525
5549
  "use strict";
5526
- init_langwatch_api();
5550
+ init_langwatch_api_dashboards();
5527
5551
  }
5528
5552
  });
5529
5553
 
5530
- // src/tools/dashboard-exists.ts
5531
- async function assertDashboardExists({
5532
- projectId: projectId2,
5533
- dashboardId
5554
+ // src/tools/dashboard-widget-queries.ts
5555
+ function withLists({
5556
+ queries,
5557
+ sources,
5558
+ projects
5534
5559
  }) {
5535
- try {
5536
- await getBoard({ projectId: projectId2, boardId: dashboardId });
5537
- } catch (error) {
5538
- if (error instanceof LangWatchApiError && error.status === 404) {
5539
- throw new Error(
5540
- `No dashboard with ID "${dashboardId}" was found in this project. Use list_dashboard_boards to find a valid dashboard ID.`
5541
- );
5542
- }
5543
- throw error;
5544
- }
5560
+ if (sources === void 0 && projects === void 0) return [...queries];
5561
+ return queries.map((query) => ({
5562
+ ...query,
5563
+ ...sources === void 0 ? {} : { sources },
5564
+ ...projects === void 0 ? {} : { projects }
5565
+ }));
5545
5566
  }
5546
- var init_dashboard_exists = __esm({
5547
- "src/tools/dashboard-exists.ts"() {
5548
- "use strict";
5549
- init_langwatch_api_boards();
5550
- init_langwatch_api();
5551
- }
5552
- });
5553
-
5554
- // src/tools/dashboard-widget-queries.ts
5555
5567
  function normalizeDashboardWidgetQueries({
5556
5568
  queries
5557
5569
  }) {
@@ -5582,27 +5594,25 @@ __export(add_dashboard_widget_exports, {
5582
5594
  handleAddDashboardWidget: () => handleAddDashboardWidget
5583
5595
  });
5584
5596
  async function handleAddDashboardWidget(params) {
5585
- const queries = normalizeDashboardWidgetQueries({ queries: params.queries });
5586
- const project = await getCurrentProject();
5587
- await assertDashboardExists({ projectId: project.id, dashboardId: params.dashboardId });
5588
- const widget = await createDashboardWidget({
5589
- projectId: project.id,
5590
- name: params.name,
5591
- code: params.code,
5592
- queries
5597
+ const queries = withLists({
5598
+ queries: normalizeDashboardWidgetQueries({ queries: params.queries }),
5599
+ sources: params.sources,
5600
+ projects: params.projects
5593
5601
  });
5602
+ let widget;
5594
5603
  try {
5595
- await assignDashboardWidgetToDashboard({
5596
- projectId: project.id,
5597
- widgetId: widget.id,
5598
- dashboardId: params.dashboardId
5604
+ widget = await createWidgetOnDashboard({
5605
+ dashboardId: params.dashboardId,
5606
+ name: params.name,
5607
+ code: params.code,
5608
+ queries
5599
5609
  });
5600
5610
  } catch (error) {
5601
- await deleteDashboardWidget({
5602
- projectId: project.id,
5603
- widgetId: widget.id
5604
- }).catch(() => {
5605
- });
5611
+ if (error instanceof LangWatchApiError && error.status === 404) {
5612
+ throw new Error(
5613
+ `No dashboard with ID "${params.dashboardId}" was found in this project. Use list_dashboards to find a valid dashboard ID.`
5614
+ );
5615
+ }
5606
5616
  throw error;
5607
5617
  }
5608
5618
  return [
@@ -5614,9 +5624,8 @@ async function handleAddDashboardWidget(params) {
5614
5624
  var init_add_dashboard_widget = __esm({
5615
5625
  "src/tools/add-dashboard-widget.ts"() {
5616
5626
  "use strict";
5617
- init_langwatch_api_dashboard_widgets();
5618
- init_langwatch_api_projects();
5619
- init_dashboard_exists();
5627
+ init_langwatch_api_dashboards();
5628
+ init_langwatch_api();
5620
5629
  init_dashboard_widget_queries();
5621
5630
  }
5622
5631
  });
@@ -5627,22 +5636,25 @@ __export(update_dashboard_widget_exports, {
5627
5636
  handleUpdateDashboardWidget: () => handleUpdateDashboardWidget
5628
5637
  });
5629
5638
  async function handleUpdateDashboardWidget(params) {
5630
- const { dashboardId, widgetId, name, code, description } = params;
5631
- if (name === void 0 && code === void 0 && params.queries === void 0 && description === void 0) {
5632
- throw new Error("Provide at least one of name, code, queries or description to change.");
5633
- }
5634
- const queries = params.queries === void 0 ? void 0 : normalizeDashboardWidgetQueries({ queries: params.queries });
5635
- const project = await getCurrentProject();
5636
- await assertDashboardExists({ projectId: project.id, dashboardId });
5637
- const current = await getWidgetOnDashboard({ projectId: project.id, widgetId, dashboardId });
5638
- const widget = await updateDashboardWidget({
5639
- projectId: project.id,
5640
- widgetId: current.id,
5639
+ const { dashboardId, widgetId, name, code, description, sources, projects } = params;
5640
+ const fields = [name, code, params.queries, description, sources, projects];
5641
+ if (fields.every((field) => field === void 0)) {
5642
+ throw new Error(
5643
+ "Provide at least one of name, code, queries, description, sources or projects to change."
5644
+ );
5645
+ }
5646
+ const current = await widgetOnDashboardOrRefused({ widgetId, dashboardId });
5647
+ const given = params.queries === void 0 ? void 0 : normalizeDashboardWidgetQueries({ queries: params.queries });
5648
+ const listed = sources !== void 0 || projects !== void 0;
5649
+ const base = given ?? (listed ? current.definition.queries : void 0);
5650
+ const queries = base === void 0 ? void 0 : withLists({ queries: base, sources, projects });
5651
+ const changes = {
5641
5652
  ...name === void 0 ? {} : { name },
5642
5653
  ...code === void 0 ? {} : { code },
5643
5654
  ...queries === void 0 ? {} : { queries },
5644
5655
  ...description === void 0 ? {} : { description }
5645
- });
5656
+ };
5657
+ const widget = await updateWidgetOnDashboard({ dashboardId, widgetId: current.id, ...changes });
5646
5658
  return [
5647
5659
  `Widget "${widget.name}" updated on dashboard "${dashboardId}".`,
5648
5660
  `**Widget ID**: ${widget.id}`,
@@ -5653,40 +5665,116 @@ async function handleUpdateDashboardWidget(params) {
5653
5665
  "```"
5654
5666
  ].join("\n");
5655
5667
  }
5656
- async function getWidgetOnDashboard({
5657
- projectId: projectId2,
5668
+ async function widgetOnDashboardOrRefused({
5658
5669
  widgetId,
5659
5670
  dashboardId
5660
5671
  }) {
5661
- let widget;
5662
5672
  try {
5663
- widget = await getDashboardWidget({ projectId: projectId2, widgetId });
5673
+ return await getWidgetOnDashboard({ dashboardId, widgetId });
5664
5674
  } catch (error) {
5665
5675
  if (error instanceof LangWatchApiError && error.status === 404) {
5666
5676
  throw new Error(
5667
- `No widget with ID "${widgetId}" was found in this project. Use the widget ID add_dashboard_widget returned.`
5677
+ `No widget with ID "${widgetId}" was found on dashboard "${dashboardId}". Use the widget ID add_dashboard_widget returned, and the dashboard it was added to.`
5668
5678
  );
5669
5679
  }
5670
5680
  throw error;
5671
5681
  }
5672
- if (widget.dashboardId !== dashboardId) {
5673
- throw new Error(
5674
- `Widget "${widgetId}" is not on dashboard "${dashboardId}". Pass the dashboard the widget was added to.`
5675
- );
5676
- }
5677
- return widget;
5678
5682
  }
5679
5683
  var init_update_dashboard_widget = __esm({
5680
5684
  "src/tools/update-dashboard-widget.ts"() {
5681
5685
  "use strict";
5682
- init_langwatch_api_dashboard_widgets();
5683
- init_langwatch_api_projects();
5686
+ init_langwatch_api_dashboards();
5684
5687
  init_langwatch_api();
5685
- init_dashboard_exists();
5686
5688
  init_dashboard_widget_queries();
5687
5689
  }
5688
5690
  });
5689
5691
 
5692
+ // src/tools/dashboards.ts
5693
+ var dashboards_exports = {};
5694
+ __export(dashboards_exports, {
5695
+ handleCreateDashboard: () => handleCreateDashboard,
5696
+ handleDeleteDashboard: () => handleDeleteDashboard,
5697
+ handleDeleteDashboardWidget: () => handleDeleteDashboardWidget,
5698
+ handleGetDashboard: () => handleGetDashboard,
5699
+ handleListDashboardWidgets: () => handleListDashboardWidgets,
5700
+ handleRenameDashboard: () => handleRenameDashboard
5701
+ });
5702
+ function describeDashboard(dashboard) {
5703
+ return [
5704
+ `**Name**: ${dashboard.name}`,
5705
+ `**ID**: ${dashboard.id}`,
5706
+ `**Scope**: ${dashboard.scope}`,
5707
+ ...dashboard.description ? [`**Description**: ${dashboard.description}`] : [],
5708
+ `**URL**: ${dashboard.platformUrl}`
5709
+ ];
5710
+ }
5711
+ async function handleGetDashboard({
5712
+ dashboardId
5713
+ }) {
5714
+ const dashboard = await getDashboard({ dashboardId });
5715
+ return [`# ${dashboard.name}
5716
+ `, ...describeDashboard(dashboard)].join("\n");
5717
+ }
5718
+ async function handleCreateDashboard({ name }) {
5719
+ const dashboard = await createDashboard({ name });
5720
+ return [
5721
+ "Dashboard created.\n",
5722
+ ...describeDashboard(dashboard),
5723
+ "",
5724
+ "> Pass the ID to `add_dashboard_widget` to add a widget to it."
5725
+ ].join("\n");
5726
+ }
5727
+ async function handleRenameDashboard({
5728
+ dashboardId,
5729
+ name,
5730
+ description
5731
+ }) {
5732
+ if (name === void 0 && description === void 0) {
5733
+ throw new Error("Provide at least one of name or description to change.");
5734
+ }
5735
+ const dashboard = await updateDashboard({
5736
+ dashboardId,
5737
+ ...name === void 0 ? {} : { name },
5738
+ ...description === void 0 ? {} : { description }
5739
+ });
5740
+ return ["Dashboard updated.\n", ...describeDashboard(dashboard)].join("\n");
5741
+ }
5742
+ async function handleDeleteDashboard({
5743
+ dashboardId
5744
+ }) {
5745
+ const deleted = await deleteDashboard({ dashboardId });
5746
+ return `Dashboard "${deleted.name}" deleted with its widgets (ID: ${deleted.id}).`;
5747
+ }
5748
+ async function handleListDashboardWidgets({
5749
+ dashboardId
5750
+ }) {
5751
+ const { data: widgets } = await listWidgetsOnDashboard({ dashboardId });
5752
+ if (widgets.length === 0) return `Dashboard "${dashboardId}" has no widgets.`;
5753
+ return [
5754
+ `# Widgets on dashboard ${dashboardId} (${widgets.length} total)
5755
+ `,
5756
+ ...widgets.flatMap((widget) => [
5757
+ `## ${widget.name}`,
5758
+ `**ID**: ${widget.id}`,
5759
+ `**Queries**: ${widget.definition.queries.map((query) => query.name).join(", ") || "(none)"}`,
5760
+ ""
5761
+ ])
5762
+ ].join("\n");
5763
+ }
5764
+ async function handleDeleteDashboardWidget({
5765
+ dashboardId,
5766
+ widgetId
5767
+ }) {
5768
+ await deleteWidgetOnDashboard({ dashboardId, widgetId });
5769
+ return `Widget "${widgetId}" deleted from dashboard "${dashboardId}".`;
5770
+ }
5771
+ var init_dashboards = __esm({
5772
+ "src/tools/dashboards.ts"() {
5773
+ "use strict";
5774
+ init_langwatch_api_dashboards();
5775
+ }
5776
+ });
5777
+
5690
5778
  // src/tools/list-workflows.ts
5691
5779
  var list_workflows_exports = {};
5692
5780
  __export(list_workflows_exports, {
@@ -5938,7 +6026,7 @@ __export(langwatch_api_triggers_exports, {
5938
6026
  updateTrigger: () => updateTrigger
5939
6027
  });
5940
6028
  async function listTriggers() {
5941
- return import_zod7.z.array(triggerSchema).parse(await makeRequest("GET", "/api/v1/triggers"));
6029
+ return import_zod8.z.array(triggerSchema).parse(await makeRequest("GET", "/api/v1/triggers"));
5942
6030
  }
5943
6031
  async function getTrigger(id) {
5944
6032
  return triggerSchema.parse(
@@ -5981,11 +6069,11 @@ async function deleteTrigger(id) {
5981
6069
  await makeRequest("DELETE", `/api/v1/triggers/${encodeURIComponent(id)}`)
5982
6070
  );
5983
6071
  }
5984
- var import_zod7;
6072
+ var import_zod8;
5985
6073
  var init_langwatch_api_triggers = __esm({
5986
6074
  "src/langwatch-api-triggers.ts"() {
5987
6075
  "use strict";
5988
- import_zod7 = require("zod");
6076
+ import_zod8 = require("zod");
5989
6077
  init_langwatch_api();
5990
6078
  init_triggers();
5991
6079
  }
@@ -6620,6 +6708,41 @@ var init_delete_dataset_records = __esm({
6620
6708
  }
6621
6709
  });
6622
6710
 
6711
+ // src/langwatch-api-projects.ts
6712
+ async function listProjects(params) {
6713
+ const query = new URLSearchParams();
6714
+ if (params?.page) query.set("page", String(params.page));
6715
+ if (params?.limit) query.set("limit", String(params.limit));
6716
+ const qs = query.toString() ? `?${query}` : "";
6717
+ return makeRequest("GET", `/api/v1/projects${qs}`);
6718
+ }
6719
+ async function getProject(id) {
6720
+ return makeRequest(
6721
+ "GET",
6722
+ `/api/v1/projects/${encodeURIComponent(id)}`
6723
+ );
6724
+ }
6725
+ async function createProject(data) {
6726
+ return makeRequest("POST", "/api/v1/projects", data);
6727
+ }
6728
+ async function updateProject(params) {
6729
+ const { id, ...data } = params;
6730
+ return makeRequest(
6731
+ "PATCH",
6732
+ `/api/v1/projects/${encodeURIComponent(id)}`,
6733
+ data
6734
+ );
6735
+ }
6736
+ async function archiveProject(id) {
6737
+ return makeRequest("DELETE", `/api/v1/projects/${encodeURIComponent(id)}`);
6738
+ }
6739
+ var init_langwatch_api_projects = __esm({
6740
+ "src/langwatch-api-projects.ts"() {
6741
+ "use strict";
6742
+ init_langwatch_api();
6743
+ }
6744
+ });
6745
+
6623
6746
  // src/tools/list-projects.ts
6624
6747
  var list_projects_exports = {};
6625
6748
  __export(list_projects_exports, {
@@ -6886,7 +7009,7 @@ __export(create_mcp_server_exports, {
6886
7009
  });
6887
7010
  module.exports = __toCommonJS(create_mcp_server_exports);
6888
7011
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
6889
- var import_zod8 = require("zod");
7012
+ var import_zod9 = require("zod");
6890
7013
  init_package();
6891
7014
  init_config();
6892
7015
 
@@ -7008,6 +7131,38 @@ init_run_plan();
7008
7131
  init_suite_fields();
7009
7132
  init_triggers();
7010
7133
 
7134
+ // src/schemas/widget-sources.ts
7135
+ var import_zod5 = require("zod");
7136
+ var isAllWord = (id) => id.trim().toLowerCase() === "all";
7137
+ var WIDGET_SOURCES = [
7138
+ "application",
7139
+ "simulation",
7140
+ "evaluation",
7141
+ "sample",
7142
+ "coding_agent",
7143
+ "ai_tool",
7144
+ "gateway",
7145
+ "workflow",
7146
+ "playground",
7147
+ "langy",
7148
+ "other"
7149
+ ];
7150
+ var widgetSourcesInput = import_zod5.z.array(import_zod5.z.enum(WIDGET_SOURCES)).max(WIDGET_SOURCES.length).nullable().optional().describe(
7151
+ `The trace origins every query of the widget counts: any of ${WIDGET_SOURCES.join(", ")} (other = any origin not listed). A new widget counts ["application"]; add "langy" to count your own conversations, as a widget about Langy's requests needs. null makes it unset again, counting the default.`
7152
+ );
7153
+ var ALL_NOT_STORED = 'projects holds project ids; "all" is not stored in a widget';
7154
+ var widgetProjectsInput = import_zod5.z.array(import_zod5.z.string().min(1), {
7155
+ error: (issue) => typeof issue.input === "string" && isAllWord(issue.input) ? ALL_NOT_STORED : void 0
7156
+ }).min(1).refine((ids) => !ids.some(isAllWord), { message: ALL_NOT_STORED }).nullable().optional().describe(
7157
+ "The project ids every query of the widget reads, each one you can read. A new widget reads its board's project. null makes it unset again, reading the board's project."
7158
+ );
7159
+ var runQueryProjectsInput = import_zod5.z.union([
7160
+ import_zod5.z.string().refine(isAllWord),
7161
+ import_zod5.z.array(import_zod5.z.string().min(1)).min(1).refine((ids) => !ids.some(isAllWord), {
7162
+ message: '"all" stands alone; send it by itself, or list project ids'
7163
+ })
7164
+ ]);
7165
+
7011
7166
  // src/tools/get-experiment-results.ts
7012
7167
  init_langwatch_api();
7013
7168
 
@@ -7393,7 +7548,8 @@ init_langwatch_api();
7393
7548
  async function handleRunExperiment(params) {
7394
7549
  const result = await makeRequest(
7395
7550
  "POST",
7396
- `/api/v1/experiments/${encodeURIComponent(params.slug)}/run`
7551
+ `/api/v1/experiments/${encodeURIComponent(params.slug)}/run`,
7552
+ params.concurrency !== void 0 ? { concurrency: params.concurrency } : void 0
7397
7553
  );
7398
7554
  const lines = [];
7399
7555
  lines.push(`Evaluation started!
@@ -7548,8 +7704,8 @@ async function handleUpdateTestSuite(params) {
7548
7704
  }
7549
7705
 
7550
7706
  // src/create-mcp-server.ts
7551
- var modelSchema = import_zod8.z.string().describe(
7552
- 'Model in "provider/model-name" format, e.g., "openai/gpt-4o", "anthropic/claude-sonnet-4-5-20250929"'
7707
+ var modelSchema = import_zod9.z.string().describe(
7708
+ 'Model in "provider/model-name" format, e.g., "openai/gpt-6-luna", "anthropic/claude-sonnet-4-5-20250929"'
7553
7709
  );
7554
7710
  function createMcpServer() {
7555
7711
  const server = new import_mcp.McpServer({
@@ -7584,6 +7740,7 @@ function registerTools(server) {
7584
7740
  registerEvaluatorTools(server);
7585
7741
  registerModelProviderTools(server);
7586
7742
  registerAgentTools(server);
7743
+ registerAnalyticsReportTools(server);
7587
7744
  registerDashboardTools(server);
7588
7745
  registerWorkflowTools(server);
7589
7746
  registerAnnotationTools(server);
@@ -7600,7 +7757,7 @@ function registerDocsTools(server) {
7600
7757
  "fetch_langwatch_docs",
7601
7758
  "Fetches the LangWatch docs for understanding how to implement LangWatch in your codebase. Always use this tool when the user asks for help with LangWatch. Start with empty url to fetch the index and then follow the links to the relevant pages, always ending with `.md` extension",
7602
7759
  {
7603
- url: import_zod8.z.string().optional().describe(
7760
+ url: import_zod9.z.string().optional().describe(
7604
7761
  "The full url of the specific doc page. If not provided, the docs index will be fetched."
7605
7762
  )
7606
7763
  },
@@ -7613,18 +7770,18 @@ function registerDocsTools(server) {
7613
7770
  "report_issue",
7614
7771
  "Report an issue to the LangWatch team: anything that did not work, confused you, or took trial and error while using LangWatch (docs, MCP tools, CLI, SDKs, the platform). Use it whenever you struggled, it is how rough edges get fixed for every agent. Ask the user for permission first, then call with user_approved=true. Works without an API key. Put VERBATIM error messages in the summary; optionally attach raw session content. Secrets, API keys, emails and phone numbers are redacted locally before anything is sent.",
7615
7772
  {
7616
- user_approved: import_zod8.z.boolean().describe(
7773
+ user_approved: import_zod9.z.boolean().describe(
7617
7774
  "Must be true, and only after the user explicitly agreed to send this report to LangWatch"
7618
7775
  ),
7619
- title: import_zod8.z.string().max(300).describe("One-line description of the issue"),
7620
- summary: import_zod8.z.string().optional().describe(
7776
+ title: import_zod9.z.string().max(300).describe("One-line description of the issue"),
7777
+ summary: import_zod9.z.string().optional().describe(
7621
7778
  "What you were trying to do, what went wrong (verbatim errors), and what you had to figure out the hard way"
7622
7779
  ),
7623
- session_content: import_zod8.z.string().optional().describe(
7780
+ session_content: import_zod9.z.string().optional().describe(
7624
7781
  "Optional raw session transcript or log excerpt (JSONL or plain text); redacted locally before sending"
7625
7782
  ),
7626
- contact_email: import_zod8.z.string().optional().describe("Optional contact email for follow-up"),
7627
- agent: import_zod8.z.string().optional().describe("Which coding agent this is, e.g. claude-code, codex, cursor")
7783
+ contact_email: import_zod9.z.string().optional().describe("Optional contact email for follow-up"),
7784
+ agent: import_zod9.z.string().optional().describe("Which coding agent this is, e.g. claude-code, codex, cursor")
7628
7785
  },
7629
7786
  withToolLogging("report_issue", async (params) => {
7630
7787
  const { handleReportIssue: handleReportIssue2 } = await Promise.resolve().then(() => (init_report_issue(), report_issue_exports));
@@ -7637,7 +7794,7 @@ function registerDocsTools(server) {
7637
7794
  "fetch_scenario_docs",
7638
7795
  "Fetches the Scenario docs for understanding how to implement Scenario agent tests in your codebase. Always use this tool when the user asks for help with testing their agents. Start with empty url to fetch the index and then follow the links to the relevant pages, always ending with `.md` extension",
7639
7796
  {
7640
- url: import_zod8.z.string().optional().describe(
7797
+ url: import_zod9.z.string().optional().describe(
7641
7798
  "The full url of the specific doc page. If not provided, the docs index will be fetched."
7642
7799
  )
7643
7800
  },
@@ -7652,7 +7809,7 @@ function registerObservabilityTools(server) {
7652
7809
  "discover_schema",
7653
7810
  "Discover what LangWatch can be queried with: the trace filter fields and syntax, the analytics SQL views and columns, the analytics metrics, aggregation types, group-by options, scenario schema and evaluator types. Call this before using search_traces, run_query, get_analytics, scenario tools or evaluator tools, so you never guess a field, a column or a value.",
7654
7811
  {
7655
- category: import_zod8.z.enum([
7812
+ category: import_zod9.z.enum([
7656
7813
  "filters",
7657
7814
  "lwql",
7658
7815
  "metrics",
@@ -7664,7 +7821,7 @@ function registerObservabilityTools(server) {
7664
7821
  ]).describe(
7665
7822
  "Which schema category to discover. 'filters' is the trace filter language, 'lwql' the analytics SQL views; both are read from the platform and need the API key"
7666
7823
  ),
7667
- evaluatorType: import_zod8.z.string().optional().describe(
7824
+ evaluatorType: import_zod9.z.string().optional().describe(
7668
7825
  "When category is 'evaluators', provide a specific evaluator type (e.g. 'langevals/llm_boolean') to get its full schema details"
7669
7826
  )
7670
7827
  },
@@ -7697,11 +7854,17 @@ function registerObservabilityTools(server) {
7697
7854
  "run_query",
7698
7855
  "Run one read-only analytics SQL statement (LangWatchQL) over this project's traces, spans, evaluations and metrics, and get the rows back as a table. This is the tool for a count, a rate, a sum, a percentile or any of them grouped or over time \u2014 questions search_traces would need many calls to answer. The statement runs exactly as written. Call discover_schema with category 'lwql' first for the views, columns and worked statements.",
7699
7856
  {
7700
- sql: import_zod8.z.string().describe(
7857
+ sql: import_zod9.z.string().describe(
7701
7858
  "The SELECT to run. Filter on the dataset's time column so the read is bounded, and never select a whole attribute map"
7702
7859
  ),
7703
- parameters: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.union([import_zod8.z.string(), import_zod8.z.number(), import_zod8.z.boolean(), import_zod8.z.null()])).optional().describe(
7860
+ parameters: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.union([import_zod9.z.string(), import_zod9.z.number(), import_zod9.z.boolean(), import_zod9.z.null()])).optional().describe(
7704
7861
  'Values for the parameters the statement declares, e.g. {"days": 7} for {days:UInt32}'
7862
+ ),
7863
+ projects: runQueryProjectsInput.optional().describe(
7864
+ 'The project ids to read, or the string "all" for every project the key can read (params.dashboard_context_projects lists them). A key that reaches several projects must name them or send "all"; a key that reads one project defaults to it'
7865
+ ),
7866
+ sources: import_zod9.z.array(import_zod9.z.string()).optional().describe(
7867
+ "The trace sources {dashboard_context_sources:Array(String)} is bound to (default application). Only a statement that reads that parameter is kept to them; a SOURCES_IGNORED diagnostic says it did not"
7705
7868
  )
7706
7869
  },
7707
7870
  withToolLogging("run_query", async (params) => {
@@ -7716,25 +7879,25 @@ function registerObservabilityTools(server) {
7716
7879
  "search_traces",
7717
7880
  "Search LangWatch traces by content, with filters and a date range. Returns AI-readable trace digests by default. Use format: 'json' for full raw data. To fetch a trace you already have the ID for, use get_trace instead \u2014 free text does not match trace IDs.",
7718
7881
  {
7719
- query: import_zod8.z.string().optional().describe(
7882
+ query: import_zod9.z.string().optional().describe(
7720
7883
  "Text search query. Matches captured input/output, the trace name and span names ONLY. It does not match trace IDs \u2014 to fetch a known trace ID use get_trace, or pass traceIds here for several at once."
7721
7884
  ),
7722
- traceIds: import_zod8.z.array(import_zod8.z.string().min(1)).min(1).max(1e3).optional().describe(
7885
+ traceIds: import_zod9.z.array(import_zod9.z.string().min(1)).min(1).max(1e3).optional().describe(
7723
7886
  "Exact trace IDs to fetch (1\u20131000). Use instead of query when you already know the IDs. When set and no startDate is given, the window defaults to the last 90 days rather than 24 hours."
7724
7887
  ),
7725
- filters: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.array(import_zod8.z.string())).optional().describe(
7888
+ filters: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.array(import_zod9.z.string())).optional().describe(
7726
7889
  'Filter traces by the older per-field map. Format: {"field": ["value"]}. Use discover_schema for field names.'
7727
7890
  ),
7728
- filter: import_zod8.z.string().optional().describe(
7891
+ filter: import_zod9.z.string().optional().describe(
7729
7892
  'Filter traces with the Trace Explorer\'s own query language: "status:error AND model:gpt-*", "trace.attribute.langwatch.user_id:alice", "evaluatorVerdict:fail", a quoted phrase for free text. Reaches attribute keys, span events and evaluator verdicts that the `filters` map cannot. Combined with `filters` and `query` when you send more than one. Call discover_schema with category \'filters\' for every field and the syntax.'
7730
7893
  ),
7731
- startDate: import_zod8.z.string().min(1).optional().describe(
7894
+ startDate: import_zod9.z.string().min(1).optional().describe(
7732
7895
  'Start of the window: ISO date, or relative like "24h", "7d", "4w", "3m" \u2014 units are h (hours), d (days), w (weeks), m (30-day months). Defaults to 24h ago for a text search, or 90d when traceIds is set. Widen this when a search comes back empty.'
7733
7896
  ),
7734
- endDate: import_zod8.z.string().min(1).optional().describe("End of the window: ISO date or relative. Default: now"),
7735
- pageSize: import_zod8.z.number().optional().describe("Results per page (default: 25, max: 1000)"),
7736
- scrollId: import_zod8.z.string().optional().describe("Pagination token from previous search"),
7737
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
7897
+ endDate: import_zod9.z.string().min(1).optional().describe("End of the window: ISO date or relative. Default: now"),
7898
+ pageSize: import_zod9.z.number().optional().describe("Results per page (default: 25, max: 1000)"),
7899
+ scrollId: import_zod9.z.string().optional().describe("Pagination token from previous search"),
7900
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
7738
7901
  },
7739
7902
  withToolLogging("search_traces", async (params) => {
7740
7903
  requireApiKey();
@@ -7748,10 +7911,10 @@ function registerObservabilityTools(server) {
7748
7911
  "get_trace",
7749
7912
  "Get full details of a single trace by ID. This is the right tool whenever you have a trace ID \u2014 search_traces does not match IDs. A full ID resolves at any age; a unique 8\u201331 character hex prefix resolves within the last 90 days. Returns AI-readable trace digest by default. Use format: 'json' for full raw data including all spans.",
7750
7913
  {
7751
- traceId: import_zod8.z.string().describe(
7914
+ traceId: import_zod9.z.string().describe(
7752
7915
  "The trace ID to retrieve. A full ID resolves at any age; a unique 8\u201331 character hex prefix also resolves, git-style, within the last 90 days."
7753
7916
  ),
7754
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
7917
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
7755
7918
  },
7756
7919
  withToolLogging("get_trace", async (params) => {
7757
7920
  requireApiKey();
@@ -7765,17 +7928,17 @@ function registerObservabilityTools(server) {
7765
7928
  "get_analytics",
7766
7929
  'Query analytics timeseries from LangWatch. Metrics use "category.name" format (e.g., "performance.completion_time"). Use discover_schema to see available metrics.',
7767
7930
  {
7768
- metric: import_zod8.z.string().describe(
7931
+ metric: import_zod9.z.string().describe(
7769
7932
  'Metric in "category.name" format, e.g., "metadata.trace_id", "performance.total_cost"'
7770
7933
  ),
7771
- aggregation: import_zod8.z.string().optional().describe(
7934
+ aggregation: import_zod9.z.string().optional().describe(
7772
7935
  "Aggregation type: avg, sum, min, max, median, p90, p95, p99, cardinality, terms. Default: avg"
7773
7936
  ),
7774
- startDate: import_zod8.z.string().optional().describe('Start date: ISO or relative ("7d", "30d"). Default: 7 days ago'),
7775
- endDate: import_zod8.z.string().optional().describe("End date. Default: now"),
7776
- timeZone: import_zod8.z.string().optional().describe("Timezone. Default: UTC"),
7777
- groupBy: import_zod8.z.string().optional().describe("Group results by field. Use discover_schema for options."),
7778
- filters: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.array(import_zod8.z.string())).optional().describe("Filters to apply")
7937
+ startDate: import_zod9.z.string().optional().describe('Start date: ISO or relative ("7d", "30d"). Default: 7 days ago'),
7938
+ endDate: import_zod9.z.string().optional().describe("End date. Default: now"),
7939
+ timeZone: import_zod9.z.string().optional().describe("Timezone. Default: UTC"),
7940
+ groupBy: import_zod9.z.string().optional().describe("Group results by field. Use discover_schema for options."),
7941
+ filters: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.array(import_zod9.z.string())).optional().describe("Filters to apply")
7779
7942
  },
7780
7943
  withToolLogging("get_analytics", async (params) => {
7781
7944
  requireApiKey();
@@ -7798,16 +7961,16 @@ NOTE: Prompts can be managed two ways. Determine which approach the user needs:
7798
7961
  2. Platform-based (LangWatch UI): If the user wants to manage prompts directly on the LangWatch platform, use the \`platform_\` MCP tools (\`platform_create_prompt\`, \`platform_update_prompt\`, etc.).
7799
7962
  `,
7800
7963
  {
7801
- name: import_zod8.z.string().describe("Prompt display name"),
7802
- handle: import_zod8.z.string().optional().describe("URL-friendly handle (auto-generated from name if omitted)"),
7803
- messages: import_zod8.z.array(
7804
- import_zod8.z.object({
7805
- role: import_zod8.z.enum(["system", "user", "assistant"]).describe("Message role"),
7806
- content: import_zod8.z.string().describe("Message content")
7964
+ name: import_zod9.z.string().describe("Prompt display name"),
7965
+ handle: import_zod9.z.string().optional().describe("URL-friendly handle (auto-generated from name if omitted)"),
7966
+ messages: import_zod9.z.array(
7967
+ import_zod9.z.object({
7968
+ role: import_zod9.z.enum(["system", "user", "assistant"]).describe("Message role"),
7969
+ content: import_zod9.z.string().describe("Message content")
7807
7970
  })
7808
7971
  ).describe("Prompt messages"),
7809
7972
  model: modelSchema,
7810
- tags: import_zod8.z.array(import_zod8.z.string()).optional().describe(
7973
+ tags: import_zod9.z.array(import_zod9.z.string()).optional().describe(
7811
7974
  'Tags to assign to the initial version (e.g., ["production", "staging"]). Built-in tags: "latest" (auto-assigned), "production", "staging". Custom tags must be created first.'
7812
7975
  )
7813
7976
  },
@@ -7835,12 +7998,12 @@ NOTE: Prompts can be managed two ways. Determine which approach the user needs:
7835
7998
  "platform_get_prompt",
7836
7999
  "Get a specific prompt from the LangWatch platform by ID or handle, including messages, model config, and version history. Use format: 'json' for the full raw API payload, or 'digest' (default) for a formatted summary.",
7837
8000
  {
7838
- idOrHandle: import_zod8.z.string().describe("Prompt ID or handle"),
7839
- version: import_zod8.z.number().optional().describe("Specific version number (default: latest)"),
7840
- tag: import_zod8.z.string().optional().describe(
8001
+ idOrHandle: import_zod9.z.string().describe("Prompt ID or handle"),
8002
+ version: import_zod9.z.number().optional().describe("Specific version number (default: latest)"),
8003
+ tag: import_zod9.z.string().optional().describe(
7841
8004
  'Fetch the version pointed to by this tag (e.g., "production", "staging"). Alternatively, use shorthand in idOrHandle: "pizza-prompt:production"'
7842
8005
  ),
7843
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
8006
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
7844
8007
  },
7845
8008
  withToolLogging("platform_get_prompt", async (params) => {
7846
8009
  if (params.version != null && params.tag) {
@@ -7860,16 +8023,16 @@ NOTE: Prompts can be managed two ways. Determine which approach the user needs:
7860
8023
  "platform_update_prompt",
7861
8024
  "Update an existing prompt on the LangWatch platform. Every update creates a new version.",
7862
8025
  {
7863
- idOrHandle: import_zod8.z.string().describe("Prompt ID or handle to update"),
7864
- messages: import_zod8.z.array(
7865
- import_zod8.z.object({
7866
- role: import_zod8.z.enum(["system", "user", "assistant"]),
7867
- content: import_zod8.z.string()
8026
+ idOrHandle: import_zod9.z.string().describe("Prompt ID or handle to update"),
8027
+ messages: import_zod9.z.array(
8028
+ import_zod9.z.object({
8029
+ role: import_zod9.z.enum(["system", "user", "assistant"]),
8030
+ content: import_zod9.z.string()
7868
8031
  })
7869
8032
  ).optional().describe("Updated messages"),
7870
8033
  model: modelSchema.optional(),
7871
- commitMessage: import_zod8.z.string().describe("Commit message describing the change"),
7872
- tags: import_zod8.z.array(import_zod8.z.string()).optional().describe("Tags to assign to the new version created by this update.")
8034
+ commitMessage: import_zod9.z.string().describe("Commit message describing the change"),
8035
+ tags: import_zod9.z.array(import_zod9.z.string()).optional().describe("Tags to assign to the new version created by this update.")
7873
8036
  },
7874
8037
  withToolLogging("platform_update_prompt", async (params) => {
7875
8038
  requireApiKey();
@@ -7883,9 +8046,9 @@ NOTE: Prompts can be managed two ways. Determine which approach the user needs:
7883
8046
  "platform_assign_prompt_tag",
7884
8047
  'Assign a tag (e.g. "production") to a specific version of a prompt. Use this to "deploy" a version by promoting it to the production tag.',
7885
8048
  {
7886
- idOrHandle: import_zod8.z.string().describe("Prompt ID or handle"),
7887
- tag: import_zod8.z.string().describe('Tag name (e.g., "production", "staging")'),
7888
- versionId: import_zod8.z.string().describe("The version ID to assign the tag to")
8049
+ idOrHandle: import_zod9.z.string().describe("Prompt ID or handle"),
8050
+ tag: import_zod9.z.string().describe('Tag name (e.g., "production", "staging")'),
8051
+ versionId: import_zod9.z.string().describe("The version ID to assign the tag to")
7889
8052
  },
7890
8053
  withToolLogging("platform_assign_prompt_tag", async (params) => {
7891
8054
  requireApiKey();
@@ -7911,7 +8074,7 @@ NOTE: Prompts can be managed two ways. Determine which approach the user needs:
7911
8074
  "platform_create_prompt_tag",
7912
8075
  'Create a custom prompt tag definition for the organization. Tag names must be non-numeric and not "latest".',
7913
8076
  {
7914
- name: import_zod8.z.string().describe("Tag name to create")
8077
+ name: import_zod9.z.string().describe("Tag name to create")
7915
8078
  },
7916
8079
  withToolLogging("platform_create_prompt_tag", async (params) => {
7917
8080
  requireApiKey();
@@ -7925,8 +8088,8 @@ NOTE: Prompts can be managed two ways. Determine which approach the user needs:
7925
8088
  "platform_rename_prompt_tag",
7926
8089
  'Rename an existing prompt tag. The "latest" tag cannot be renamed.',
7927
8090
  {
7928
- tag: import_zod8.z.string().describe("Current tag name to rename"),
7929
- name: import_zod8.z.string().describe("New tag name")
8091
+ tag: import_zod9.z.string().describe("Current tag name to rename"),
8092
+ name: import_zod9.z.string().describe("New tag name")
7930
8093
  },
7931
8094
  withToolLogging("platform_rename_prompt_tag", async (params) => {
7932
8095
  requireApiKey();
@@ -7940,7 +8103,7 @@ NOTE: Prompts can be managed two ways. Determine which approach the user needs:
7940
8103
  "platform_delete_prompt_tag",
7941
8104
  'Delete a prompt tag and all its assignments. The "latest" tag cannot be deleted.',
7942
8105
  {
7943
- tag: import_zod8.z.string().describe("Tag name to delete")
8106
+ tag: import_zod9.z.string().describe("Tag name to delete")
7944
8107
  },
7945
8108
  withToolLogging("platform_delete_prompt_tag", async (params) => {
7946
8109
  requireApiKey();
@@ -7963,11 +8126,11 @@ NOTE: Scenarios can be created two ways. Determine which approach the user needs
7963
8126
  2. Platform-based (LangWatch UI): If the user wants to manage scenarios directly on the LangWatch platform, use the \`platform_\` MCP tools (\`platform_create_scenario\`, \`platform_update_scenario\`, etc.).
7964
8127
  `,
7965
8128
  {
7966
- name: import_zod8.z.string().describe("Scenario name"),
7967
- situation: import_zod8.z.string().describe("The context or setup describing what the user/agent is doing"),
7968
- criteria: import_zod8.z.array(import_zod8.z.string()).optional().describe("Pass/fail conditions the agent's response must satisfy"),
7969
- labels: import_zod8.z.array(import_zod8.z.string()).optional().describe("Tags for organizing and filtering scenarios"),
7970
- testSuiteId: import_zod8.z.string().nullish().describe(
8129
+ name: import_zod9.z.string().describe("Scenario name"),
8130
+ situation: import_zod9.z.string().describe("The context or setup describing what the user/agent is doing"),
8131
+ criteria: import_zod9.z.array(import_zod9.z.string()).optional().describe("Pass/fail conditions the agent's response must satisfy"),
8132
+ labels: import_zod9.z.array(import_zod9.z.string()).optional().describe("Tags for organizing and filtering scenarios"),
8133
+ testSuiteId: import_zod9.z.string().nullish().describe(
7971
8134
  "The test suite to file this scenario in. Pass a test suite ID, or null to unfile it."
7972
8135
  ),
7973
8136
  fields: scenarioFieldValuesSchema.optional()
@@ -7984,8 +8147,8 @@ NOTE: Scenarios can be created two ways. Determine which approach the user needs
7984
8147
  "platform_list_scenarios",
7985
8148
  "List all scenarios on the LangWatch platform. Returns AI-readable digest by default.",
7986
8149
  {
7987
- testSuiteId: import_zod8.z.string().optional().describe("Only the scenarios filed in this test suite"),
7988
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
8150
+ testSuiteId: import_zod9.z.string().optional().describe("Only the scenarios filed in this test suite"),
8151
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
7989
8152
  },
7990
8153
  withToolLogging("platform_list_scenarios", async (params) => {
7991
8154
  requireApiKey();
@@ -7999,8 +8162,8 @@ NOTE: Scenarios can be created two ways. Determine which approach the user needs
7999
8162
  "platform_get_scenario",
8000
8163
  "Get full details of a scenario on the LangWatch platform by ID, including situation, criteria, and labels.",
8001
8164
  {
8002
- scenarioId: import_zod8.z.string().describe("The scenario ID to retrieve"),
8003
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
8165
+ scenarioId: import_zod9.z.string().describe("The scenario ID to retrieve"),
8166
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
8004
8167
  },
8005
8168
  withToolLogging("platform_get_scenario", async (params) => {
8006
8169
  requireApiKey();
@@ -8014,12 +8177,12 @@ NOTE: Scenarios can be created two ways. Determine which approach the user needs
8014
8177
  "platform_update_scenario",
8015
8178
  "Update an existing scenario on the LangWatch platform.",
8016
8179
  {
8017
- scenarioId: import_zod8.z.string().describe("The scenario ID to update"),
8018
- name: import_zod8.z.string().optional().describe("Updated scenario name"),
8019
- situation: import_zod8.z.string().optional().describe("Updated situation"),
8020
- criteria: import_zod8.z.array(import_zod8.z.string()).optional().describe("Updated criteria"),
8021
- labels: import_zod8.z.array(import_zod8.z.string()).optional().describe("Updated labels"),
8022
- testSuiteId: import_zod8.z.string().nullish().describe(
8180
+ scenarioId: import_zod9.z.string().describe("The scenario ID to update"),
8181
+ name: import_zod9.z.string().optional().describe("Updated scenario name"),
8182
+ situation: import_zod9.z.string().optional().describe("Updated situation"),
8183
+ criteria: import_zod9.z.array(import_zod9.z.string()).optional().describe("Updated criteria"),
8184
+ labels: import_zod9.z.array(import_zod9.z.string()).optional().describe("Updated labels"),
8185
+ testSuiteId: import_zod9.z.string().nullish().describe(
8023
8186
  "The test suite to file this scenario in. Pass a test suite ID, or null to unfile it."
8024
8187
  ),
8025
8188
  fields: scenarioFieldValuesSchema.optional()
@@ -8036,7 +8199,7 @@ NOTE: Scenarios can be created two ways. Determine which approach the user needs
8036
8199
  "platform_archive_scenario",
8037
8200
  "Archive (soft-delete) a scenario on the LangWatch platform.",
8038
8201
  {
8039
- scenarioId: import_zod8.z.string().describe("The scenario ID to archive")
8202
+ scenarioId: import_zod9.z.string().describe("The scenario ID to archive")
8040
8203
  },
8041
8204
  withToolLogging("platform_archive_scenario", async (params) => {
8042
8205
  requireApiKey();
@@ -8052,27 +8215,27 @@ function registerRunPlanTools(server) {
8052
8215
  "platform_run_plan",
8053
8216
  "Run scenarios against targets. The plan name identifies the run plan: an existing name is re-run with the configuration you send here, a new name creates the plan. Configuration is the scope, the targets, the repeat count and the models; parameters, the note and the idempotency key belong to this run alone. Send more than one target to compare them in the same run, and give a target its own parameters to compare one agent on two models.",
8054
8217
  {
8055
- name: import_zod8.z.string().optional().describe(
8218
+ name: import_zod9.z.string().optional().describe(
8056
8219
  "The run plan to run. An existing name is replaced with this configuration, a new name creates the plan. Omit to let the server name it after the suite and the target."
8057
8220
  ),
8058
8221
  scope: runPlanScopeSchema.describe(
8059
8222
  "What the plan covers: every scenario in the project, the scenarios filed in given test suites, the scenarios carrying given labels, or the hand-picked list in scenarioIds."
8060
8223
  ),
8061
- scenarioIds: import_zod8.z.array(import_zod8.z.string()).optional().describe("The scenarios to run. Read only when scope.mode is 'scenarios'."),
8062
- targets: import_zod8.z.array(runPlanTargetSchema).describe(
8224
+ scenarioIds: import_zod9.z.array(import_zod9.z.string()).optional().describe("The scenarios to run. Read only when scope.mode is 'scenarios'."),
8225
+ targets: import_zod9.z.array(runPlanTargetSchema).describe(
8063
8226
  "What to run the scenarios against. Every target runs every scenario, and the results show one column for each, so this is how one run compares two agents or one agent on two models."
8064
8227
  ),
8065
- repeatCount: import_zod8.z.number().int().min(1).max(5).optional().describe("How many times to run each scenario against each target (1 to 5, default 1)"),
8066
- simulatorModel: import_zod8.z.string().optional().describe("Model that plays the user. Omit for the project default."),
8067
- judgeModel: import_zod8.z.string().optional().describe("Model that judges the criteria. Omit for the project default."),
8228
+ repeatCount: import_zod9.z.number().int().min(1).max(5).optional().describe("How many times to run each scenario against each target (1 to 5, default 1)"),
8229
+ simulatorModel: import_zod9.z.string().optional().describe("Model that plays the user. Omit for the project default."),
8230
+ judgeModel: import_zod9.z.string().optional().describe("Model that judges the criteria. Omit for the project default."),
8068
8231
  evaluators: evaluatorAttachmentsSchema.optional().describe(
8069
8232
  "The plan's own evaluators, run beside the ones attached to the test suites its scenarios belong to. A plan evaluator reads the conversation and the trace, never a scenario field. Omit to keep what the plan already holds. See discover_schema({ category: 'scenarios' }) for the mapping paths."
8070
8233
  ),
8071
8234
  parameters: runParametersSchema.optional().describe(
8072
8235
  "Values for the parameters the scenarios declare, by name. They apply to every target; a target that names the same parameter overrides them for itself."
8073
8236
  ),
8074
- note: import_zod8.z.string().max(200).optional().describe("One short line saying why this run was started (max 200 characters)"),
8075
- idempotencyKey: import_zod8.z.string().optional().describe(
8237
+ note: import_zod9.z.string().max(200).optional().describe("One short line saying why this run was started (max 200 characters)"),
8238
+ idempotencyKey: import_zod9.z.string().optional().describe(
8076
8239
  "Send the same key to make a retry join the run it already started instead of starting a second one."
8077
8240
  )
8078
8241
  },
@@ -8088,8 +8251,8 @@ function registerRunPlanTools(server) {
8088
8251
  "platform_list_run_plans",
8089
8252
  "List the run plans of the project. A run plan holds the configuration a run used, keyed by its name.",
8090
8253
  {
8091
- includeArchived: import_zod8.z.boolean().optional().describe("Include archived plans (default false)"),
8092
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default) or 'json' (raw data)")
8254
+ includeArchived: import_zod9.z.boolean().optional().describe("Include archived plans (default false)"),
8255
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default) or 'json' (raw data)")
8093
8256
  },
8094
8257
  withToolLogging("platform_list_run_plans", async (params) => {
8095
8258
  requireApiKey();
@@ -8103,8 +8266,8 @@ function registerRunPlanTools(server) {
8103
8266
  "platform_get_run_plan",
8104
8267
  "Get the full configuration of a run plan: what it covers, its targets, its repeat count and its models.",
8105
8268
  {
8106
- id: import_zod8.z.string().describe("The run plan ID"),
8107
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default) or 'json'")
8269
+ id: import_zod9.z.string().describe("The run plan ID"),
8270
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default) or 'json'")
8108
8271
  },
8109
8272
  withToolLogging("platform_get_run_plan", async (params) => {
8110
8273
  requireApiKey();
@@ -8118,9 +8281,9 @@ function registerRunPlanTools(server) {
8118
8281
  "platform_rerun_run_plan",
8119
8282
  "Run a plan again with the configuration it already holds. Only the parameters and the note belong to the new run.",
8120
8283
  {
8121
- id: import_zod8.z.string().describe("The run plan ID to run again"),
8284
+ id: import_zod9.z.string().describe("The run plan ID to run again"),
8122
8285
  parameters: runParametersSchema.optional().describe("Values for the parameters the scenarios declare, by name."),
8123
- note: import_zod8.z.string().max(200).optional().describe("One short line saying why this run was started (max 200 characters)")
8286
+ note: import_zod9.z.string().max(200).optional().describe("One short line saying why this run was started (max 200 characters)")
8124
8287
  },
8125
8288
  withToolLogging("platform_rerun_run_plan", async (params) => {
8126
8289
  requireApiKey();
@@ -8134,7 +8297,7 @@ function registerRunPlanTools(server) {
8134
8297
  "platform_archive_run_plan",
8135
8298
  "Archive a run plan. Its past runs stay readable and the name is free for a new plan.",
8136
8299
  {
8137
- id: import_zod8.z.string().describe("The run plan ID to archive")
8300
+ id: import_zod9.z.string().describe("The run plan ID to archive")
8138
8301
  },
8139
8302
  withToolLogging("platform_archive_run_plan", async (params) => {
8140
8303
  requireApiKey();
@@ -8150,7 +8313,7 @@ function registerTestSuiteTools(server) {
8150
8313
  "platform_list_test_suites",
8151
8314
  "List the test suites of the project. A test suite groups scenarios.",
8152
8315
  {
8153
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default) or 'json' (raw data)")
8316
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default) or 'json' (raw data)")
8154
8317
  },
8155
8318
  withToolLogging("platform_list_test_suites", async (params) => {
8156
8319
  requireApiKey();
@@ -8164,7 +8327,7 @@ function registerTestSuiteTools(server) {
8164
8327
  "platform_create_test_suite",
8165
8328
  "Create a test suite. A test suite groups scenarios: file a scenario in it by passing the suite ID as testSuiteId on platform_create_scenario or platform_update_scenario. A suite can declare typed fields every scenario carries a value for, and attach saved evaluators that run after every scenario run with mappings from their inputs to the conversation, the scenario's fields or the trace. Call discover_schema({ category: 'scenarios' }) first for the field rules and the mapping paths.",
8166
8329
  {
8167
- name: import_zod8.z.string().describe("Test suite name"),
8330
+ name: import_zod9.z.string().describe("Test suite name"),
8168
8331
  fields: suiteFieldsSchema.optional(),
8169
8332
  evaluators: evaluatorAttachmentsSchema.optional()
8170
8333
  },
@@ -8180,8 +8343,8 @@ function registerTestSuiteTools(server) {
8180
8343
  "platform_get_test_suite",
8181
8344
  "Get a test suite and the scenarios filed in it.",
8182
8345
  {
8183
- id: import_zod8.z.string().describe("The test suite ID"),
8184
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default) or 'json'")
8346
+ id: import_zod9.z.string().describe("The test suite ID"),
8347
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default) or 'json'")
8185
8348
  },
8186
8349
  withToolLogging("platform_get_test_suite", async (params) => {
8187
8350
  requireApiKey();
@@ -8195,8 +8358,8 @@ function registerTestSuiteTools(server) {
8195
8358
  "platform_update_test_suite",
8196
8359
  "Edit a test suite: any of its name, its fields and its evaluators. A field list or an evaluator list replaces the one the suite holds; a key left out keeps what the suite has. A field an attached evaluator still reads cannot be removed. Call discover_schema({ category: 'scenarios' }) first for the field rules and the mapping paths.",
8197
8360
  {
8198
- id: import_zod8.z.string().describe("The test suite ID"),
8199
- name: import_zod8.z.string().optional().describe("The new name. The slug is kept."),
8361
+ id: import_zod9.z.string().describe("The test suite ID"),
8362
+ name: import_zod9.z.string().optional().describe("The new name. The slug is kept."),
8200
8363
  fields: suiteFieldsSchema.optional().describe(
8201
8364
  "The full list of fields the suite declares. It replaces the list the suite holds."
8202
8365
  ),
@@ -8215,8 +8378,8 @@ function registerTestSuiteTools(server) {
8215
8378
  "platform_rename_test_suite",
8216
8379
  "Rename a test suite.",
8217
8380
  {
8218
- id: import_zod8.z.string().describe("The test suite ID"),
8219
- name: import_zod8.z.string().describe("The new name")
8381
+ id: import_zod9.z.string().describe("The test suite ID"),
8382
+ name: import_zod9.z.string().describe("The new name")
8220
8383
  },
8221
8384
  withToolLogging("platform_rename_test_suite", async (params) => {
8222
8385
  requireApiKey();
@@ -8230,7 +8393,7 @@ function registerTestSuiteTools(server) {
8230
8393
  "platform_archive_test_suite",
8231
8394
  "Archive a test suite. The scenarios filed in it are archived with it.",
8232
8395
  {
8233
- id: import_zod8.z.string().describe("The test suite ID to archive")
8396
+ id: import_zod9.z.string().describe("The test suite ID to archive")
8234
8397
  },
8235
8398
  withToolLogging("platform_archive_test_suite", async (params) => {
8236
8399
  requireApiKey();
@@ -8244,20 +8407,20 @@ function registerTestSuiteTools(server) {
8244
8407
  "platform_run_test_suite",
8245
8408
  "Run every scenario of a test suite against targets. This creates or joins the run plan named '<suite name> <target name>' unless you send a name of your own. Send more than one target to compare them in the same run, and give a target its own parameters to compare one agent on two models.",
8246
8409
  {
8247
- id: import_zod8.z.string().describe("The test suite ID to run"),
8248
- targets: import_zod8.z.array(runPlanTargetSchema).describe(
8410
+ id: import_zod9.z.string().describe("The test suite ID to run"),
8411
+ targets: import_zod9.z.array(runPlanTargetSchema).describe(
8249
8412
  "What to run the scenarios against. Every target runs every scenario, and the results show one column for each."
8250
8413
  ),
8251
- name: import_zod8.z.string().optional().describe(
8414
+ name: import_zod9.z.string().optional().describe(
8252
8415
  "The run plan to run. Omit to let the server name it after the suite and the target."
8253
8416
  ),
8254
- repeatCount: import_zod8.z.number().int().min(1).max(5).optional().describe("How many times to run each scenario against each target (1 to 5, default 1)"),
8255
- simulatorModel: import_zod8.z.string().optional().describe("Model that plays the user. Omit for the project default."),
8256
- judgeModel: import_zod8.z.string().optional().describe("Model that judges the criteria. Omit for the project default."),
8417
+ repeatCount: import_zod9.z.number().int().min(1).max(5).optional().describe("How many times to run each scenario against each target (1 to 5, default 1)"),
8418
+ simulatorModel: import_zod9.z.string().optional().describe("Model that plays the user. Omit for the project default."),
8419
+ judgeModel: import_zod9.z.string().optional().describe("Model that judges the criteria. Omit for the project default."),
8257
8420
  parameters: runParametersSchema.optional().describe(
8258
8421
  "Values for the parameters the scenarios declare, by name. They apply to every target; a target that names the same parameter overrides them for itself."
8259
8422
  ),
8260
- note: import_zod8.z.string().max(200).optional().describe("One short line saying why this run was started (max 200 characters)")
8423
+ note: import_zod9.z.string().max(200).optional().describe("One short line saying why this run was started (max 200 characters)")
8261
8424
  },
8262
8425
  withToolLogging("platform_run_test_suite", async (params) => {
8263
8426
  requireApiKey();
@@ -8273,10 +8436,10 @@ function registerSimulationRunTools(server) {
8273
8436
  "platform_list_simulation_runs",
8274
8437
  "List simulation run results. Filter by scenario set or batch run ID to see specific results.",
8275
8438
  {
8276
- scenarioSetId: import_zod8.z.string().optional().describe("Filter by scenario set ID"),
8277
- batchRunId: import_zod8.z.string().optional().describe("Filter by batch run ID"),
8278
- limit: import_zod8.z.number().optional().describe("Max results to return (default: 20)"),
8279
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format")
8439
+ scenarioSetId: import_zod9.z.string().optional().describe("Filter by scenario set ID"),
8440
+ batchRunId: import_zod9.z.string().optional().describe("Filter by batch run ID"),
8441
+ limit: import_zod9.z.number().optional().describe("Max results to return (default: 20)"),
8442
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format")
8280
8443
  },
8281
8444
  withToolLogging("platform_list_simulation_runs", async (params) => {
8282
8445
  requireApiKey();
@@ -8290,8 +8453,8 @@ function registerSimulationRunTools(server) {
8290
8453
  "platform_get_simulation_run",
8291
8454
  "Get full details of a simulation run including conversation messages, results, costs, the verdict and the result of every evaluator attached to its test suite or run plan.",
8292
8455
  {
8293
- scenarioRunId: import_zod8.z.string().describe("The simulation run ID"),
8294
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format")
8456
+ scenarioRunId: import_zod9.z.string().describe("The simulation run ID"),
8457
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format")
8295
8458
  },
8296
8459
  withToolLogging("platform_get_simulation_run", async (params) => {
8297
8460
  requireApiKey();
@@ -8307,8 +8470,8 @@ function registerEvaluatorTools(server) {
8307
8470
  "platform_create_evaluator",
8308
8471
  `Create an evaluator on the LangWatch platform. Useful for setting up LLM-as-judge and other evaluators to use in evaluation notebooks. Call discover_schema({ category: 'evaluators' }) first to see available evaluator types and their settings.`,
8309
8472
  {
8310
- name: import_zod8.z.string().describe("Evaluator name"),
8311
- config: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()).describe(
8473
+ name: import_zod9.z.string().describe("Evaluator name"),
8474
+ config: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.unknown()).describe(
8312
8475
  'Evaluator config object. Must include "evaluatorType" (e.g. "langevals/llm_boolean") and optional "settings" overrides.'
8313
8476
  )
8314
8477
  },
@@ -8336,7 +8499,7 @@ function registerEvaluatorTools(server) {
8336
8499
  "platform_get_evaluator",
8337
8500
  "Get full details of an evaluator on the LangWatch platform by ID or slug, including config, input fields, and output fields.",
8338
8501
  {
8339
- idOrSlug: import_zod8.z.string().describe("The evaluator ID or slug to retrieve")
8502
+ idOrSlug: import_zod9.z.string().describe("The evaluator ID or slug to retrieve")
8340
8503
  },
8341
8504
  withToolLogging("platform_get_evaluator", async (params) => {
8342
8505
  requireApiKey();
@@ -8350,9 +8513,9 @@ function registerEvaluatorTools(server) {
8350
8513
  "platform_update_evaluator",
8351
8514
  "Update an existing evaluator on the LangWatch platform. The evaluatorType in config cannot be changed after creation.",
8352
8515
  {
8353
- evaluatorId: import_zod8.z.string().describe("The evaluator ID to update"),
8354
- name: import_zod8.z.string().optional().describe("Updated evaluator name"),
8355
- config: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()).optional().describe("Updated config settings. Note: evaluatorType cannot be changed after creation.")
8516
+ evaluatorId: import_zod9.z.string().describe("The evaluator ID to update"),
8517
+ name: import_zod9.z.string().optional().describe("Updated evaluator name"),
8518
+ config: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.unknown()).optional().describe("Updated config settings. Note: evaluatorType cannot be changed after creation.")
8356
8519
  },
8357
8520
  withToolLogging("platform_update_evaluator", async (params) => {
8358
8521
  requireApiKey();
@@ -8366,7 +8529,7 @@ function registerEvaluatorTools(server) {
8366
8529
  "platform_delete_evaluator",
8367
8530
  "Archive (soft-delete) an evaluator by ID or slug.",
8368
8531
  {
8369
- idOrSlug: import_zod8.z.string().describe("The evaluator ID or slug to archive")
8532
+ idOrSlug: import_zod9.z.string().describe("The evaluator ID or slug to archive")
8370
8533
  },
8371
8534
  withToolLogging("platform_delete_evaluator", async (params) => {
8372
8535
  requireApiKey();
@@ -8382,12 +8545,12 @@ function registerModelProviderTools(server) {
8382
8545
  "platform_set_model_provider",
8383
8546
  `Set or update a model provider on the LangWatch platform. Use this to configure API keys (e.g. OPENAI_API_KEY) needed to run evaluators. The API key is stored securely and never returned in responses. Omit customKeys to update other settings without changing existing keys.`,
8384
8547
  {
8385
- provider: import_zod8.z.string().describe('Provider name, e.g., "openai", "anthropic", "azure", "custom"'),
8386
- enabled: import_zod8.z.boolean().describe("Whether the provider is enabled"),
8387
- customKeys: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()).optional().describe(
8548
+ provider: import_zod9.z.string().describe('Provider name, e.g., "openai", "anthropic", "azure", "custom"'),
8549
+ enabled: import_zod9.z.boolean().describe("Whether the provider is enabled"),
8550
+ customKeys: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.unknown()).optional().describe(
8388
8551
  'API key configuration, e.g. { "OPENAI_API_KEY": "sk-..." }. Omit to keep existing keys.'
8389
8552
  ),
8390
- defaultModel: import_zod8.z.string().optional().describe("Set as project default model")
8553
+ defaultModel: import_zod9.z.string().optional().describe("Set as project default model")
8391
8554
  },
8392
8555
  withToolLogging("platform_set_model_provider", async (params) => {
8393
8556
  requireApiKey();
@@ -8427,7 +8590,7 @@ function registerAgentTools(server) {
8427
8590
  "platform_get_agent",
8428
8591
  "Get detailed information about a specific agent by its ID, including its configuration. A connected agent also shows its environment, status, the run parameters it declared (with options and defaults) and the instances connected right now.",
8429
8592
  {
8430
- id: import_zod8.z.string().describe("The agent ID")
8593
+ id: import_zod9.z.string().describe("The agent ID")
8431
8594
  },
8432
8595
  withToolLogging("platform_get_agent", async (params) => {
8433
8596
  requireApiKey();
@@ -8441,9 +8604,9 @@ function registerAgentTools(server) {
8441
8604
  "platform_create_agent",
8442
8605
  "Create a new agent. Supported types: 'signature' (LLM prompt), 'code' (Python), 'workflow' (sub-workflow), 'http' (external API). A 'connected' agent is not created here: it registers itself from code, with connectAgent from langwatch/agent in TypeScript or langwatch.connect_agent in Python, and appears in the list once that process runs.",
8443
8606
  {
8444
- name: import_zod8.z.string().describe("Agent name"),
8445
- type: import_zod8.z.enum(["signature", "code", "workflow", "http"]).describe("Agent type"),
8446
- config: import_zod8.z.string().optional().describe("Agent configuration as JSON string (will be parsed)")
8607
+ name: import_zod9.z.string().describe("Agent name"),
8608
+ type: import_zod9.z.enum(["signature", "code", "workflow", "http"]).describe("Agent type"),
8609
+ config: import_zod9.z.string().optional().describe("Agent configuration as JSON string (will be parsed)")
8447
8610
  },
8448
8611
  withToolLogging("platform_create_agent", async (params) => {
8449
8612
  requireApiKey();
@@ -8460,10 +8623,10 @@ function registerAgentTools(server) {
8460
8623
  "platform_update_agent",
8461
8624
  "Update an existing agent's name, type, or configuration.",
8462
8625
  {
8463
- id: import_zod8.z.string().describe("The agent ID"),
8464
- name: import_zod8.z.string().optional().describe("New agent name"),
8465
- type: import_zod8.z.string().optional().describe("New agent type: signature, code, workflow, or http"),
8466
- config: import_zod8.z.string().optional().describe("Updated configuration as JSON string (will be parsed)")
8626
+ id: import_zod9.z.string().describe("The agent ID"),
8627
+ name: import_zod9.z.string().optional().describe("New agent name"),
8628
+ type: import_zod9.z.string().optional().describe("New agent type: signature, code, workflow, or http"),
8629
+ config: import_zod9.z.string().optional().describe("Updated configuration as JSON string (will be parsed)")
8467
8630
  },
8468
8631
  withToolLogging("platform_update_agent", async (params) => {
8469
8632
  requireApiKey();
@@ -8480,7 +8643,7 @@ function registerAgentTools(server) {
8480
8643
  "platform_delete_agent",
8481
8644
  "Archive (soft-delete) an agent by its ID.",
8482
8645
  {
8483
- id: import_zod8.z.string().describe("The agent ID to archive")
8646
+ id: import_zod9.z.string().describe("The agent ID to archive")
8484
8647
  },
8485
8648
  withToolLogging("platform_delete_agent", async (params) => {
8486
8649
  requireApiKey();
@@ -8494,13 +8657,13 @@ function registerAgentTools(server) {
8494
8657
  "platform_run_agent",
8495
8658
  "Run one turn of an agent. A connected agent runs through the platform relay on a live instance: give `message` (one user turn) or `input` with a `messages` list, plus `parameters` and `threadId` to continue a conversation. HTTP agents call their configured URL directly; workflow-linked agents execute via the workflow engine.",
8496
8659
  {
8497
- id: import_zod8.z.string().describe("The agent ID to run"),
8498
- input: import_zod8.z.string().optional().describe(
8660
+ id: import_zod9.z.string().describe("The agent ID to run"),
8661
+ input: import_zod9.z.string().optional().describe(
8499
8662
  "Input data as a JSON object string. For a connected agent it is the relay body: messages (OpenAI style), and optionally threadId, session and params."
8500
8663
  ),
8501
- message: import_zod8.z.string().optional().describe("One user message to send to a connected agent, instead of input"),
8502
- parameters: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.union([import_zod8.z.string(), import_zod8.z.number(), import_zod8.z.boolean()])).optional().describe("Run parameter values for a connected agent, by name"),
8503
- threadId: import_zod8.z.string().optional().describe("Continue a conversation on a connected agent")
8664
+ message: import_zod9.z.string().optional().describe("One user message to send to a connected agent, instead of input"),
8665
+ parameters: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.union([import_zod9.z.string(), import_zod9.z.number(), import_zod9.z.boolean()])).optional().describe("Run parameter values for a connected agent, by name"),
8666
+ threadId: import_zod9.z.string().optional().describe("Continue a conversation on a connected agent")
8504
8667
  },
8505
8668
  withToolLogging("platform_run_agent", async (params) => {
8506
8669
  requireApiKey();
@@ -8514,7 +8677,7 @@ function registerAgentTools(server) {
8514
8677
  "platform_test_agent",
8515
8678
  'Test an agent with one scripted scenario run: the user sends "ping", the agent answers, and the run succeeds when the answer arrives. No model is used, and no scenario, run plan or test suite is added to the project. Answers at once with the scenario run id to follow with platform_get_simulation_run; the run itself is asynchronous.',
8516
8679
  {
8517
- id: import_zod8.z.string().describe("The agent ID to test")
8680
+ id: import_zod9.z.string().describe("The agent ID to test")
8518
8681
  },
8519
8682
  withToolLogging("platform_test_agent", async (params) => {
8520
8683
  requireApiKey();
@@ -8524,91 +8687,103 @@ function registerAgentTools(server) {
8524
8687
  })
8525
8688
  );
8526
8689
  }
8527
- function registerDashboardTools(server) {
8690
+ function registerAnalyticsReportTools(server) {
8528
8691
  server.tool(
8529
- "platform_list_dashboards",
8530
- "List all analytics dashboards in the LangWatch project.",
8692
+ "platform_list_analytics_reports",
8693
+ "List the Analytics Reports in the LangWatch project (/api/v1/analytics/reports). Dashboards, which hold widgets, are listed by list_dashboards.",
8531
8694
  {},
8532
- withToolLogging("platform_list_dashboards", async () => {
8695
+ withToolLogging("platform_list_analytics_reports", async () => {
8533
8696
  requireApiKey();
8534
- const { handleListDashboards: handleListDashboards2 } = await Promise.resolve().then(() => (init_list_dashboards(), list_dashboards_exports));
8697
+ const { handleListAnalyticsReports: handleListAnalyticsReports2 } = await Promise.resolve().then(() => (init_list_analytics_reports(), list_analytics_reports_exports));
8535
8698
  return {
8536
- content: [{ type: "text", text: await handleListDashboards2() }]
8699
+ content: [{ type: "text", text: await handleListAnalyticsReports2() }]
8537
8700
  };
8538
8701
  })
8539
8702
  );
8540
8703
  server.tool(
8541
- "platform_get_dashboard",
8542
- "Get a dashboard by its ID, including its graphs.",
8704
+ "platform_get_analytics_report",
8705
+ "Get an Analytics Report by its ID, including its graphs. A Dashboards dashboard's ID is not found here; read it with get_dashboard.",
8543
8706
  {
8544
- id: import_zod8.z.string().describe("The dashboard ID")
8707
+ reportId: import_zod9.z.string().describe("The Analytics Report ID")
8545
8708
  },
8546
- withToolLogging("platform_get_dashboard", async (params) => {
8709
+ withToolLogging("platform_get_analytics_report", async (params) => {
8547
8710
  requireApiKey();
8548
- const { handleGetDashboard: handleGetDashboard2 } = await Promise.resolve().then(() => (init_get_dashboard(), get_dashboard_exports));
8711
+ const { handleGetAnalyticsReport: handleGetAnalyticsReport2 } = await Promise.resolve().then(() => (init_get_analytics_report(), get_analytics_report_exports));
8549
8712
  return {
8550
- content: [{ type: "text", text: await handleGetDashboard2(params) }]
8713
+ content: [{ type: "text", text: await handleGetAnalyticsReport2(params) }]
8551
8714
  };
8552
8715
  })
8553
8716
  );
8554
8717
  server.tool(
8555
- "platform_create_dashboard",
8556
- "Create a new analytics dashboard.",
8718
+ "platform_create_analytics_report",
8719
+ "Create a new Analytics Report.",
8557
8720
  {
8558
- name: import_zod8.z.string().describe("Dashboard name")
8721
+ name: import_zod9.z.string().describe("Analytics Report name")
8559
8722
  },
8560
- withToolLogging("platform_create_dashboard", async (params) => {
8723
+ withToolLogging("platform_create_analytics_report", async (params) => {
8561
8724
  requireApiKey();
8562
- const { handleCreateDashboard: handleCreateDashboard2 } = await Promise.resolve().then(() => (init_create_dashboard(), create_dashboard_exports));
8725
+ const { handleCreateAnalyticsReport: handleCreateAnalyticsReport2 } = await Promise.resolve().then(() => (init_create_analytics_report(), create_analytics_report_exports));
8563
8726
  return {
8564
- content: [{ type: "text", text: await handleCreateDashboard2(params) }]
8727
+ content: [
8728
+ {
8729
+ type: "text",
8730
+ text: await handleCreateAnalyticsReport2(params)
8731
+ }
8732
+ ]
8565
8733
  };
8566
8734
  })
8567
8735
  );
8568
8736
  server.tool(
8569
- "platform_delete_dashboard",
8570
- "Delete a dashboard and all its graphs.",
8737
+ "platform_delete_analytics_report",
8738
+ "Delete an Analytics Report and all its graphs.",
8571
8739
  {
8572
- id: import_zod8.z.string().describe("The dashboard ID to delete")
8740
+ reportId: import_zod9.z.string().describe("The Analytics Report ID to delete")
8573
8741
  },
8574
- withToolLogging("platform_delete_dashboard", async (params) => {
8742
+ withToolLogging("platform_delete_analytics_report", async (params) => {
8575
8743
  requireApiKey();
8576
- const { handleDeleteDashboard: handleDeleteDashboard2 } = await Promise.resolve().then(() => (init_delete_dashboard(), delete_dashboard_exports));
8744
+ const { handleDeleteAnalyticsReport: handleDeleteAnalyticsReport2 } = await Promise.resolve().then(() => (init_delete_analytics_report(), delete_analytics_report_exports));
8577
8745
  return {
8578
- content: [{ type: "text", text: await handleDeleteDashboard2(params) }]
8746
+ content: [
8747
+ {
8748
+ type: "text",
8749
+ text: await handleDeleteAnalyticsReport2(params)
8750
+ }
8751
+ ]
8579
8752
  };
8580
8753
  })
8581
8754
  );
8582
8755
  server.tool(
8583
- "platform_rename_dashboard",
8584
- "Rename a dashboard.",
8756
+ "platform_rename_analytics_report",
8757
+ "Rename an Analytics Report.",
8585
8758
  {
8586
- id: import_zod8.z.string().describe("The dashboard ID to rename"),
8587
- name: import_zod8.z.string().describe("The new name for the dashboard")
8759
+ reportId: import_zod9.z.string().describe("The Analytics Report ID to rename"),
8760
+ name: import_zod9.z.string().describe("The new name for the Analytics Report")
8588
8761
  },
8589
- withToolLogging("platform_rename_dashboard", async (params) => {
8762
+ withToolLogging("platform_rename_analytics_report", async (params) => {
8590
8763
  requireApiKey();
8591
- const { renameDashboard: renameDashboard2 } = await Promise.resolve().then(() => (init_langwatch_api_dashboards(), langwatch_api_dashboards_exports));
8592
- const result = await renameDashboard2(params.id, { name: params.name });
8764
+ const { renameAnalyticsReport: renameAnalyticsReport2 } = await Promise.resolve().then(() => (init_langwatch_api_analytics_reports(), langwatch_api_analytics_reports_exports));
8765
+ const result = await renameAnalyticsReport2({ reportId: params.reportId, name: params.name });
8593
8766
  return {
8594
8767
  content: [
8595
8768
  {
8596
8769
  type: "text",
8597
- text: `Dashboard "${result.name}" renamed successfully (ID: ${result.id}).`
8770
+ text: `Analytics Report "${result.name}" renamed successfully (ID: ${result.id}).`
8598
8771
  }
8599
8772
  ]
8600
8773
  };
8601
8774
  })
8602
8775
  );
8776
+ }
8777
+ function registerDashboardTools(server) {
8603
8778
  server.tool(
8604
- "list_dashboard_boards",
8605
- "Lists the project's boards in the Dashboards area, with each one's ID and widget count. Use an ID from here as the dashboardId of add_dashboard_widget and update_dashboard_widget; the analytics dashboards platform_list_dashboards lists hold no widgets.",
8779
+ "list_dashboards",
8780
+ "Lists the project's dashboards in the Dashboards area, with each one's ID and widget count. Use an ID from here as the dashboardId of add_dashboard_widget and update_dashboard_widget; the Analytics Reports platform_list_analytics_reports lists hold no widgets.",
8606
8781
  {},
8607
- withToolLogging("list_dashboard_boards", async () => {
8782
+ withToolLogging("list_dashboards", async () => {
8608
8783
  requireApiKey();
8609
- const { handleListDashboardBoards: handleListDashboardBoards2 } = await Promise.resolve().then(() => (init_list_dashboard_boards(), list_dashboard_boards_exports));
8784
+ const { handleListDashboards: handleListDashboards2 } = await Promise.resolve().then(() => (init_list_dashboards(), list_dashboards_exports));
8610
8785
  return {
8611
- content: [{ type: "text", text: await handleListDashboardBoards2() }]
8786
+ content: [{ type: "text", text: await handleListDashboards2() }]
8612
8787
  };
8613
8788
  })
8614
8789
  );
@@ -8616,22 +8791,24 @@ function registerDashboardTools(server) {
8616
8791
  "add_dashboard_widget",
8617
8792
  "Creates a custom dashboard widget and places it on the given dashboard. A widget's `code` is a TSX file run in a sandbox: it receives a global `LW` with `LW.useChartQuery(name)` (reads one of the widget's own named queries), `LW.navigate` and `LW.theme`. `queries` are named LangWatchQL SQL statements the code can read by name \u2014 validate each statement's SQL first with run_query before calling this tool, since a query only runs inside the sandbox at render time and a mistake surfaces there, not here. Up to 8 queries per widget.",
8618
8793
  {
8619
- dashboardId: import_zod8.z.string().describe("The Dashboards board to add the widget to, as list_dashboard_boards lists it"),
8620
- name: import_zod8.z.string().describe("The widget's display name"),
8621
- code: import_zod8.z.string().describe(
8794
+ dashboardId: import_zod9.z.string().describe("The dashboard to add the widget to, as list_dashboards lists it"),
8795
+ name: import_zod9.z.string().describe("The widget's display name"),
8796
+ code: import_zod9.z.string().describe(
8622
8797
  "The widget's TSX source. Runs sandboxed with a global LW (LW.useChartQuery(name), LW.navigate, LW.theme) in scope."
8623
8798
  ),
8624
- queries: import_zod8.z.union([
8625
- import_zod8.z.record(import_zod8.z.string(), import_zod8.z.string()).describe('{"<name>": "<LWQL SQL>"}'),
8626
- import_zod8.z.array(
8627
- import_zod8.z.object({
8628
- name: import_zod8.z.string().describe('Referenced from code as LW.useChartQuery("name")'),
8629
- sql: import_zod8.z.string().describe("The LangWatchQL statement")
8799
+ queries: import_zod9.z.union([
8800
+ import_zod9.z.record(import_zod9.z.string(), import_zod9.z.string()).describe('{"<name>": "<LWQL SQL>"}'),
8801
+ import_zod9.z.array(
8802
+ import_zod9.z.object({
8803
+ name: import_zod9.z.string().describe('Referenced from code as LW.useChartQuery("name")'),
8804
+ sql: import_zod9.z.string().describe("The LangWatchQL statement")
8630
8805
  })
8631
8806
  ).describe("Named LWQL queries, array form")
8632
8807
  ]).describe(
8633
8808
  "The widget's named LangWatchQL queries: either {name: sql} or an array of {name, sql}. Max 8. Validate each statement with run_query first."
8634
- )
8809
+ ),
8810
+ sources: widgetSourcesInput,
8811
+ projects: widgetProjectsInput
8635
8812
  },
8636
8813
  withToolLogging("add_dashboard_widget", async (params) => {
8637
8814
  requireApiKey();
@@ -8643,26 +8820,28 @@ function registerDashboardTools(server) {
8643
8820
  );
8644
8821
  server.tool(
8645
8822
  "update_dashboard_widget",
8646
- "Changes one custom widget on a dashboard: its name, its TSX `code`, its named LangWatchQL `queries` or its `description`. Pass only the fields to change; every field left out keeps its stored value. Validate any new query's SQL with run_query first. Returns the updated widget.",
8823
+ "Changes one custom widget on a dashboard: its name, its TSX `code`, its named LangWatchQL `queries`, its `description` or the `sources` its queries count. Pass only the fields to change; every field left out keeps its stored value. Validate any new query's SQL with run_query first. Returns the updated widget.",
8647
8824
  {
8648
- dashboardId: import_zod8.z.string().describe("The dashboard the widget is on"),
8649
- widgetId: import_zod8.z.string().describe("The widget to change, as add_dashboard_widget returned it"),
8650
- name: import_zod8.z.string().optional().describe("The widget's new display name"),
8651
- code: import_zod8.z.string().optional().describe(
8825
+ dashboardId: import_zod9.z.string().describe("The dashboard the widget is on"),
8826
+ widgetId: import_zod9.z.string().describe("The widget to change, as add_dashboard_widget returned it"),
8827
+ name: import_zod9.z.string().optional().describe("The widget's new display name"),
8828
+ code: import_zod9.z.string().optional().describe(
8652
8829
  "The widget's new TSX source. Runs sandboxed with a global LW (LW.useChartQuery(name), LW.navigate, LW.theme) in scope."
8653
8830
  ),
8654
- queries: import_zod8.z.union([
8655
- import_zod8.z.record(import_zod8.z.string(), import_zod8.z.string()).describe('{"<name>": "<LWQL SQL>"}'),
8656
- import_zod8.z.array(
8657
- import_zod8.z.object({
8658
- name: import_zod8.z.string().describe('Referenced from code as LW.useChartQuery("name")'),
8659
- sql: import_zod8.z.string().describe("The LangWatchQL statement")
8831
+ queries: import_zod9.z.union([
8832
+ import_zod9.z.record(import_zod9.z.string(), import_zod9.z.string()).describe('{"<name>": "<LWQL SQL>"}'),
8833
+ import_zod9.z.array(
8834
+ import_zod9.z.object({
8835
+ name: import_zod9.z.string().describe('Referenced from code as LW.useChartQuery("name")'),
8836
+ sql: import_zod9.z.string().describe("The LangWatchQL statement")
8660
8837
  })
8661
8838
  ).describe("Named LWQL queries, array form")
8662
8839
  ]).optional().describe(
8663
8840
  "The widget's new named LangWatchQL queries, replacing the stored set: either {name: sql} or an array of {name, sql}. Max 8."
8664
8841
  ),
8665
- description: import_zod8.z.string().optional().describe("What the widget's info tip says: a sentence or two")
8842
+ description: import_zod9.z.string().optional().describe("What the widget's info tip says: a sentence or two"),
8843
+ sources: widgetSourcesInput,
8844
+ projects: widgetProjectsInput
8666
8845
  },
8667
8846
  withToolLogging("update_dashboard_widget", async (params) => {
8668
8847
  requireApiKey();
@@ -8672,6 +8851,78 @@ function registerDashboardTools(server) {
8672
8851
  };
8673
8852
  })
8674
8853
  );
8854
+ registerDashboardCrudTools(server);
8855
+ }
8856
+ function registerDashboardCrudTools(server) {
8857
+ const dashboardId = import_zod9.z.string().describe("The dashboard's ID, as list_dashboards lists it");
8858
+ const text = (value) => ({ content: [{ type: "text", text: value }] });
8859
+ server.tool(
8860
+ "get_dashboard",
8861
+ "Reads one dashboard in the Dashboards area: its name, scope, description and address. An Analytics Report's ID is not found here; read it with platform_get_analytics_report.",
8862
+ { dashboardId },
8863
+ withToolLogging("get_dashboard", async (params) => {
8864
+ requireApiKey();
8865
+ const { handleGetDashboard: handleGetDashboard2 } = await Promise.resolve().then(() => (init_dashboards(), dashboards_exports));
8866
+ return text(await handleGetDashboard2(params));
8867
+ })
8868
+ );
8869
+ server.tool(
8870
+ "create_dashboard",
8871
+ "Creates an empty dashboard in the Dashboards area. Add widgets to it with add_dashboard_widget.",
8872
+ { name: import_zod9.z.string().describe("The dashboard's name") },
8873
+ withToolLogging("create_dashboard", async (params) => {
8874
+ requireApiKey();
8875
+ const { handleCreateDashboard: handleCreateDashboard2 } = await Promise.resolve().then(() => (init_dashboards(), dashboards_exports));
8876
+ return text(await handleCreateDashboard2(params));
8877
+ })
8878
+ );
8879
+ server.tool(
8880
+ "rename_dashboard",
8881
+ "Changes a dashboard's name and/or description; a field left out keeps its value.",
8882
+ {
8883
+ dashboardId,
8884
+ name: import_zod9.z.string().optional().describe("The dashboard's new name"),
8885
+ description: import_zod9.z.string().optional().describe("The dashboard's new description")
8886
+ },
8887
+ withToolLogging("rename_dashboard", async (params) => {
8888
+ requireApiKey();
8889
+ const { handleRenameDashboard: handleRenameDashboard2 } = await Promise.resolve().then(() => (init_dashboards(), dashboards_exports));
8890
+ return text(await handleRenameDashboard2(params));
8891
+ })
8892
+ );
8893
+ server.tool(
8894
+ "delete_dashboard",
8895
+ "Deletes a dashboard together with the widgets on it. This cannot be undone.",
8896
+ { dashboardId },
8897
+ withToolLogging("delete_dashboard", async (params) => {
8898
+ requireApiKey();
8899
+ const { handleDeleteDashboard: handleDeleteDashboard2 } = await Promise.resolve().then(() => (init_dashboards(), dashboards_exports));
8900
+ return text(await handleDeleteDashboard2(params));
8901
+ })
8902
+ );
8903
+ server.tool(
8904
+ "list_dashboard_widgets",
8905
+ "Lists the custom widgets on one dashboard, with each widget's ID and query names.",
8906
+ { dashboardId },
8907
+ withToolLogging("list_dashboard_widgets", async (params) => {
8908
+ requireApiKey();
8909
+ const { handleListDashboardWidgets: handleListDashboardWidgets2 } = await Promise.resolve().then(() => (init_dashboards(), dashboards_exports));
8910
+ return text(await handleListDashboardWidgets2(params));
8911
+ })
8912
+ );
8913
+ server.tool(
8914
+ "delete_dashboard_widget",
8915
+ "Deletes one custom widget from a dashboard. A widget on another dashboard is not found.",
8916
+ {
8917
+ dashboardId,
8918
+ widgetId: import_zod9.z.string().describe("The widget's ID, as list_dashboard_widgets lists it")
8919
+ },
8920
+ withToolLogging("delete_dashboard_widget", async (params) => {
8921
+ requireApiKey();
8922
+ const { handleDeleteDashboardWidget: handleDeleteDashboardWidget2 } = await Promise.resolve().then(() => (init_dashboards(), dashboards_exports));
8923
+ return text(await handleDeleteDashboardWidget2(params));
8924
+ })
8925
+ );
8675
8926
  }
8676
8927
  function registerWorkflowTools(server) {
8677
8928
  server.tool(
@@ -8690,7 +8941,7 @@ function registerWorkflowTools(server) {
8690
8941
  "platform_get_workflow",
8691
8942
  "Get a workflow by its ID.",
8692
8943
  {
8693
- id: import_zod8.z.string().describe("The workflow ID")
8944
+ id: import_zod9.z.string().describe("The workflow ID")
8694
8945
  },
8695
8946
  withToolLogging("platform_get_workflow", async (params) => {
8696
8947
  requireApiKey();
@@ -8704,7 +8955,7 @@ function registerWorkflowTools(server) {
8704
8955
  "platform_delete_workflow",
8705
8956
  "Archive (soft-delete) a workflow by its ID.",
8706
8957
  {
8707
- id: import_zod8.z.string().describe("The workflow ID to archive")
8958
+ id: import_zod9.z.string().describe("The workflow ID to archive")
8708
8959
  },
8709
8960
  withToolLogging("platform_delete_workflow", async (params) => {
8710
8961
  requireApiKey();
@@ -8718,8 +8969,8 @@ function registerWorkflowTools(server) {
8718
8969
  "platform_run_workflow",
8719
8970
  "Execute a workflow with JSON input. Returns the workflow output.",
8720
8971
  {
8721
- id: import_zod8.z.string().describe("The workflow ID to run"),
8722
- input: import_zod8.z.string().optional().describe("Input data as a JSON object string")
8972
+ id: import_zod9.z.string().describe("The workflow ID to run"),
8973
+ input: import_zod9.z.string().optional().describe("Input data as a JSON object string")
8723
8974
  },
8724
8975
  withToolLogging("platform_run_workflow", async (params) => {
8725
8976
  requireApiKey();
@@ -8735,7 +8986,7 @@ function registerAnnotationTools(server) {
8735
8986
  "platform_list_annotations",
8736
8987
  "List all annotations for the project, optionally filtered by trace ID.",
8737
8988
  {
8738
- traceId: import_zod8.z.string().optional().describe("Filter annotations by trace ID")
8989
+ traceId: import_zod9.z.string().optional().describe("Filter annotations by trace ID")
8739
8990
  },
8740
8991
  withToolLogging("platform_list_annotations", async (params) => {
8741
8992
  requireApiKey();
@@ -8749,10 +9000,10 @@ function registerAnnotationTools(server) {
8749
9000
  "platform_create_annotation",
8750
9001
  "Create an annotation (thumbs up/down, comment) for a trace.",
8751
9002
  {
8752
- traceId: import_zod8.z.string().describe("The trace ID to annotate"),
8753
- comment: import_zod8.z.string().optional().describe("Annotation comment"),
8754
- isThumbsUp: import_zod8.z.boolean().optional().describe("True for positive feedback, false for negative"),
8755
- email: import_zod8.z.string().optional().describe("Email of the annotator")
9003
+ traceId: import_zod9.z.string().describe("The trace ID to annotate"),
9004
+ comment: import_zod9.z.string().optional().describe("Annotation comment"),
9005
+ isThumbsUp: import_zod9.z.boolean().optional().describe("True for positive feedback, false for negative"),
9006
+ email: import_zod9.z.string().optional().describe("Email of the annotator")
8756
9007
  },
8757
9008
  withToolLogging("platform_create_annotation", async (params) => {
8758
9009
  requireApiKey();
@@ -8766,7 +9017,7 @@ function registerAnnotationTools(server) {
8766
9017
  "platform_delete_annotation",
8767
9018
  "Delete an annotation by its ID.",
8768
9019
  {
8769
- id: import_zod8.z.string().describe("The annotation ID to delete")
9020
+ id: import_zod9.z.string().describe("The annotation ID to delete")
8770
9021
  },
8771
9022
  withToolLogging("platform_delete_annotation", async (params) => {
8772
9023
  requireApiKey();
@@ -8780,7 +9031,7 @@ function registerAnnotationTools(server) {
8780
9031
  "platform_get_annotation",
8781
9032
  "Get annotation details by ID.",
8782
9033
  {
8783
- id: import_zod8.z.string().describe("The annotation ID")
9034
+ id: import_zod9.z.string().describe("The annotation ID")
8784
9035
  },
8785
9036
  withToolLogging("platform_get_annotation", async (params) => {
8786
9037
  requireApiKey();
@@ -8804,7 +9055,7 @@ function registerTriggerTools(server) {
8804
9055
  "platform_list_triggers",
8805
9056
  "List all triggers (automations) in the project. Triggers automate actions like sending emails, Slack messages, or adding to datasets when conditions are met.",
8806
9057
  {
8807
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format")
9058
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format")
8808
9059
  },
8809
9060
  withToolLogging("platform_list_triggers", async (params) => {
8810
9061
  requireApiKey();
@@ -8816,7 +9067,7 @@ function registerTriggerTools(server) {
8816
9067
  "platform_get_trigger",
8817
9068
  "Read one trigger (automation) by its ID, including its delivery configuration. Credential values come back as [redacted]; sending them back unchanged on an update keeps the stored values.",
8818
9069
  {
8819
- id: import_zod8.z.string().describe("The trigger ID")
9070
+ id: import_zod9.z.string().describe("The trigger ID")
8820
9071
  },
8821
9072
  withToolLogging("platform_get_trigger", async (params) => {
8822
9073
  requireApiKey();
@@ -8837,17 +9088,17 @@ function registerTriggerTools(server) {
8837
9088
  "The delivery channel cannot be changed afterwards."
8838
9089
  ].join("\n"),
8839
9090
  {
8840
- name: import_zod8.z.string().describe("Trigger name"),
9091
+ name: import_zod9.z.string().describe("Trigger name"),
8841
9092
  action: triggerActionSchema.describe("Which channel it delivers on"),
8842
9093
  actionParams: actionParamsSchema.optional().describe("The delivery configuration the channel named in `action` reads. Defaults to {}"),
8843
- filters: import_zod8.z.string().optional().describe(TRIGGER_FILTERS_DESCRIPTION),
8844
- filterQuery: import_zod8.z.string().optional().describe(TRIGGER_FILTER_QUERY_DESCRIPTION),
8845
- customGraphId: import_zod8.z.string().optional().describe("Set to make this an alert on that graph"),
9094
+ filters: import_zod9.z.string().optional().describe(TRIGGER_FILTERS_DESCRIPTION),
9095
+ filterQuery: import_zod9.z.string().optional().describe(TRIGGER_FILTER_QUERY_DESCRIPTION),
9096
+ customGraphId: import_zod9.z.string().optional().describe("Set to make this an alert on that graph"),
8846
9097
  graphAlert: graphAlertSchema.optional(),
8847
9098
  report: reportSchema.optional().describe("Set to make this a scheduled report"),
8848
9099
  templates: templatesSchema.optional(),
8849
9100
  notificationCadence: notificationCadenceSchema.optional(),
8850
- message: import_zod8.z.string().optional().describe("Custom alert message"),
9101
+ message: import_zod9.z.string().optional().describe("Custom alert message"),
8851
9102
  alertType: alertTypeSchema.optional().describe("Alert severity. Required for a graph alert.")
8852
9103
  },
8853
9104
  withToolLogging("platform_create_trigger", async (params) => {
@@ -8865,17 +9116,17 @@ function registerTriggerTools(server) {
8865
9116
  "The delivery channel, the kind of automation and an alert's graph cannot be changed."
8866
9117
  ].join("\n"),
8867
9118
  {
8868
- id: import_zod8.z.string().describe("The trigger ID"),
8869
- name: import_zod8.z.string().optional().describe("New name"),
8870
- active: import_zod8.z.boolean().optional().describe("Resume or pause it"),
9119
+ id: import_zod9.z.string().describe("The trigger ID"),
9120
+ name: import_zod9.z.string().optional().describe("New name"),
9121
+ active: import_zod9.z.boolean().optional().describe("Resume or pause it"),
8871
9122
  actionParams: actionParamsSchema.optional().describe("The delivery configuration this automation should have from now on"),
8872
- filters: import_zod8.z.string().optional().describe(TRIGGER_FILTERS_DESCRIPTION),
8873
- filterQuery: import_zod8.z.string().nullable().optional().describe(`${TRIGGER_FILTER_QUERY_DESCRIPTION} null clears the saved query.`),
9123
+ filters: import_zod9.z.string().optional().describe(TRIGGER_FILTERS_DESCRIPTION),
9124
+ filterQuery: import_zod9.z.string().nullable().optional().describe(`${TRIGGER_FILTER_QUERY_DESCRIPTION} null clears the saved query.`),
8874
9125
  graphAlert: graphAlertSchema.optional().describe("Only for an automation that is already a graph alert"),
8875
9126
  report: reportSchema.optional().describe("Only for an automation that is already a scheduled report"),
8876
9127
  templates: templatesSchema.optional(),
8877
9128
  notificationCadence: notificationCadenceSchema.optional(),
8878
- message: import_zod8.z.string().nullable().optional().describe("New alert message. null removes the custom message"),
9129
+ message: import_zod9.z.string().nullable().optional().describe("New alert message. null removes the custom message"),
8879
9130
  alertType: alertTypeSchema.nullable().optional().describe("New alert severity. null clears it")
8880
9131
  },
8881
9132
  withToolLogging("platform_update_trigger", async (params) => {
@@ -8909,7 +9160,7 @@ function registerTriggerTools(server) {
8909
9160
  "platform_test_fire_trigger",
8910
9161
  "Send a trigger's message to the destination it is configured with, to confirm it arrives. Nothing is recorded as a fire.",
8911
9162
  {
8912
- id: import_zod8.z.string().describe("The trigger ID")
9163
+ id: import_zod9.z.string().describe("The trigger ID")
8913
9164
  },
8914
9165
  withToolLogging("platform_test_fire_trigger", async (params) => {
8915
9166
  requireApiKey();
@@ -8922,9 +9173,9 @@ function registerTriggerTools(server) {
8922
9173
  "platform_list_trigger_fires",
8923
9174
  "What an automation has done, newest first. Metadata only \u2014 no message content. Answers with `nextCursor`; pass it back as `cursor` for the next page (null means there is none).",
8924
9175
  {
8925
- id: import_zod8.z.string().describe("The trigger ID"),
8926
- limit: import_zod8.z.number().int().positive().optional().describe("How many fires to return"),
8927
- cursor: import_zod8.z.string().optional().describe("The `nextCursor` a previous call answered with")
9176
+ id: import_zod9.z.string().describe("The trigger ID"),
9177
+ limit: import_zod9.z.number().int().positive().optional().describe("How many fires to return"),
9178
+ cursor: import_zod9.z.string().optional().describe("The `nextCursor` a previous call answered with")
8928
9179
  },
8929
9180
  withToolLogging("platform_list_trigger_fires", async (params) => {
8930
9181
  requireApiKey();
@@ -8936,7 +9187,7 @@ function registerTriggerTools(server) {
8936
9187
  "platform_delete_trigger",
8937
9188
  "Delete a trigger (automation).",
8938
9189
  {
8939
- id: import_zod8.z.string().describe("The trigger ID to delete")
9190
+ id: import_zod9.z.string().describe("The trigger ID to delete")
8940
9191
  },
8941
9192
  withToolLogging("platform_delete_trigger", async (params) => {
8942
9193
  requireApiKey();
@@ -8976,7 +9227,7 @@ ${lines.join("\n")}`
8976
9227
  "platform_get_monitor",
8977
9228
  "Get details of a specific online evaluation monitor.",
8978
9229
  {
8979
- id: import_zod8.z.string().describe("The monitor ID")
9230
+ id: import_zod9.z.string().describe("The monitor ID")
8980
9231
  },
8981
9232
  withToolLogging("platform_get_monitor", async (params) => {
8982
9233
  requireApiKey();
@@ -8999,11 +9250,11 @@ ${lines.join("\n")}`
8999
9250
  "platform_create_monitor",
9000
9251
  "Create a new online evaluation monitor that runs an evaluator on incoming traces.",
9001
9252
  {
9002
- name: import_zod8.z.string().describe("Monitor name"),
9003
- checkType: import_zod8.z.string().describe("Evaluator check type (e.g. ragas/toxicity, custom/my-eval)"),
9004
- executionMode: import_zod8.z.enum(["ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY"]).optional().describe("When to run: ON_MESSAGE (default), AS_GUARDRAIL, or MANUALLY"),
9005
- sample: import_zod8.z.number().min(0).max(1).optional().describe("Sampling rate 0.0-1.0 (default: 1.0)"),
9006
- evaluatorId: import_zod8.z.string().optional().describe("Link to a saved evaluator by ID")
9253
+ name: import_zod9.z.string().describe("Monitor name"),
9254
+ checkType: import_zod9.z.string().describe("Evaluator check type (e.g. ragas/toxicity, custom/my-eval)"),
9255
+ executionMode: import_zod9.z.enum(["ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY"]).optional().describe("When to run: ON_MESSAGE (default), AS_GUARDRAIL, or MANUALLY"),
9256
+ sample: import_zod9.z.number().min(0).max(1).optional().describe("Sampling rate 0.0-1.0 (default: 1.0)"),
9257
+ evaluatorId: import_zod9.z.string().optional().describe("Link to a saved evaluator by ID")
9007
9258
  },
9008
9259
  withToolLogging("platform_create_monitor", async (params) => {
9009
9260
  requireApiKey();
@@ -9023,11 +9274,11 @@ ${lines.join("\n")}`
9023
9274
  "platform_update_monitor",
9024
9275
  "Update an existing online evaluation monitor.",
9025
9276
  {
9026
- id: import_zod8.z.string().describe("The monitor ID to update"),
9027
- name: import_zod8.z.string().optional().describe("New monitor name"),
9028
- enabled: import_zod8.z.boolean().optional().describe("Enable or disable the monitor"),
9029
- executionMode: import_zod8.z.enum(["ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY"]).optional().describe("New execution mode"),
9030
- sample: import_zod8.z.number().min(0).max(1).optional().describe("New sampling rate")
9277
+ id: import_zod9.z.string().describe("The monitor ID to update"),
9278
+ name: import_zod9.z.string().optional().describe("New monitor name"),
9279
+ enabled: import_zod9.z.boolean().optional().describe("Enable or disable the monitor"),
9280
+ executionMode: import_zod9.z.enum(["ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY"]).optional().describe("New execution mode"),
9281
+ sample: import_zod9.z.number().min(0).max(1).optional().describe("New sampling rate")
9031
9282
  },
9032
9283
  withToolLogging("platform_update_monitor", async (params) => {
9033
9284
  requireApiKey();
@@ -9047,7 +9298,7 @@ ${lines.join("\n")}`
9047
9298
  "platform_delete_monitor",
9048
9299
  "Delete an online evaluation monitor.",
9049
9300
  {
9050
- id: import_zod8.z.string().describe("The monitor ID to delete")
9301
+ id: import_zod9.z.string().describe("The monitor ID to delete")
9051
9302
  },
9052
9303
  withToolLogging("platform_delete_monitor", async (params) => {
9053
9304
  requireApiKey();
@@ -9087,8 +9338,8 @@ ${lines.join("\n")}`
9087
9338
  "platform_create_secret",
9088
9339
  "Create a new encrypted project secret. Name must be UPPER_SNAKE_CASE (e.g. MY_API_KEY).",
9089
9340
  {
9090
- name: import_zod8.z.string().describe("Secret name in UPPER_SNAKE_CASE (e.g. OPENAI_API_KEY)"),
9091
- value: import_zod8.z.string().describe("The secret value (will be encrypted at rest)")
9341
+ name: import_zod9.z.string().describe("Secret name in UPPER_SNAKE_CASE (e.g. OPENAI_API_KEY)"),
9342
+ value: import_zod9.z.string().describe("The secret value (will be encrypted at rest)")
9092
9343
  },
9093
9344
  withToolLogging("platform_create_secret", async (params) => {
9094
9345
  requireApiKey();
@@ -9108,8 +9359,8 @@ ${lines.join("\n")}`
9108
9359
  "platform_update_secret",
9109
9360
  "Update an existing project secret's value.",
9110
9361
  {
9111
- id: import_zod8.z.string().describe("The secret ID to update"),
9112
- value: import_zod8.z.string().describe("The new secret value (will be encrypted at rest)")
9362
+ id: import_zod9.z.string().describe("The secret ID to update"),
9363
+ value: import_zod9.z.string().describe("The new secret value (will be encrypted at rest)")
9113
9364
  },
9114
9365
  withToolLogging("platform_update_secret", async (params) => {
9115
9366
  requireApiKey();
@@ -9129,7 +9380,7 @@ ${lines.join("\n")}`
9129
9380
  "platform_delete_secret",
9130
9381
  "Delete a project secret.",
9131
9382
  {
9132
- id: import_zod8.z.string().describe("The secret ID to delete")
9383
+ id: import_zod9.z.string().describe("The secret ID to delete")
9133
9384
  },
9134
9385
  withToolLogging("platform_delete_secret", async (params) => {
9135
9386
  requireApiKey();
@@ -9144,7 +9395,10 @@ function registerExperimentTools(server) {
9144
9395
  "platform_run_experiment",
9145
9396
  "Start an experiment run by slug. Returns a run ID for polling status.",
9146
9397
  {
9147
- slug: import_zod8.z.string().describe("The experiment slug to run")
9398
+ slug: import_zod9.z.string().describe("The experiment slug to run"),
9399
+ concurrency: import_zod9.z.number().int().min(1).max(24).optional().describe(
9400
+ "Cells (one row against one target) to run at once, for this run only (default: the server's setting). Use 1 to run them one at a time, in order."
9401
+ )
9148
9402
  },
9149
9403
  withToolLogging("platform_run_experiment", async (params) => {
9150
9404
  requireApiKey();
@@ -9157,8 +9411,8 @@ function registerExperimentTools(server) {
9157
9411
  "platform_experiment_status",
9158
9412
  "Check the status of an experiment run (running, completed, stopped, or interrupted) plus its progress. Works for both platform-run and SDK-logged experiments; pass experimentSlug for SDK runs or runs older than 24h.",
9159
9413
  {
9160
- runId: import_zod8.z.string().describe("The run ID returned from platform_run_experiment"),
9161
- experimentSlug: import_zod8.z.string().optional().describe(
9414
+ runId: import_zod9.z.string().describe("The run ID returned from platform_run_experiment"),
9415
+ experimentSlug: import_zod9.z.string().optional().describe(
9162
9416
  "Experiment slug \u2014 required for SDK-logged runs and runs older than 24h (the Redis run-state they would otherwise be read from is absent/expired). Use platform_experiment_list_runs to find the slug."
9163
9417
  )
9164
9418
  },
@@ -9173,7 +9427,7 @@ function registerExperimentTools(server) {
9173
9427
  "platform_experiment_list",
9174
9428
  "List experiments configured in the LangWatch project. Returns a markdown table with each experiment's slug, name, last-run timestamp, and run count. Use this to discover experiment slugs before drilling into runs with platform_experiment_list_runs. Output is capped (default 25, max 100) to protect the agent's context window.",
9175
9429
  {
9176
- limit: import_zod8.z.number().int().positive().max(100).optional().describe("Maximum number of experiments to include (default 25, hard-capped at 100)")
9430
+ limit: import_zod9.z.number().int().positive().max(100).optional().describe("Maximum number of experiments to include (default 25, hard-capped at 100)")
9177
9431
  },
9178
9432
  withToolLogging("platform_experiment_list", async (params) => {
9179
9433
  requireApiKey();
@@ -9186,8 +9440,8 @@ function registerExperimentTools(server) {
9186
9440
  "platform_experiment_list_runs",
9187
9441
  "List experiment runs for a specific experiment slug. Returns a markdown table with each run's id, status, started/finished timestamps, and pass-rate summary. Use this to discover run ids before calling platform_experiment_results. Output is capped (default 25, max 100) to protect the agent's context window.",
9188
9442
  {
9189
- experimentSlug: import_zod8.z.string().describe("Experiment slug from platform_experiment_list (e.g. 'checkout-flow')"),
9190
- limit: import_zod8.z.number().int().positive().max(100).optional().describe("Maximum number of runs to include (default 25, hard-capped at 100)")
9443
+ experimentSlug: import_zod9.z.string().describe("Experiment slug from platform_experiment_list (e.g. 'checkout-flow')"),
9444
+ limit: import_zod9.z.number().int().positive().max(100).optional().describe("Maximum number of runs to include (default 25, hard-capped at 100)")
9191
9445
  },
9192
9446
  withToolLogging("platform_experiment_list_runs", async (params) => {
9193
9447
  requireApiKey();
@@ -9200,15 +9454,15 @@ function registerExperimentTools(server) {
9200
9454
  "platform_experiment_results",
9201
9455
  "Fetch per-row results for an experiment run so you can debug evaluator scores and missed rows. Serves partial results for runs that are still running or were interrupted (it does not require a completed run), with the run status noted in the output. Returns a markdown report: per-evaluator averages plus row-by-row scores and failure details. Output is capped at 50 rows to protect the agent's context window \u2014 narrow with `filter: 'failed'` or `evaluator` to see what matters.",
9202
9456
  {
9203
- runId: import_zod8.z.string().describe("The run ID returned from platform_run_experiment"),
9204
- experimentSlug: import_zod8.z.string().optional().describe(
9457
+ runId: import_zod9.z.string().describe("The run ID returned from platform_run_experiment"),
9458
+ experimentSlug: import_zod9.z.string().optional().describe(
9205
9459
  "Experiment slug \u2014 required when fetching results for runs older than 24h (Redis state may have expired). Use platform_experiment_list_runs to find the slug."
9206
9460
  ),
9207
- filter: import_zod8.z.enum(["all", "failed"]).optional().describe(
9461
+ filter: import_zod9.z.enum(["all", "failed"]).optional().describe(
9208
9462
  "Filter rows: 'failed' shows only rows that errored or failed an evaluation; 'all' (default) shows everything"
9209
9463
  ),
9210
- evaluator: import_zod8.z.string().optional().describe("Show only this evaluator's results (matched on `evaluator` field)"),
9211
- limit: import_zod8.z.number().int().positive().max(50).optional().describe(
9464
+ evaluator: import_zod9.z.string().optional().describe("Show only this evaluator's results (matched on `evaluator` field)"),
9465
+ limit: import_zod9.z.number().int().positive().max(50).optional().describe(
9212
9466
  "Maximum number of rows to include in the markdown output (default 50, hard-capped at 50)."
9213
9467
  )
9214
9468
  },
@@ -9225,7 +9479,7 @@ function registerDatasetTools(server) {
9225
9479
  "platform_list_datasets",
9226
9480
  "List all datasets on the LangWatch platform with their names, slugs, columns, and record counts. Returns AI-readable digest by default.",
9227
9481
  {
9228
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
9482
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
9229
9483
  },
9230
9484
  async (params) => {
9231
9485
  const { requireApiKey: requireApiKey2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -9240,8 +9494,8 @@ function registerDatasetTools(server) {
9240
9494
  "platform_get_dataset",
9241
9495
  "Get full details of a dataset on the LangWatch platform by slug or ID, including column definitions and a preview of records.",
9242
9496
  {
9243
- slugOrId: import_zod8.z.string().describe("The dataset slug or ID to retrieve"),
9244
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
9497
+ slugOrId: import_zod9.z.string().describe("The dataset slug or ID to retrieve"),
9498
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
9245
9499
  },
9246
9500
  async (params) => {
9247
9501
  const { requireApiKey: requireApiKey2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -9269,9 +9523,9 @@ function registerDatasetTools(server) {
9269
9523
  "platform_update_dataset",
9270
9524
  "Update an existing dataset on the LangWatch platform (name and/or column types).",
9271
9525
  {
9272
- slugOrId: import_zod8.z.string().describe("The dataset slug or ID to update"),
9273
- name: import_zod8.z.string().optional().describe("Updated dataset name"),
9274
- columnTypes: import_zod8.z.array(datasetColumnDefinitionSchema).optional().describe("Updated column definitions")
9526
+ slugOrId: import_zod9.z.string().describe("The dataset slug or ID to update"),
9527
+ name: import_zod9.z.string().optional().describe("Updated dataset name"),
9528
+ columnTypes: import_zod9.z.array(datasetColumnDefinitionSchema).optional().describe("Updated column definitions")
9275
9529
  },
9276
9530
  async (params) => {
9277
9531
  const { requireApiKey: requireApiKey2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -9286,7 +9540,7 @@ function registerDatasetTools(server) {
9286
9540
  "platform_delete_dataset",
9287
9541
  "Delete (archive) a dataset on the LangWatch platform.",
9288
9542
  {
9289
- slugOrId: import_zod8.z.string().describe("The dataset slug or ID to delete")
9543
+ slugOrId: import_zod9.z.string().describe("The dataset slug or ID to delete")
9290
9544
  },
9291
9545
  async (params) => {
9292
9546
  const { requireApiKey: requireApiKey2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -9301,10 +9555,10 @@ function registerDatasetTools(server) {
9301
9555
  "platform_list_dataset_records",
9302
9556
  "List records in a dataset on the LangWatch platform with pagination.",
9303
9557
  {
9304
- slugOrId: import_zod8.z.string().describe("The dataset slug or ID to list records from"),
9305
- page: import_zod8.z.number().int().min(1).optional().describe("Page number (default: 1)"),
9306
- limit: import_zod8.z.number().int().min(1).max(1e3).optional().describe("Records per page (default: 50, max: 1000)"),
9307
- format: import_zod8.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
9558
+ slugOrId: import_zod9.z.string().describe("The dataset slug or ID to list records from"),
9559
+ page: import_zod9.z.number().int().min(1).optional().describe("Page number (default: 1)"),
9560
+ limit: import_zod9.z.number().int().min(1).max(1e3).optional().describe("Records per page (default: 50, max: 1000)"),
9561
+ format: import_zod9.z.enum(["digest", "json"]).optional().describe("Output format: 'digest' (default, AI-readable) or 'json' (full raw data)")
9308
9562
  },
9309
9563
  async (params) => {
9310
9564
  const { requireApiKey: requireApiKey2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -9319,8 +9573,8 @@ function registerDatasetTools(server) {
9319
9573
  "platform_create_dataset_records",
9320
9574
  "Add records to a dataset on the LangWatch platform in batch (max 1000 per call).",
9321
9575
  {
9322
- slugOrId: import_zod8.z.string().describe("The dataset slug or ID to add records to"),
9323
- entries: import_zod8.z.array(import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown())).min(1).max(1e3).describe("Array of record entries to create (key-value objects matching dataset columns)")
9576
+ slugOrId: import_zod9.z.string().describe("The dataset slug or ID to add records to"),
9577
+ entries: import_zod9.z.array(import_zod9.z.record(import_zod9.z.string(), import_zod9.z.unknown())).min(1).max(1e3).describe("Array of record entries to create (key-value objects matching dataset columns)")
9324
9578
  },
9325
9579
  async (params) => {
9326
9580
  const { requireApiKey: requireApiKey2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -9335,9 +9589,9 @@ function registerDatasetTools(server) {
9335
9589
  "platform_update_dataset_record",
9336
9590
  "Update a single record in a dataset on the LangWatch platform.",
9337
9591
  {
9338
- slugOrId: import_zod8.z.string().describe("The dataset slug or ID containing the record"),
9339
- recordId: import_zod8.z.string().describe("The record ID to update"),
9340
- entry: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()).describe("Updated record entry (key-value object)")
9592
+ slugOrId: import_zod9.z.string().describe("The dataset slug or ID containing the record"),
9593
+ recordId: import_zod9.z.string().describe("The record ID to update"),
9594
+ entry: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.unknown()).describe("Updated record entry (key-value object)")
9341
9595
  },
9342
9596
  async (params) => {
9343
9597
  const { requireApiKey: requireApiKey2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -9352,8 +9606,8 @@ function registerDatasetTools(server) {
9352
9606
  "platform_delete_dataset_records",
9353
9607
  "Delete records from a dataset on the LangWatch platform by their IDs.",
9354
9608
  {
9355
- slugOrId: import_zod8.z.string().describe("The dataset slug or ID containing the records"),
9356
- recordIds: import_zod8.z.array(import_zod8.z.string()).min(1).max(1e3).describe("Array of record IDs to delete")
9609
+ slugOrId: import_zod9.z.string().describe("The dataset slug or ID containing the records"),
9610
+ recordIds: import_zod9.z.array(import_zod9.z.string()).min(1).max(1e3).describe("Array of record IDs to delete")
9357
9611
  },
9358
9612
  async (params) => {
9359
9613
  const { requireApiKey: requireApiKey2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -9370,8 +9624,8 @@ function registerProjectTools(server) {
9370
9624
  "platform_list_projects",
9371
9625
  "List all projects in your LangWatch organization. Requires an org-level API key.",
9372
9626
  {
9373
- page: import_zod8.z.number().int().positive().optional().describe("Page number (default: 1)"),
9374
- limit: import_zod8.z.number().int().positive().max(1e3).optional().describe("Results per page (default: 100)")
9627
+ page: import_zod9.z.number().int().positive().optional().describe("Page number (default: 1)"),
9628
+ limit: import_zod9.z.number().int().positive().max(1e3).optional().describe("Results per page (default: 100)")
9375
9629
  },
9376
9630
  withToolLogging("platform_list_projects", async (params) => {
9377
9631
  requireApiKey();
@@ -9385,7 +9639,7 @@ function registerProjectTools(server) {
9385
9639
  "platform_get_project",
9386
9640
  "Get details of a specific project by its ID.",
9387
9641
  {
9388
- id: import_zod8.z.string().describe("The project ID")
9642
+ id: import_zod9.z.string().describe("The project ID")
9389
9643
  },
9390
9644
  withToolLogging("platform_get_project", async (params) => {
9391
9645
  requireApiKey();
@@ -9401,11 +9655,11 @@ function registerProjectTools(server) {
9401
9655
 
9402
9656
  You must provide either teamId (to add the project to an existing team) or newTeamName (to create a new team for the project).`,
9403
9657
  {
9404
- name: import_zod8.z.string().describe("Project name"),
9405
- language: import_zod8.z.string().describe('Programming language (e.g. "python", "typescript")'),
9406
- framework: import_zod8.z.string().describe('Framework (e.g. "openai", "langchain", "custom")'),
9407
- teamId: import_zod8.z.string().optional().describe("ID of an existing team to add the project to"),
9408
- newTeamName: import_zod8.z.string().optional().describe("Name for a new team to create for this project")
9658
+ name: import_zod9.z.string().describe("Project name"),
9659
+ language: import_zod9.z.string().describe('Programming language (e.g. "python", "typescript")'),
9660
+ framework: import_zod9.z.string().describe('Framework (e.g. "openai", "langchain", "custom")'),
9661
+ teamId: import_zod9.z.string().optional().describe("ID of an existing team to add the project to"),
9662
+ newTeamName: import_zod9.z.string().optional().describe("Name for a new team to create for this project")
9409
9663
  },
9410
9664
  withToolLogging("platform_create_project", async (params) => {
9411
9665
  requireApiKey();
@@ -9419,11 +9673,11 @@ You must provide either teamId (to add the project to an existing team) or newTe
9419
9673
  "platform_update_project",
9420
9674
  "Update an existing project's name, language, framework, or PII redaction level.",
9421
9675
  {
9422
- id: import_zod8.z.string().describe("The project ID to update"),
9423
- name: import_zod8.z.string().optional().describe("New project name"),
9424
- language: import_zod8.z.string().optional().describe("New programming language"),
9425
- framework: import_zod8.z.string().optional().describe("New framework"),
9426
- piiRedactionLevel: import_zod8.z.enum(["STRICT", "ESSENTIAL", "DISABLED"]).optional().describe("PII redaction level")
9676
+ id: import_zod9.z.string().describe("The project ID to update"),
9677
+ name: import_zod9.z.string().optional().describe("New project name"),
9678
+ language: import_zod9.z.string().optional().describe("New programming language"),
9679
+ framework: import_zod9.z.string().optional().describe("New framework"),
9680
+ piiRedactionLevel: import_zod9.z.enum(["STRICT", "ESSENTIAL", "DISABLED"]).optional().describe("PII redaction level")
9427
9681
  },
9428
9682
  withToolLogging("platform_update_project", async (params) => {
9429
9683
  requireApiKey();
@@ -9437,7 +9691,7 @@ You must provide either teamId (to add the project to an existing team) or newTe
9437
9691
  "platform_archive_project",
9438
9692
  "Archive (soft-delete) a project. The project can be restored later if needed.",
9439
9693
  {
9440
- id: import_zod8.z.string().describe("The project ID to archive")
9694
+ id: import_zod9.z.string().describe("The project ID to archive")
9441
9695
  },
9442
9696
  withToolLogging("platform_archive_project", async (params) => {
9443
9697
  requireApiKey();
@@ -9470,18 +9724,18 @@ function registerApiKeyTools(server) {
9470
9724
 
9471
9725
  The token is returned once and cannot be retrieved again.`,
9472
9726
  {
9473
- keyType: import_zod8.z.enum(["personal", "service"]).describe("Key type: 'personal' (user-tied) or 'service' (headless)"),
9474
- name: import_zod8.z.string().describe("Key name (max 100 chars)"),
9475
- description: import_zod8.z.string().optional().describe("Key description (max 500 chars)"),
9476
- expiresAt: import_zod8.z.string().optional().describe("Expiration date (ISO string)"),
9477
- bindings: import_zod8.z.array(
9478
- import_zod8.z.object({
9479
- role: import_zod8.z.enum(["ADMIN", "MEMBER", "VIEWER"]).describe("Role"),
9480
- scopeType: import_zod8.z.enum(["ORGANIZATION", "TEAM", "PROJECT"]).describe("Scope type"),
9481
- scopeId: import_zod8.z.string().describe("Scope ID (org, team, or project ID)")
9727
+ keyType: import_zod9.z.enum(["personal", "service"]).describe("Key type: 'personal' (user-tied) or 'service' (headless)"),
9728
+ name: import_zod9.z.string().describe("Key name (max 100 chars)"),
9729
+ description: import_zod9.z.string().optional().describe("Key description (max 500 chars)"),
9730
+ expiresAt: import_zod9.z.string().optional().describe("Expiration date (ISO string)"),
9731
+ bindings: import_zod9.z.array(
9732
+ import_zod9.z.object({
9733
+ role: import_zod9.z.enum(["ADMIN", "MEMBER", "VIEWER"]).describe("Role"),
9734
+ scopeType: import_zod9.z.enum(["ORGANIZATION", "TEAM", "PROJECT"]).describe("Scope type"),
9735
+ scopeId: import_zod9.z.string().describe("Scope ID (org, team, or project ID)")
9482
9736
  })
9483
9737
  ).optional().describe("Role bindings (required for personal keys)"),
9484
- projectIds: import_zod8.z.array(import_zod8.z.string()).optional().describe("Project IDs for service keys (creates ADMIN bindings per project)")
9738
+ projectIds: import_zod9.z.array(import_zod9.z.string()).optional().describe("Project IDs for service keys (creates ADMIN bindings per project)")
9485
9739
  },
9486
9740
  withToolLogging("platform_create_api_key", async (params) => {
9487
9741
  requireApiKey();
@@ -9495,7 +9749,7 @@ The token is returned once and cannot be retrieved again.`,
9495
9749
  "platform_revoke_api_key",
9496
9750
  "Revoke an API key. Once revoked, the key can no longer be used for authentication.",
9497
9751
  {
9498
- id: import_zod8.z.string().describe("The API key ID to revoke")
9752
+ id: import_zod9.z.string().describe("The API key ID to revoke")
9499
9753
  },
9500
9754
  withToolLogging("platform_revoke_api_key", async (params) => {
9501
9755
  requireApiKey();