@sentry/mcp-server 0.13.0 → 0.15.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 (336) hide show
  1. package/README.md +15 -2
  2. package/dist/{analyze-issue-with-seer-Bq3kefOr.cjs → analyze-issue-with-seer-BkVrrh28.cjs} +10 -17
  3. package/dist/analyze-issue-with-seer-BkVrrh28.cjs.map +1 -0
  4. package/dist/{analyze-issue-with-seer-Dk0ZFwN8.js → analyze-issue-with-seer-CoqsTklL.js} +10 -17
  5. package/dist/analyze-issue-with-seer-CoqsTklL.js.map +1 -0
  6. package/dist/api-client/client.cjs +1 -1
  7. package/dist/api-client/client.d.cts +3 -3
  8. package/dist/api-client/client.d.ts +3 -3
  9. package/dist/api-client/client.js +1 -1
  10. package/dist/api-client/index.cjs +1 -1
  11. package/dist/api-client/index.d.cts +3 -3
  12. package/dist/api-client/index.d.ts +4 -4
  13. package/dist/api-client/index.js +1 -1
  14. package/dist/api-client/schema.d.cts +1 -1
  15. package/dist/api-client/schema.d.ts +1 -1
  16. package/dist/api-client/types.d.cts +2 -2
  17. package/dist/api-client/types.d.ts +2 -2
  18. package/dist/{api-utils-BcB1cMXS.js → api-utils-C6QJAzFL.js} +4 -4
  19. package/dist/api-utils-C6QJAzFL.js.map +1 -0
  20. package/dist/{api-utils-BJS0CChW.cjs → api-utils-d36iteNO.cjs} +4 -4
  21. package/dist/api-utils-d36iteNO.cjs.map +1 -0
  22. package/dist/{client-Dae1ZwWb.d.cts → client-CQ9Xe1aN.d.cts} +17 -19
  23. package/dist/client-CQ9Xe1aN.d.cts.map +1 -0
  24. package/dist/{client-BbamPqV4.js → client-DOYWNvVM.js} +21 -12
  25. package/dist/client-DOYWNvVM.js.map +1 -0
  26. package/dist/{client-BNTsOycD.cjs → client-Dkw5iYu3.cjs} +21 -12
  27. package/dist/client-Dkw5iYu3.cjs.map +1 -0
  28. package/dist/{client-qyEu8fvj.d.ts → client-VCJp6Kcu.d.ts} +19 -21
  29. package/dist/client-VCJp6Kcu.d.ts.map +1 -0
  30. package/dist/{create-dsn-B3L8iWno.js → create-dsn-D530I7Lr.js} +2 -2
  31. package/dist/{create-dsn-B3L8iWno.js.map → create-dsn-D530I7Lr.js.map} +1 -1
  32. package/dist/{create-dsn-CVPtt_Es.cjs → create-dsn-Dz8nyTFw.cjs} +2 -2
  33. package/dist/{create-dsn-CVPtt_Es.cjs.map → create-dsn-Dz8nyTFw.cjs.map} +1 -1
  34. package/dist/{create-project-B_6a6okf.cjs → create-project-BxzRiryg.cjs} +3 -3
  35. package/dist/{create-project-B_6a6okf.cjs.map → create-project-BxzRiryg.cjs.map} +1 -1
  36. package/dist/{create-project-DdIXMvWI.js → create-project-K1od5Rhx.js} +3 -3
  37. package/dist/{create-project-DdIXMvWI.js.map → create-project-K1od5Rhx.js.map} +1 -1
  38. package/dist/{create-team-C1DP5Z1r.cjs → create-team-CJhrccc1.cjs} +2 -2
  39. package/dist/{create-team-C1DP5Z1r.cjs.map → create-team-CJhrccc1.cjs.map} +1 -1
  40. package/dist/{create-team-BarRdaZK.js → create-team-zHz00C6Q.js} +2 -2
  41. package/dist/{create-team-BarRdaZK.js.map → create-team-zHz00C6Q.js.map} +1 -1
  42. package/dist/{fetch-utils-B-a92ObC.d.ts → fetch-utils-Bv9WjUp0.d.ts} +1 -1
  43. package/dist/fetch-utils-Bv9WjUp0.d.ts.map +1 -0
  44. package/dist/{find-dsns-BPbblgrn.js → find-dsns-BoEP0N7B.js} +2 -2
  45. package/dist/{find-dsns-BPbblgrn.js.map → find-dsns-BoEP0N7B.js.map} +1 -1
  46. package/dist/{find-dsns-BDJWY6nZ.cjs → find-dsns-CK59RaUJ.cjs} +2 -2
  47. package/dist/{find-dsns-BDJWY6nZ.cjs.map → find-dsns-CK59RaUJ.cjs.map} +1 -1
  48. package/dist/{find-errors-B9wLxXA0.js → find-errors-C3oUMeRi.js} +2 -2
  49. package/dist/{find-errors-B9wLxXA0.js.map → find-errors-C3oUMeRi.js.map} +1 -1
  50. package/dist/{find-errors-DnFs3PaH.cjs → find-errors-CB9NpSxG.cjs} +2 -2
  51. package/dist/{find-errors-DnFs3PaH.cjs.map → find-errors-CB9NpSxG.cjs.map} +1 -1
  52. package/dist/{find-issues-CwPbwRXK.cjs → find-issues-C3uk59rn.cjs} +2 -2
  53. package/dist/{find-issues-CwPbwRXK.cjs.map → find-issues-C3uk59rn.cjs.map} +1 -1
  54. package/dist/{find-issues-BI1tI3cJ.js → find-issues-CAtNGBly.js} +2 -2
  55. package/dist/{find-issues-BI1tI3cJ.js.map → find-issues-CAtNGBly.js.map} +1 -1
  56. package/dist/{find-organizations-DqS6zoTK.cjs → find-organizations-BrdMfZRO.cjs} +2 -2
  57. package/dist/{find-organizations-DqS6zoTK.cjs.map → find-organizations-BrdMfZRO.cjs.map} +1 -1
  58. package/dist/{find-organizations-CdiouW48.js → find-organizations-ojXwWWzk.js} +2 -2
  59. package/dist/{find-organizations-CdiouW48.js.map → find-organizations-ojXwWWzk.js.map} +1 -1
  60. package/dist/{find-projects-Ba6cdX7n.cjs → find-projects-BZWhlYJh.cjs} +2 -2
  61. package/dist/{find-projects-Ba6cdX7n.cjs.map → find-projects-BZWhlYJh.cjs.map} +1 -1
  62. package/dist/{find-projects-Ccfxv47h.js → find-projects-fcLG4KpT.js} +2 -2
  63. package/dist/{find-projects-Ccfxv47h.js.map → find-projects-fcLG4KpT.js.map} +1 -1
  64. package/dist/{find-releases-CFoGytN-.js → find-releases-BUozr0Z-.js} +2 -2
  65. package/dist/{find-releases-CFoGytN-.js.map → find-releases-BUozr0Z-.js.map} +1 -1
  66. package/dist/{find-releases-CFl86XMT.cjs → find-releases-CZCVEOHZ.cjs} +2 -2
  67. package/dist/{find-releases-CFl86XMT.cjs.map → find-releases-CZCVEOHZ.cjs.map} +1 -1
  68. package/dist/{find-tags-h2o0BKWO.cjs → find-tags-Byk4d3oZ.cjs} +2 -2
  69. package/dist/{find-tags-h2o0BKWO.cjs.map → find-tags-Byk4d3oZ.cjs.map} +1 -1
  70. package/dist/{find-tags-ORtYLH5b.js → find-tags-d-wF1Se8.js} +2 -2
  71. package/dist/{find-tags-ORtYLH5b.js.map → find-tags-d-wF1Se8.js.map} +1 -1
  72. package/dist/{find-teams-hreVp1nw.js → find-teams-BZ118EIK.js} +2 -2
  73. package/dist/{find-teams-hreVp1nw.js.map → find-teams-BZ118EIK.js.map} +1 -1
  74. package/dist/{find-teams-DUcDfSOl.cjs → find-teams-CnU5x9rQ.cjs} +2 -2
  75. package/dist/{find-teams-DUcDfSOl.cjs.map → find-teams-CnU5x9rQ.cjs.map} +1 -1
  76. package/dist/{find-transactions-BehUqQYs.js → find-transactions-BiBgg-AE.js} +2 -2
  77. package/dist/{find-transactions-BehUqQYs.js.map → find-transactions-BiBgg-AE.js.map} +1 -1
  78. package/dist/{find-transactions-BkPscam3.cjs → find-transactions-DuZyqjhF.cjs} +2 -2
  79. package/dist/{find-transactions-BkPscam3.cjs.map → find-transactions-DuZyqjhF.cjs.map} +1 -1
  80. package/dist/{formatting-pUm38KOj.js → formatting-Bvyded57.js} +34 -2
  81. package/dist/formatting-Bvyded57.js.map +1 -0
  82. package/dist/{formatting-Di1X9Jn3.d.cts → formatting-CcTK2X8V.d.cts} +7 -5
  83. package/dist/formatting-CcTK2X8V.d.cts.map +1 -0
  84. package/dist/{formatting-BlMiQa9i.cjs → formatting-D0Aki7rK.cjs} +33 -2
  85. package/dist/formatting-D0Aki7rK.cjs.map +1 -0
  86. package/dist/{formatting-utils-C3sej5ER.js → formatting-utils-DgOyTl-m.js} +1 -1
  87. package/dist/{formatting-utils-C3sej5ER.js.map → formatting-utils-DgOyTl-m.js.map} +1 -1
  88. package/dist/{formatting-utils-DDz14xeB.cjs → formatting-utils-m9R5bsRU.cjs} +1 -1
  89. package/dist/{formatting-utils-DDz14xeB.cjs.map → formatting-utils-m9R5bsRU.cjs.map} +1 -1
  90. package/dist/{formatting-B-u5CbYn.d.ts → formatting-vtXxusbn.d.ts} +7 -5
  91. package/dist/formatting-vtXxusbn.d.ts.map +1 -0
  92. package/dist/{get-doc-AuAW_qr9.cjs → get-doc-DaTCenOE.cjs} +2 -2
  93. package/dist/{get-doc-AuAW_qr9.cjs.map → get-doc-DaTCenOE.cjs.map} +1 -1
  94. package/dist/{get-doc-BtxZOy7y.js → get-doc-YTiQznr1.js} +2 -2
  95. package/dist/{get-doc-BtxZOy7y.js.map → get-doc-YTiQznr1.js.map} +1 -1
  96. package/dist/{get-event-attachment-Bq5lkaKV.cjs → get-event-attachment-C-ig2-3F.cjs} +2 -2
  97. package/dist/{get-event-attachment-Bq5lkaKV.cjs.map → get-event-attachment-C-ig2-3F.cjs.map} +1 -1
  98. package/dist/{get-event-attachment-DwAl54zv.js → get-event-attachment-DVCPpUMj.js} +2 -2
  99. package/dist/{get-event-attachment-DwAl54zv.js.map → get-event-attachment-DVCPpUMj.js.map} +1 -1
  100. package/dist/{get-issue-details-DrpD5LlK.js → get-issue-details-Dcmzxknx.js} +24 -11
  101. package/dist/get-issue-details-Dcmzxknx.js.map +1 -0
  102. package/dist/{get-issue-details-qGwu18JX.cjs → get-issue-details-lBrYR9yx.cjs} +24 -11
  103. package/dist/get-issue-details-lBrYR9yx.cjs.map +1 -0
  104. package/dist/index.cjs +53 -42
  105. package/dist/index.cjs.map +1 -1
  106. package/dist/index.js +53 -42
  107. package/dist/index.js.map +1 -1
  108. package/dist/internal/fetch-utils.d.ts +1 -1
  109. package/dist/internal/formatting.cjs +2 -1
  110. package/dist/internal/formatting.d.cts +4 -4
  111. package/dist/internal/formatting.d.ts +5 -5
  112. package/dist/internal/formatting.js +2 -1
  113. package/dist/internal/issue-helpers.d.ts +1 -1
  114. package/dist/internal/test-fixtures.d.cts +20 -20
  115. package/dist/internal/test-fixtures.d.ts +62 -62
  116. package/dist/internal/test-fixtures.d.ts.map +1 -1
  117. package/dist/{issue-helpers-BOn4g7rx.d.ts → issue-helpers-BJffpNoO.d.ts} +1 -1
  118. package/dist/{issue-helpers-BOn4g7rx.d.ts.map → issue-helpers-BJffpNoO.d.ts.map} +1 -1
  119. package/dist/{logging-oIouXrcb.cjs → logging-CX2buXiG.cjs} +1 -1
  120. package/dist/{logging-oIouXrcb.cjs.map → logging-CX2buXiG.cjs.map} +1 -1
  121. package/dist/{logging-LnQMFw-_.js → logging-DzxYBMrn.js} +1 -1
  122. package/dist/{logging-LnQMFw-_.js.map → logging-DzxYBMrn.js.map} +1 -1
  123. package/dist/logging.cjs +1 -1
  124. package/dist/logging.js +1 -1
  125. package/dist/{promptDefinitions-6xelipaz.d.ts → promptDefinitions-D3GTBGLr.d.ts} +1 -1
  126. package/dist/promptDefinitions-D3GTBGLr.d.ts.map +1 -0
  127. package/dist/promptDefinitions.d.ts +1 -1
  128. package/dist/prompts.d.cts +1 -1
  129. package/dist/prompts.d.ts +2 -2
  130. package/dist/{schema-B5BpplNK.d.ts → schema-3NeMWRAm.d.cts} +273 -273
  131. package/dist/{schema-Dt-HKnd_.d.cts.map → schema-3NeMWRAm.d.cts.map} +1 -1
  132. package/dist/{schema-Dt-HKnd_.d.cts → schema-B3CzDGJk.d.ts} +303 -303
  133. package/dist/{schema-B5BpplNK.d.ts.map → schema-B3CzDGJk.d.ts.map} +1 -1
  134. package/dist/{search-docs-CrMdRDJy.js → search-docs-BLbB_GV2.js} +3 -3
  135. package/dist/search-docs-BLbB_GV2.js.map +1 -0
  136. package/dist/{search-docs-VhefTOOH.cjs → search-docs-D5Foht_0.cjs} +3 -3
  137. package/dist/search-docs-D5Foht_0.cjs.map +1 -0
  138. package/dist/{seer-utils-CzYEEZb2.cjs → seer-utils-CDm5J8ur.cjs} +2 -2
  139. package/dist/{seer-utils-CzYEEZb2.cjs.map → seer-utils-CDm5J8ur.cjs.map} +1 -1
  140. package/dist/{seer-utils-Ckr8nYlz.js → seer-utils-Cj9DXrow.js} +2 -2
  141. package/dist/{seer-utils-Ckr8nYlz.js.map → seer-utils-Cj9DXrow.js.map} +1 -1
  142. package/dist/{server-DeuBftc5.js → server-BSRxzYFd.js} +4 -4
  143. package/dist/{server-DeuBftc5.js.map → server-BSRxzYFd.js.map} +1 -1
  144. package/dist/{server-CHG27fcn.cjs → server-Dgkqz8bA.cjs} +4 -4
  145. package/dist/{server-CHG27fcn.cjs.map → server-Dgkqz8bA.cjs.map} +1 -1
  146. package/dist/server.cjs +29 -29
  147. package/dist/server.d.cts +1 -1
  148. package/dist/server.d.ts +2 -2
  149. package/dist/server.js +29 -29
  150. package/dist/{stdio-BtVdTwx-.cjs → stdio-BQAm0Liz.cjs} +3 -3
  151. package/dist/{stdio-BtVdTwx-.cjs.map → stdio-BQAm0Liz.cjs.map} +1 -1
  152. package/dist/{stdio-DIuLW5EE.js → stdio-BcihaDjO.js} +3 -3
  153. package/dist/{stdio-DIuLW5EE.js.map → stdio-BcihaDjO.js.map} +1 -1
  154. package/dist/test-setup.cjs +1 -16
  155. package/dist/test-setup.cjs.map +1 -1
  156. package/dist/test-setup.js +1 -16
  157. package/dist/test-setup.js.map +1 -1
  158. package/dist/toolDefinitions.js +2 -2
  159. package/dist/tools/analyze-issue-with-seer.cjs +6 -6
  160. package/dist/tools/analyze-issue-with-seer.d.cts +2 -2
  161. package/dist/tools/analyze-issue-with-seer.d.ts +3 -3
  162. package/dist/tools/analyze-issue-with-seer.js +6 -6
  163. package/dist/tools/create-dsn.cjs +3 -3
  164. package/dist/tools/create-dsn.d.cts +2 -2
  165. package/dist/tools/create-dsn.d.ts +3 -3
  166. package/dist/tools/create-dsn.js +3 -3
  167. package/dist/tools/create-project.cjs +4 -4
  168. package/dist/tools/create-project.d.cts +2 -2
  169. package/dist/tools/create-project.d.ts +3 -3
  170. package/dist/tools/create-project.js +4 -4
  171. package/dist/tools/create-team.cjs +3 -3
  172. package/dist/tools/create-team.d.cts +2 -2
  173. package/dist/tools/create-team.d.ts +3 -3
  174. package/dist/tools/create-team.js +3 -3
  175. package/dist/tools/find-dsns.cjs +3 -3
  176. package/dist/tools/find-dsns.d.cts +2 -2
  177. package/dist/tools/find-dsns.d.ts +3 -3
  178. package/dist/tools/find-dsns.js +3 -3
  179. package/dist/tools/find-errors.cjs +3 -3
  180. package/dist/tools/find-errors.d.cts +2 -2
  181. package/dist/tools/find-errors.d.ts +3 -3
  182. package/dist/tools/find-errors.js +3 -3
  183. package/dist/tools/find-issues.cjs +3 -3
  184. package/dist/tools/find-issues.d.cts +2 -2
  185. package/dist/tools/find-issues.d.ts +3 -3
  186. package/dist/tools/find-issues.js +3 -3
  187. package/dist/tools/find-organizations.cjs +3 -3
  188. package/dist/tools/find-organizations.d.cts +2 -2
  189. package/dist/tools/find-organizations.d.ts +3 -3
  190. package/dist/tools/find-organizations.js +3 -3
  191. package/dist/tools/find-projects.cjs +3 -3
  192. package/dist/tools/find-projects.d.cts +2 -2
  193. package/dist/tools/find-projects.d.ts +3 -3
  194. package/dist/tools/find-projects.js +3 -3
  195. package/dist/tools/find-releases.cjs +3 -3
  196. package/dist/tools/find-releases.d.cts +2 -2
  197. package/dist/tools/find-releases.d.ts +3 -3
  198. package/dist/tools/find-releases.js +3 -3
  199. package/dist/tools/find-tags.cjs +3 -3
  200. package/dist/tools/find-tags.d.cts +2 -2
  201. package/dist/tools/find-tags.d.ts +3 -3
  202. package/dist/tools/find-tags.js +3 -3
  203. package/dist/tools/find-teams.cjs +3 -3
  204. package/dist/tools/find-teams.d.cts +2 -2
  205. package/dist/tools/find-teams.d.ts +3 -3
  206. package/dist/tools/find-teams.js +3 -3
  207. package/dist/tools/find-transactions.cjs +3 -3
  208. package/dist/tools/find-transactions.d.cts +2 -2
  209. package/dist/tools/find-transactions.d.ts +3 -3
  210. package/dist/tools/find-transactions.js +3 -3
  211. package/dist/tools/get-doc.cjs +2 -2
  212. package/dist/tools/get-doc.d.cts +2 -2
  213. package/dist/tools/get-doc.d.ts +3 -3
  214. package/dist/tools/get-doc.js +2 -2
  215. package/dist/tools/get-event-attachment.cjs +3 -3
  216. package/dist/tools/get-event-attachment.d.cts +2 -2
  217. package/dist/tools/get-event-attachment.d.ts +3 -3
  218. package/dist/tools/get-event-attachment.js +3 -3
  219. package/dist/tools/get-issue-details.cjs +6 -5
  220. package/dist/tools/get-issue-details.d.cts +2 -2
  221. package/dist/tools/get-issue-details.d.ts +3 -3
  222. package/dist/tools/get-issue-details.js +6 -5
  223. package/dist/tools/index.cjs +28 -28
  224. package/dist/tools/index.d.cts +2 -2
  225. package/dist/tools/index.d.ts +79 -79
  226. package/dist/tools/index.js +28 -28
  227. package/dist/tools/search-docs.cjs +2 -2
  228. package/dist/tools/search-docs.d.cts +2 -2
  229. package/dist/tools/search-docs.d.ts +3 -3
  230. package/dist/tools/search-docs.js +2 -2
  231. package/dist/tools/types.d.cts +2 -2
  232. package/dist/tools/types.d.ts +3 -3
  233. package/dist/tools/update-issue.cjs +7 -6
  234. package/dist/tools/update-issue.d.cts +2 -2
  235. package/dist/tools/update-issue.d.ts +3 -3
  236. package/dist/tools/update-issue.js +7 -6
  237. package/dist/tools/update-project.cjs +4 -4
  238. package/dist/tools/update-project.d.cts +2 -2
  239. package/dist/tools/update-project.d.ts +3 -3
  240. package/dist/tools/update-project.js +4 -4
  241. package/dist/tools/utils/api-utils.cjs +2 -2
  242. package/dist/tools/utils/api-utils.d.cts +5 -5
  243. package/dist/tools/utils/api-utils.d.ts +7 -7
  244. package/dist/tools/utils/api-utils.js +2 -2
  245. package/dist/tools/utils/defineTool.d.cts +2 -2
  246. package/dist/tools/utils/defineTool.d.ts +3 -3
  247. package/dist/tools/utils/fetch-utils.d.ts +1 -1
  248. package/dist/tools/utils/formatting-utils.cjs +1 -1
  249. package/dist/tools/utils/formatting-utils.d.cts +3 -3
  250. package/dist/tools/utils/formatting-utils.d.ts +4 -4
  251. package/dist/tools/utils/formatting-utils.js +1 -1
  252. package/dist/tools/utils/issue-utils.cjs +3 -2
  253. package/dist/tools/utils/issue-utils.d.cts +4 -4
  254. package/dist/tools/utils/issue-utils.d.ts +6 -6
  255. package/dist/tools/utils/issue-utils.js +3 -2
  256. package/dist/tools/utils/seer-utils.cjs +1 -1
  257. package/dist/tools/utils/seer-utils.d.cts +3 -3
  258. package/dist/tools/utils/seer-utils.d.ts +4 -4
  259. package/dist/tools/utils/seer-utils.js +1 -1
  260. package/dist/tools/whoami.cjs +3 -3
  261. package/dist/tools/whoami.d.cts +2 -2
  262. package/dist/tools/whoami.d.ts +3 -3
  263. package/dist/tools/whoami.js +3 -3
  264. package/dist/{tools-BiZ7ZDKf.cjs → tools-CHnZvVEN.cjs} +21 -21
  265. package/dist/{tools-BiZ7ZDKf.cjs.map → tools-CHnZvVEN.cjs.map} +1 -1
  266. package/dist/{tools-DGF9GhbP.js → tools-CdXGgq1W.js} +21 -21
  267. package/dist/{tools-DGF9GhbP.js.map → tools-CdXGgq1W.js.map} +1 -1
  268. package/dist/transports/stdio.cjs +31 -31
  269. package/dist/transports/stdio.d.cts +1 -1
  270. package/dist/transports/stdio.d.ts +2 -2
  271. package/dist/transports/stdio.js +31 -31
  272. package/dist/{types-C3pRFQyA.d.cts → types-BoMP-Ro6.d.cts} +2 -2
  273. package/dist/{types-C3pRFQyA.d.cts.map → types-BoMP-Ro6.d.cts.map} +1 -1
  274. package/dist/{types-CYjev2Ep.d.cts → types-CUN-2OSS.d.cts} +3 -3
  275. package/dist/{types-CYjev2Ep.d.cts.map → types-CUN-2OSS.d.cts.map} +1 -1
  276. package/dist/{types-CZaMk5Yg.d.cts → types-D_mx318Q.d.cts} +2 -2
  277. package/dist/{types-CZaMk5Yg.d.cts.map → types-D_mx318Q.d.cts.map} +1 -1
  278. package/dist/{types-B2qOfefC.d.ts → types-DkJtNDXU.d.ts} +4 -4
  279. package/dist/{types-B2qOfefC.d.ts.map → types-DkJtNDXU.d.ts.map} +1 -1
  280. package/dist/{types-Br0saqtE.d.ts → types-DpV1JAZj.d.ts} +2 -2
  281. package/dist/{types-Br0saqtE.d.ts.map → types-DpV1JAZj.d.ts.map} +1 -1
  282. package/dist/{types-D5KkaSjc.d.ts → types-qB8a4WQT.d.ts} +2 -2
  283. package/dist/{types-D5KkaSjc.d.ts.map → types-qB8a4WQT.d.ts.map} +1 -1
  284. package/dist/types.d.cts +1 -1
  285. package/dist/types.d.ts +2 -2
  286. package/dist/{update-issue-DN80uuKU.js → update-issue-DRTQvy6p.js} +3 -3
  287. package/dist/{update-issue-DN80uuKU.js.map → update-issue-DRTQvy6p.js.map} +1 -1
  288. package/dist/{update-issue-Bz-u_Yaa.cjs → update-issue-DpkxxiNk.cjs} +3 -3
  289. package/dist/{update-issue-Bz-u_Yaa.cjs.map → update-issue-DpkxxiNk.cjs.map} +1 -1
  290. package/dist/{update-project-C7Xbmhqg.cjs → update-project-DLDDbcGY.cjs} +3 -3
  291. package/dist/{update-project-C7Xbmhqg.cjs.map → update-project-DLDDbcGY.cjs.map} +1 -1
  292. package/dist/{update-project-5j-SOHWU.js → update-project-YLxt2ry2.js} +3 -3
  293. package/dist/{update-project-5j-SOHWU.js.map → update-project-YLxt2ry2.js.map} +1 -1
  294. package/dist/url-utils-C9hykWmk.cjs +106 -0
  295. package/dist/url-utils-C9hykWmk.cjs.map +1 -0
  296. package/dist/url-utils-DvZYfzPM.js +82 -0
  297. package/dist/url-utils-DvZYfzPM.js.map +1 -0
  298. package/dist/utils/url-utils.cjs +6 -0
  299. package/dist/utils/url-utils.d.cts +37 -0
  300. package/dist/utils/url-utils.d.cts.map +1 -0
  301. package/dist/utils/url-utils.d.ts +37 -0
  302. package/dist/utils/url-utils.d.ts.map +1 -0
  303. package/dist/utils/url-utils.js +3 -0
  304. package/dist/version-CcTnFB56.js +6 -0
  305. package/dist/{version-DvMKCu-i.js.map → version-CcTnFB56.js.map} +1 -1
  306. package/dist/{version-Dyz6_b54.cjs → version-rDjaSkPw.cjs} +2 -2
  307. package/dist/{version-Dyz6_b54.cjs.map → version-rDjaSkPw.cjs.map} +1 -1
  308. package/dist/version.cjs +1 -1
  309. package/dist/version.js +1 -1
  310. package/dist/{whoami-qIbcECMA.cjs → whoami-CEgbTUqt.cjs} +2 -2
  311. package/dist/{whoami-qIbcECMA.cjs.map → whoami-CEgbTUqt.cjs.map} +1 -1
  312. package/dist/{whoami-raA70UBD.js → whoami-DesNZnaQ.js} +2 -2
  313. package/dist/{whoami-raA70UBD.js.map → whoami-DesNZnaQ.js.map} +1 -1
  314. package/package.json +3 -3
  315. package/dist/analyze-issue-with-seer-Bq3kefOr.cjs.map +0 -1
  316. package/dist/analyze-issue-with-seer-Dk0ZFwN8.js.map +0 -1
  317. package/dist/api-utils-BJS0CChW.cjs.map +0 -1
  318. package/dist/api-utils-BcB1cMXS.js.map +0 -1
  319. package/dist/client-BNTsOycD.cjs.map +0 -1
  320. package/dist/client-BbamPqV4.js.map +0 -1
  321. package/dist/client-Dae1ZwWb.d.cts.map +0 -1
  322. package/dist/client-qyEu8fvj.d.ts.map +0 -1
  323. package/dist/fetch-utils-B-a92ObC.d.ts.map +0 -1
  324. package/dist/formatting-B-u5CbYn.d.ts.map +0 -1
  325. package/dist/formatting-BlMiQa9i.cjs.map +0 -1
  326. package/dist/formatting-Di1X9Jn3.d.cts.map +0 -1
  327. package/dist/formatting-pUm38KOj.js.map +0 -1
  328. package/dist/get-issue-details-DrpD5LlK.js.map +0 -1
  329. package/dist/get-issue-details-qGwu18JX.cjs.map +0 -1
  330. package/dist/promptDefinitions-6xelipaz.d.ts.map +0 -1
  331. package/dist/search-docs-CrMdRDJy.js.map +0 -1
  332. package/dist/search-docs-VhefTOOH.cjs.map +0 -1
  333. package/dist/version-DvMKCu-i.js +0 -6
  334. /package/dist/{index-BrojxuhJ.d.ts → index-DVGDAddE.d.ts} +0 -0
  335. /package/dist/{issue-utils-BVAB6I-Z.js → issue-utils-BbCfbiY8.js} +0 -0
  336. /package/dist/{issue-utils-pdbo-5LW.cjs → issue-utils-DMKiif6C.cjs} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-BNTsOycD.cjs","names":["NETWORK_ERROR_MESSAGES: Record<string, string>","message: string","status: number","host: string","path: string","options: RequestInit","headers: Record<string, string>","response: Response","parsed: unknown | undefined","organizationSlug: string","issueId: string","traceId: string","opts?: RequestOptions","updateData: Record<string, any>","sentryQuery: string[]"],"sources":["../src/api-client/client.ts"],"sourcesContent":["import {\n OrganizationListSchema,\n ClientKeySchema,\n TeamListSchema,\n TeamSchema,\n ProjectListSchema,\n ProjectSchema,\n ReleaseListSchema,\n IssueListSchema,\n IssueSchema,\n EventSchema,\n EventAttachmentListSchema,\n EventAttachmentSchema,\n ErrorsSearchResponseSchema,\n SpansSearchResponseSchema,\n TagListSchema,\n ApiErrorSchema,\n ClientKeyListSchema,\n AutofixRunSchema,\n AutofixRunStateSchema,\n UserSchema,\n UserRegionsSchema,\n} from \"./schema\";\nimport type {\n AutofixRun,\n AutofixRunState,\n ClientKey,\n ClientKeyList,\n Event,\n EventAttachment,\n EventAttachmentList,\n Issue,\n IssueList,\n OrganizationList,\n Project,\n ProjectList,\n ReleaseList,\n TagList,\n Team,\n TeamList,\n User,\n} from \"./types\";\n// TODO: this is shared - so ideally, for safety, it uses @sentry/core, but currently\n// logger isnt exposed (or rather, it is, but its not the right logger)\n// import { logger } from \"@sentry/node\";\n\n/**\n * Mapping of common network error codes to user-friendly messages.\n * These help users understand and resolve connection issues.\n */\nconst NETWORK_ERROR_MESSAGES: Record<string, string> = {\n EAI_AGAIN: \"DNS temporarily unavailable. Check your internet connection.\",\n ENOTFOUND: \"Hostname not found. Verify the URL is correct.\",\n ECONNREFUSED: \"Connection refused. Ensure the service is accessible.\",\n ETIMEDOUT: \"Connection timed out. Check network connectivity.\",\n ECONNRESET: \"Connection reset. Try again in a moment.\",\n};\n\n/**\n * Custom error class for Sentry API responses.\n *\n * Provides enhanced error messages for LLM consumption and handles\n * common API error scenarios with user-friendly messaging.\n *\n * @example\n * ```typescript\n * try {\n * await apiService.listIssues({ organizationSlug: \"invalid\" });\n * } catch (error) {\n * if (error instanceof ApiError) {\n * console.log(`API Error ${error.status}: ${error.message}`);\n * }\n * }\n * ```\n */\nexport class ApiError extends Error {\n constructor(\n message: string,\n public status: number,\n ) {\n // HACK: improving this error message for the LLMs\n let finalMessage = message;\n if (\n message.includes(\n \"You do not have the multi project stream feature enabled\",\n ) ||\n message.includes(\"You cannot view events from multiple projects\")\n ) {\n finalMessage =\n \"You do not have access to query across multiple projects. Please select a project for your query.\";\n }\n super(finalMessage);\n }\n}\n\ntype RequestOptions = {\n host?: string;\n};\n\n/**\n * Sentry API client service for interacting with Sentry's REST API.\n *\n * This service provides a comprehensive interface to Sentry's API endpoints,\n * handling authentication, error processing, multi-region support, and\n * response validation through Zod schemas.\n *\n * Key Features:\n * - Multi-region support for Sentry SaaS and self-hosted instances\n * - Automatic schema validation with Zod\n * - Enhanced error handling with LLM-friendly messages\n * - URL generation for Sentry resources (issues, traces)\n * - Bearer token authentication\n *\n * @example Basic Usage\n * ```typescript\n * const apiService = new SentryApiService({\n * accessToken: \"your-token\",\n * host: \"sentry.io\"\n * });\n *\n * const orgs = await apiService.listOrganizations();\n * const issues = await apiService.listIssues({\n * organizationSlug: \"my-org\",\n * query: \"is:unresolved\"\n * });\n * ```\n *\n * @example Multi-Region Support\n * ```typescript\n * // Self-hosted instance\n * const selfHosted = new SentryApiService({\n * accessToken: \"token\",\n * host: \"sentry.company.com\"\n * });\n *\n * // Regional endpoint override\n * const issues = await apiService.listIssues(\n * { organizationSlug: \"org\" },\n * { host: \"eu.sentry.io\" }\n * );\n * ```\n */\nexport class SentryApiService {\n private accessToken: string | null;\n protected host: string;\n protected apiPrefix: string;\n\n /**\n * Creates a new Sentry API service instance.\n *\n * @param config Configuration object\n * @param config.accessToken OAuth access token for authentication (optional for some endpoints)\n * @param config.host Sentry host (defaults to sentry.io)\n */\n constructor({\n accessToken = null,\n host = process.env.SENTRY_HOST,\n }: {\n accessToken?: string | null;\n host?: string;\n }) {\n this.accessToken = accessToken;\n this.host = host || \"sentry.io\";\n this.apiPrefix = new URL(\"/api/0\", `https://${this.host}`).href;\n }\n\n /**\n * Updates the host for API requests.\n *\n * Used for multi-region support or switching between Sentry instances.\n *\n * @param host New host to use for API requests\n */\n setHost(host: string) {\n this.host = host;\n this.apiPrefix = new URL(\"/api/0\", `https://${this.host}`).href;\n }\n\n /**\n * Internal method for making authenticated requests to Sentry API.\n *\n * Handles:\n * - Bearer token authentication\n * - Error response parsing and enhancement\n * - Multi-region host overrides\n * - Fetch availability validation\n *\n * @param path API endpoint path (without /api/0 prefix)\n * @param options Fetch options\n * @param requestOptions Additional request configuration\n * @returns Promise resolving to Response object\n * @throws {ApiError} Enhanced API errors with user-friendly messages\n * @throws {Error} Network or parsing errors\n */\n private async request(\n path: string,\n options: RequestInit = {},\n { host }: { host?: string } = {},\n ): Promise<Response> {\n const url = host\n ? new URL(`/api/0${path}`, `https://${host}`).href\n : `${this.apiPrefix}${path}`;\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n \"User-Agent\": \"Sentry MCP Server\",\n };\n if (this.accessToken) {\n headers.Authorization = `Bearer ${this.accessToken}`;\n }\n\n // Check if fetch is available, otherwise provide a helpful error message\n if (typeof globalThis.fetch === \"undefined\") {\n throw new Error(\n \"fetch is not available. Please use Node.js >= 18 or ensure fetch is available in your environment.\",\n );\n }\n\n // logger.info(logger.fmt`[sentryApi] ${options.method || \"GET\"} ${url}`);\n let response: Response;\n try {\n response = await fetch(url, {\n ...options,\n headers,\n });\n } catch (error) {\n // Extract the root cause from the error chain\n let rootCause = error;\n while (rootCause instanceof Error && rootCause.cause) {\n rootCause = rootCause.cause;\n }\n\n const errorMessage =\n rootCause instanceof Error ? rootCause.message : String(rootCause);\n\n let friendlyMessage = `Unable to connect to ${url}`;\n\n // Check if we have a specific message for this error\n const errorCode = Object.keys(NETWORK_ERROR_MESSAGES).find((code) =>\n errorMessage.includes(code),\n );\n\n if (errorCode) {\n friendlyMessage += ` - ${NETWORK_ERROR_MESSAGES[errorCode]}`;\n } else {\n friendlyMessage += ` - ${errorMessage}`;\n }\n\n throw new Error(friendlyMessage, { cause: error });\n }\n\n if (!response.ok) {\n const errorText = await response.text();\n let parsed: unknown | undefined;\n try {\n parsed = JSON.parse(errorText);\n } catch (error) {\n console.error(\n `[sentryApi] Failed to parse error response: ${errorText}`,\n error,\n );\n }\n\n if (parsed) {\n const { data, success, error } = ApiErrorSchema.safeParse(parsed);\n\n if (success) {\n throw new ApiError(data.detail, response.status);\n }\n\n console.error(\n `[sentryApi] Failed to parse error response: ${errorText}`,\n error,\n );\n }\n\n throw new Error(\n `API request failed: ${response.status} ${response.statusText}\\n${errorText}`,\n );\n }\n\n return response;\n }\n\n /**\n * Generates a Sentry issue URL for browser navigation.\n *\n * Handles both SaaS (subdomain-based) and self-hosted URL formats.\n *\n * @param organizationSlug Organization identifier\n * @param issueId Issue identifier (short ID or numeric ID)\n * @returns Full HTTPS URL to the issue in Sentry UI\n *\n * @example\n * ```typescript\n * // SaaS: https://my-org.sentry.io/issues/PROJ-123\n * apiService.getIssueUrl(\"my-org\", \"PROJ-123\")\n *\n * // Self-hosted: https://sentry.company.com/organizations/my-org/issues/PROJ-123\n * apiService.getIssueUrl(\"my-org\", \"PROJ-123\")\n * ```\n */\n getIssueUrl(organizationSlug: string, issueId: string): string {\n return this.host !== \"sentry.io\"\n ? `https://${this.host}/organizations/${organizationSlug}/issues/${issueId}`\n : `https://${organizationSlug}.${this.host}/issues/${issueId}`;\n }\n\n /**\n * Generates a Sentry trace URL for performance investigation.\n *\n * @param organizationSlug Organization identifier\n * @param traceId Trace identifier (hex string)\n * @returns Full HTTPS URL to the trace in Sentry UI\n *\n * @example\n * ```typescript\n * const traceUrl = apiService.getTraceUrl(\"my-org\", \"6a477f5b0f31ef7b6b9b5e1dea66c91d\");\n * // https://my-org.sentry.io/explore/traces/trace/6a477f5b0f31ef7b6b9b5e1dea66c91d\n * ```\n */\n getTraceUrl(organizationSlug: string, traceId: string): string {\n return this.host !== \"sentry.io\"\n ? `https://${this.host}/organizations/${organizationSlug}/explore/traces/trace/${traceId}`\n : `https://${organizationSlug}.${this.host}/explore/traces/trace/${traceId}`;\n }\n\n /**\n * Retrieves the authenticated user's profile information.\n *\n * @param opts Request options including host override\n * @returns User profile data\n * @throws {ApiError} If authentication fails or user not found\n */\n async getAuthenticatedUser(opts?: RequestOptions): Promise<User> {\n const response = await this.request(\"/auth/\", undefined, opts);\n const body = await response.json();\n return UserSchema.parse(body);\n }\n\n /**\n * Lists all organizations accessible to the authenticated user.\n *\n * Automatically handles multi-region queries by fetching from all\n * available regions and combining results.\n *\n * @param opts Request options\n * @returns Array of organizations across all accessible regions\n *\n * @example\n * ```typescript\n * const orgs = await apiService.listOrganizations();\n * orgs.forEach(org => {\n * // regionUrl present for Cloud Service, empty for self-hosted\n * console.log(`${org.name} (${org.slug}) - ${org.links?.regionUrl || 'No region URL'}`);\n * });\n * ```\n */\n async listOrganizations(opts?: RequestOptions): Promise<OrganizationList> {\n // TODO: Sentry is currently not returning all orgs without hitting region endpoints\n const regionResponse = await this.request(\n \"/users/me/regions/\",\n undefined,\n opts,\n );\n const regionData = UserRegionsSchema.parse(await regionResponse.json());\n\n return (\n await Promise.all(\n regionData.regions.map(async (region) =>\n this.request(`/organizations/`, undefined, {\n ...opts,\n host: new URL(region.url).host,\n }).then((response) => response.json()),\n ),\n )\n )\n .map((data) => OrganizationListSchema.parse(data))\n .reduce((acc, curr) => acc.concat(curr), []);\n }\n\n /**\n * Lists teams within an organization.\n *\n * @param organizationSlug Organization identifier\n * @param opts Request options including host override\n * @returns Array of teams in the organization\n */\n async listTeams(\n organizationSlug: string,\n opts?: RequestOptions,\n ): Promise<TeamList> {\n const response = await this.request(\n `/organizations/${organizationSlug}/teams/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return TeamListSchema.parse(body);\n }\n\n /**\n * Creates a new team within an organization.\n *\n * @param params Team creation parameters\n * @param params.organizationSlug Organization identifier\n * @param params.name Team name\n * @param opts Request options\n * @returns Created team data\n * @throws {ApiError} If team creation fails (e.g., name conflicts)\n */\n async createTeam(\n {\n organizationSlug,\n name,\n }: {\n organizationSlug: string;\n name: string;\n },\n opts?: RequestOptions,\n ): Promise<Team> {\n const response = await this.request(\n `/organizations/${organizationSlug}/teams/`,\n {\n method: \"POST\",\n body: JSON.stringify({ name }),\n },\n opts,\n );\n\n return TeamSchema.parse(await response.json());\n }\n\n /**\n * Lists projects within an organization.\n *\n * @param organizationSlug Organization identifier\n * @param opts Request options\n * @returns Array of projects in the organization\n */\n async listProjects(\n organizationSlug: string,\n opts?: RequestOptions,\n ): Promise<ProjectList> {\n const response = await this.request(\n `/organizations/${organizationSlug}/projects/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return ProjectListSchema.parse(body);\n }\n\n /**\n * Creates a new project within a team.\n *\n * @param params Project creation parameters\n * @param params.organizationSlug Organization identifier\n * @param params.teamSlug Team identifier\n * @param params.name Project name\n * @param params.platform Platform identifier (e.g., \"javascript\", \"python\")\n * @param opts Request options\n * @returns Created project data\n */\n async createProject(\n {\n organizationSlug,\n teamSlug,\n name,\n platform,\n }: {\n organizationSlug: string;\n teamSlug: string;\n name: string;\n platform?: string;\n },\n opts?: RequestOptions,\n ): Promise<Project> {\n const response = await this.request(\n `/teams/${organizationSlug}/${teamSlug}/projects/`,\n {\n method: \"POST\",\n body: JSON.stringify({\n name,\n platform,\n }),\n },\n opts,\n );\n return ProjectSchema.parse(await response.json());\n }\n\n /**\n * Updates an existing project's configuration.\n *\n * @param params Project update parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Current project identifier\n * @param params.name New project name (optional)\n * @param params.slug New project slug (optional)\n * @param params.platform New platform identifier (optional)\n * @param opts Request options\n * @returns Updated project data\n */\n async updateProject(\n {\n organizationSlug,\n projectSlug,\n name,\n slug,\n platform,\n }: {\n organizationSlug: string;\n projectSlug: string;\n name?: string;\n slug?: string;\n platform?: string;\n },\n opts?: RequestOptions,\n ): Promise<Project> {\n const updateData: Record<string, any> = {};\n if (name !== undefined) updateData.name = name;\n if (slug !== undefined) updateData.slug = slug;\n if (platform !== undefined) updateData.platform = platform;\n\n const response = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/`,\n {\n method: \"PUT\",\n body: JSON.stringify(updateData),\n },\n opts,\n );\n return ProjectSchema.parse(await response.json());\n }\n\n /**\n * Assigns a team to a project.\n *\n * @param params Assignment parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier\n * @param params.teamSlug Team identifier to assign\n * @param opts Request options\n */\n async addTeamToProject(\n {\n organizationSlug,\n projectSlug,\n teamSlug,\n }: {\n organizationSlug: string;\n projectSlug: string;\n teamSlug: string;\n },\n opts?: RequestOptions,\n ): Promise<void> {\n await this.request(\n `/projects/${organizationSlug}/${projectSlug}/teams/${teamSlug}/`,\n {\n method: \"POST\",\n body: JSON.stringify({}),\n },\n opts,\n );\n }\n\n /**\n * Creates a new client key (DSN) for a project.\n *\n * Client keys are used to identify and authenticate SDK requests to Sentry.\n *\n * @param params Key creation parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier\n * @param params.name Human-readable name for the key (optional)\n * @param opts Request options\n * @returns Created client key with DSN information\n *\n * @example\n * ```typescript\n * const key = await apiService.createClientKey({\n * organizationSlug: \"my-org\",\n * projectSlug: \"my-project\",\n * name: \"Production\"\n * });\n * console.log(`DSN: ${key.dsn.public}`);\n * ```\n */\n async createClientKey(\n {\n organizationSlug,\n projectSlug,\n name,\n }: {\n organizationSlug: string;\n projectSlug: string;\n name?: string;\n },\n opts?: RequestOptions,\n ): Promise<ClientKey> {\n const response = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/keys/`,\n {\n method: \"POST\",\n body: JSON.stringify({\n name,\n }),\n },\n opts,\n );\n return ClientKeySchema.parse(await response.json());\n }\n\n /**\n * Lists all client keys (DSNs) for a project.\n *\n * @param params Query parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier\n * @param opts Request options\n * @returns Array of client keys with DSN information\n */\n async listClientKeys(\n {\n organizationSlug,\n projectSlug,\n }: {\n organizationSlug: string;\n projectSlug: string;\n },\n opts?: RequestOptions,\n ): Promise<ClientKeyList> {\n const response = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/keys/`,\n undefined,\n opts,\n );\n return ClientKeyListSchema.parse(await response.json());\n }\n\n /**\n * Lists releases for an organization or specific project.\n *\n * @param params Query parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier (optional, scopes to specific project)\n * @param params.query Search query for filtering releases\n * @param opts Request options\n * @returns Array of releases with deployment and commit information\n *\n * @example\n * ```typescript\n * // All releases for organization\n * const releases = await apiService.listReleases({\n * organizationSlug: \"my-org\"\n * });\n *\n * // Search for specific version\n * const filtered = await apiService.listReleases({\n * organizationSlug: \"my-org\",\n * query: \"v1.2.3\"\n * });\n * ```\n */\n async listReleases(\n {\n organizationSlug,\n projectSlug,\n query,\n }: {\n organizationSlug: string;\n projectSlug?: string;\n query?: string;\n },\n opts?: RequestOptions,\n ): Promise<ReleaseList> {\n const searchQuery = new URLSearchParams();\n if (query) {\n searchQuery.set(\"query\", query);\n }\n\n const path = projectSlug\n ? `/projects/${organizationSlug}/${projectSlug}/releases/`\n : `/organizations/${organizationSlug}/releases/`;\n\n const response = await this.request(\n `${path}${searchQuery.toString()}`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return ReleaseListSchema.parse(body);\n }\n\n /**\n * Lists available tags for search queries.\n *\n * Tags represent indexed fields that can be used in Sentry search queries.\n *\n * @param params Query parameters\n * @param params.organizationSlug Organization identifier\n * @param params.dataset Dataset to query tags for (\"errors\" or \"search_issues\")\n * @param opts Request options\n * @returns Array of available tags with metadata\n *\n * @example\n * ```typescript\n * const tags = await apiService.listTags({\n * organizationSlug: \"my-org\",\n * dataset: \"errors\"\n * });\n * tags.forEach(tag => console.log(`${tag.key}: ${tag.name}`));\n * ```\n */\n async listTags(\n {\n organizationSlug,\n dataset,\n }: {\n organizationSlug: string;\n dataset?: \"errors\" | \"search_issues\";\n },\n opts?: RequestOptions,\n ): Promise<TagList> {\n // TODO: this supports project in the query, but needs fixed\n // to accept slugs\n const searchQuery = new URLSearchParams();\n if (dataset) {\n searchQuery.set(\"dataset\", dataset);\n }\n\n const response = await this.request(\n `/organizations/${organizationSlug}/tags/${searchQuery.toString()}`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return TagListSchema.parse(body);\n }\n\n /**\n * Lists issues within an organization or project.\n *\n * Issues represent groups of similar errors or problems in your application.\n * Supports Sentry's powerful query syntax for filtering and sorting.\n *\n * @param params Query parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier (optional, scopes to specific project)\n * @param params.query Sentry search query (e.g., \"is:unresolved browser:chrome\")\n * @param params.sortBy Sort order (\"user\", \"freq\", \"date\", \"new\")\n * @param opts Request options\n * @returns Array of issues with metadata and statistics\n *\n * @example\n * ```typescript\n * // Recent unresolved issues\n * const issues = await apiService.listIssues({\n * organizationSlug: \"my-org\",\n * query: \"is:unresolved\",\n * sortBy: \"date\"\n * });\n *\n * // High-frequency errors in specific project\n * const critical = await apiService.listIssues({\n * organizationSlug: \"my-org\",\n * projectSlug: \"backend\",\n * query: \"level:error\",\n * sortBy: \"freq\"\n * });\n * ```\n */\n async listIssues(\n {\n organizationSlug,\n projectSlug,\n query,\n sortBy,\n }: {\n organizationSlug: string;\n projectSlug?: string;\n query?: string;\n sortBy?: \"user\" | \"freq\" | \"date\" | \"new\";\n },\n opts?: RequestOptions,\n ): Promise<IssueList> {\n const sentryQuery: string[] = [];\n if (query) {\n sentryQuery.push(query);\n }\n\n const queryParams = new URLSearchParams();\n queryParams.set(\"per_page\", \"10\");\n queryParams.set(\"referrer\", \"sentry-mcp\");\n if (sortBy) queryParams.set(\"sort\", sortBy);\n queryParams.set(\"statsPeriod\", \"24h\");\n queryParams.set(\"query\", sentryQuery.join(\" \"));\n\n queryParams.append(\"collapse\", \"unhandled\");\n\n const apiUrl = projectSlug\n ? `/projects/${organizationSlug}/${projectSlug}/issues/?${queryParams.toString()}`\n : `/organizations/${organizationSlug}/issues/?${queryParams.toString()}`;\n\n const response = await this.request(apiUrl, undefined, opts);\n\n const body = await response.json();\n return IssueListSchema.parse(body);\n }\n\n async getIssue(\n {\n organizationSlug,\n issueId,\n }: {\n organizationSlug: string;\n issueId: string;\n },\n opts?: RequestOptions,\n ): Promise<Issue> {\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return IssueSchema.parse(body);\n }\n\n async getEventForIssue(\n {\n organizationSlug,\n issueId,\n eventId,\n }: {\n organizationSlug: string;\n issueId: string;\n eventId: string;\n },\n opts?: RequestOptions,\n ): Promise<Event> {\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/events/${eventId}/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return EventSchema.parse(body);\n }\n\n async getLatestEventForIssue(\n {\n organizationSlug,\n issueId,\n }: {\n organizationSlug: string;\n issueId: string;\n },\n opts?: RequestOptions,\n ): Promise<Event> {\n return this.getEventForIssue(\n {\n organizationSlug,\n issueId,\n eventId: \"latest\",\n },\n opts,\n );\n }\n\n async listEventAttachments(\n {\n organizationSlug,\n projectSlug,\n eventId,\n }: {\n organizationSlug: string;\n projectSlug: string;\n eventId: string;\n },\n opts?: RequestOptions,\n ) {\n const response = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return EventAttachmentListSchema.parse(body);\n }\n\n async getEventAttachment(\n {\n organizationSlug,\n projectSlug,\n eventId,\n attachmentId,\n }: {\n organizationSlug: string;\n projectSlug: string;\n eventId: string;\n attachmentId: string;\n },\n opts?: RequestOptions,\n ): Promise<{\n attachment: any;\n downloadUrl: string;\n filename: string;\n blob: Blob;\n }> {\n // Get the attachment metadata first\n const attachmentsResponse = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/`,\n undefined,\n opts,\n );\n\n const attachments = EventAttachmentListSchema.parse(\n await attachmentsResponse.json(),\n );\n const attachment = attachments.find((att) => att.id === attachmentId);\n\n if (!attachment) {\n throw new Error(\n `Attachment with ID ${attachmentId} not found for event ${eventId}`,\n );\n }\n\n // Download the actual file content\n const downloadUrl = `/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/${attachmentId}/?download=1`;\n const downloadResponse = await this.request(\n downloadUrl,\n {\n method: \"GET\",\n headers: {\n Accept: \"application/octet-stream\",\n },\n },\n opts,\n );\n\n return {\n attachment,\n downloadUrl: downloadResponse.url,\n filename: attachment.name,\n blob: await downloadResponse.blob(),\n };\n }\n\n async updateIssue(\n {\n organizationSlug,\n issueId,\n status,\n assignedTo,\n }: {\n organizationSlug: string;\n issueId: string;\n status?: string;\n assignedTo?: string;\n },\n opts?: RequestOptions,\n ): Promise<Issue> {\n const updateData: Record<string, any> = {};\n if (status !== undefined) updateData.status = status;\n if (assignedTo !== undefined) updateData.assignedTo = assignedTo;\n\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/`,\n {\n method: \"PUT\",\n body: JSON.stringify(updateData),\n },\n opts,\n );\n\n const body = await response.json();\n return IssueSchema.parse(body);\n }\n\n // TODO: Sentry is not yet exposing a reasonable API to fetch trace data\n // async getTrace({\n // organizationSlug,\n // traceId,\n // }: {\n // organizationSlug: string;\n // traceId: string;\n // }): Promise<z.infer<typeof SentryIssueSchema>> {\n // const response = await this.request(\n // `/organizations/${organizationSlug}/issues/${traceId}/`,\n // );\n\n // const body = await response.json();\n // return SentryIssueSchema.parse(body);\n // }\n\n async searchErrors(\n {\n organizationSlug,\n projectSlug,\n filename,\n transaction,\n query,\n sortBy = \"last_seen\",\n }: {\n organizationSlug: string;\n projectSlug?: string;\n filename?: string;\n transaction?: string;\n query?: string;\n sortBy?: \"last_seen\" | \"count\";\n },\n opts?: RequestOptions,\n ) {\n const sentryQuery: string[] = [];\n if (filename) {\n sentryQuery.push(`stack.filename:\"*${filename.replace(/\"/g, '\\\\\"')}\"`);\n }\n if (transaction) {\n sentryQuery.push(`transaction:\"${transaction.replace(/\"/g, '\\\\\"')}\"`);\n }\n if (query) {\n sentryQuery.push(query);\n }\n if (projectSlug) {\n sentryQuery.push(`project:${projectSlug}`);\n }\n\n const queryParams = new URLSearchParams();\n queryParams.set(\"dataset\", \"errors\");\n queryParams.set(\"per_page\", \"10\");\n queryParams.set(\"referrer\", \"sentry-mcp\");\n queryParams.set(\n \"sort\",\n `-${sortBy === \"last_seen\" ? \"last_seen\" : \"count\"}`,\n );\n queryParams.set(\"statsPeriod\", \"24h\");\n queryParams.append(\"field\", \"issue\");\n queryParams.append(\"field\", \"title\");\n queryParams.append(\"field\", \"project\");\n queryParams.append(\"field\", \"last_seen()\");\n queryParams.append(\"field\", \"count()\");\n queryParams.set(\"query\", sentryQuery.join(\" \"));\n // if (projectSlug) queryParams.set(\"project\", projectSlug);\n\n const apiUrl = `/organizations/${organizationSlug}/events/?${queryParams.toString()}`;\n\n const response = await this.request(apiUrl, undefined, opts);\n\n const body = await response.json();\n // TODO(dcramer): If you're using an older version of Sentry this API had a breaking change\n // meaning this endpoint will error.\n return ErrorsSearchResponseSchema.parse(body).data;\n }\n\n async searchSpans(\n {\n organizationSlug,\n projectSlug,\n transaction,\n query,\n sortBy = \"timestamp\",\n }: {\n organizationSlug: string;\n projectSlug?: string;\n transaction?: string;\n query?: string;\n sortBy?: \"timestamp\" | \"duration\";\n },\n opts?: RequestOptions,\n ) {\n const sentryQuery: string[] = [\"is_transaction:true\"];\n if (transaction) {\n sentryQuery.push(`transaction:\"${transaction.replace(/\"/g, '\\\\\"')}\"`);\n }\n if (query) {\n sentryQuery.push(query);\n }\n if (projectSlug) {\n sentryQuery.push(`project:${projectSlug}`);\n }\n\n const queryParams = new URLSearchParams();\n queryParams.set(\"dataset\", \"spans\");\n queryParams.set(\"per_page\", \"10\");\n queryParams.set(\"referrer\", \"sentry-mcp\");\n queryParams.set(\n \"sort\",\n `-${sortBy === \"timestamp\" ? \"timestamp\" : \"span.duration\"}`,\n );\n queryParams.set(\"allowAggregateConditions\", \"0\");\n queryParams.set(\"useRpc\", \"1\");\n queryParams.append(\"field\", \"id\");\n queryParams.append(\"field\", \"trace\");\n queryParams.append(\"field\", \"span.op\");\n queryParams.append(\"field\", \"span.description\");\n queryParams.append(\"field\", \"span.duration\");\n queryParams.append(\"field\", \"transaction\");\n queryParams.append(\"field\", \"project\");\n queryParams.append(\"field\", \"timestamp\");\n queryParams.set(\"query\", sentryQuery.join(\" \"));\n // if (projectSlug) queryParams.set(\"project\", projectSlug);\n\n const apiUrl = `/organizations/${organizationSlug}/events/?${queryParams.toString()}`;\n\n const response = await this.request(apiUrl, undefined, opts);\n\n const body = await response.json();\n return SpansSearchResponseSchema.parse(body).data;\n }\n\n // POST https://us.sentry.io/api/0/issues/5485083130/autofix/\n async startAutofix(\n {\n organizationSlug,\n issueId,\n eventId,\n instruction = \"\",\n }: {\n organizationSlug: string;\n issueId: string;\n eventId?: string;\n instruction?: string;\n },\n opts?: RequestOptions,\n ): Promise<AutofixRun> {\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/autofix/`,\n {\n method: \"POST\",\n body: JSON.stringify({\n event_id: eventId,\n instruction,\n }),\n },\n opts,\n );\n const body = await response.json();\n return AutofixRunSchema.parse(body);\n }\n\n // GET https://us.sentry.io/api/0/issues/5485083130/autofix/\n async getAutofixState(\n {\n organizationSlug,\n issueId,\n }: {\n organizationSlug: string;\n issueId: string;\n },\n opts?: RequestOptions,\n ): Promise<AutofixRunState> {\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/autofix/`,\n undefined,\n opts,\n );\n const body = await response.json();\n return AutofixRunStateSchema.parse(body);\n }\n}\n"],"mappings":";;;;;;;AAkDA,MAAMA,yBAAiD;CACrD,WAAW;CACX,WAAW;CACX,cAAc;CACd,WAAW;CACX,YAAY;AACb;;;;;;;;;;;;;;;;;;AAmBD,IAAa,WAAb,cAA8B,MAAM;CAClC,YACEC,SACOC,QACP;EAEA,IAAI,eAAe;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iBAAiB,iBAAiB,UAAU,QAAQ,oBAErD,KACD;EACD,MAAM,OAAO,MAAM,SAAS,MAAM;AAClC,SAAO,qCAAsB,MAAM,KAAK;CACzC;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-BbamPqV4.js","names":["NETWORK_ERROR_MESSAGES: Record<string, string>","message: string","status: number","host: string","path: string","options: RequestInit","headers: Record<string, string>","response: Response","parsed: unknown | undefined","organizationSlug: string","issueId: string","traceId: string","opts?: RequestOptions","updateData: Record<string, any>","sentryQuery: string[]"],"sources":["../src/api-client/client.ts"],"sourcesContent":["import {\n OrganizationListSchema,\n ClientKeySchema,\n TeamListSchema,\n TeamSchema,\n ProjectListSchema,\n ProjectSchema,\n ReleaseListSchema,\n IssueListSchema,\n IssueSchema,\n EventSchema,\n EventAttachmentListSchema,\n EventAttachmentSchema,\n ErrorsSearchResponseSchema,\n SpansSearchResponseSchema,\n TagListSchema,\n ApiErrorSchema,\n ClientKeyListSchema,\n AutofixRunSchema,\n AutofixRunStateSchema,\n UserSchema,\n UserRegionsSchema,\n} from \"./schema\";\nimport type {\n AutofixRun,\n AutofixRunState,\n ClientKey,\n ClientKeyList,\n Event,\n EventAttachment,\n EventAttachmentList,\n Issue,\n IssueList,\n OrganizationList,\n Project,\n ProjectList,\n ReleaseList,\n TagList,\n Team,\n TeamList,\n User,\n} from \"./types\";\n// TODO: this is shared - so ideally, for safety, it uses @sentry/core, but currently\n// logger isnt exposed (or rather, it is, but its not the right logger)\n// import { logger } from \"@sentry/node\";\n\n/**\n * Mapping of common network error codes to user-friendly messages.\n * These help users understand and resolve connection issues.\n */\nconst NETWORK_ERROR_MESSAGES: Record<string, string> = {\n EAI_AGAIN: \"DNS temporarily unavailable. Check your internet connection.\",\n ENOTFOUND: \"Hostname not found. Verify the URL is correct.\",\n ECONNREFUSED: \"Connection refused. Ensure the service is accessible.\",\n ETIMEDOUT: \"Connection timed out. Check network connectivity.\",\n ECONNRESET: \"Connection reset. Try again in a moment.\",\n};\n\n/**\n * Custom error class for Sentry API responses.\n *\n * Provides enhanced error messages for LLM consumption and handles\n * common API error scenarios with user-friendly messaging.\n *\n * @example\n * ```typescript\n * try {\n * await apiService.listIssues({ organizationSlug: \"invalid\" });\n * } catch (error) {\n * if (error instanceof ApiError) {\n * console.log(`API Error ${error.status}: ${error.message}`);\n * }\n * }\n * ```\n */\nexport class ApiError extends Error {\n constructor(\n message: string,\n public status: number,\n ) {\n // HACK: improving this error message for the LLMs\n let finalMessage = message;\n if (\n message.includes(\n \"You do not have the multi project stream feature enabled\",\n ) ||\n message.includes(\"You cannot view events from multiple projects\")\n ) {\n finalMessage =\n \"You do not have access to query across multiple projects. Please select a project for your query.\";\n }\n super(finalMessage);\n }\n}\n\ntype RequestOptions = {\n host?: string;\n};\n\n/**\n * Sentry API client service for interacting with Sentry's REST API.\n *\n * This service provides a comprehensive interface to Sentry's API endpoints,\n * handling authentication, error processing, multi-region support, and\n * response validation through Zod schemas.\n *\n * Key Features:\n * - Multi-region support for Sentry SaaS and self-hosted instances\n * - Automatic schema validation with Zod\n * - Enhanced error handling with LLM-friendly messages\n * - URL generation for Sentry resources (issues, traces)\n * - Bearer token authentication\n *\n * @example Basic Usage\n * ```typescript\n * const apiService = new SentryApiService({\n * accessToken: \"your-token\",\n * host: \"sentry.io\"\n * });\n *\n * const orgs = await apiService.listOrganizations();\n * const issues = await apiService.listIssues({\n * organizationSlug: \"my-org\",\n * query: \"is:unresolved\"\n * });\n * ```\n *\n * @example Multi-Region Support\n * ```typescript\n * // Self-hosted instance\n * const selfHosted = new SentryApiService({\n * accessToken: \"token\",\n * host: \"sentry.company.com\"\n * });\n *\n * // Regional endpoint override\n * const issues = await apiService.listIssues(\n * { organizationSlug: \"org\" },\n * { host: \"eu.sentry.io\" }\n * );\n * ```\n */\nexport class SentryApiService {\n private accessToken: string | null;\n protected host: string;\n protected apiPrefix: string;\n\n /**\n * Creates a new Sentry API service instance.\n *\n * @param config Configuration object\n * @param config.accessToken OAuth access token for authentication (optional for some endpoints)\n * @param config.host Sentry host (defaults to sentry.io)\n */\n constructor({\n accessToken = null,\n host = process.env.SENTRY_HOST,\n }: {\n accessToken?: string | null;\n host?: string;\n }) {\n this.accessToken = accessToken;\n this.host = host || \"sentry.io\";\n this.apiPrefix = new URL(\"/api/0\", `https://${this.host}`).href;\n }\n\n /**\n * Updates the host for API requests.\n *\n * Used for multi-region support or switching between Sentry instances.\n *\n * @param host New host to use for API requests\n */\n setHost(host: string) {\n this.host = host;\n this.apiPrefix = new URL(\"/api/0\", `https://${this.host}`).href;\n }\n\n /**\n * Internal method for making authenticated requests to Sentry API.\n *\n * Handles:\n * - Bearer token authentication\n * - Error response parsing and enhancement\n * - Multi-region host overrides\n * - Fetch availability validation\n *\n * @param path API endpoint path (without /api/0 prefix)\n * @param options Fetch options\n * @param requestOptions Additional request configuration\n * @returns Promise resolving to Response object\n * @throws {ApiError} Enhanced API errors with user-friendly messages\n * @throws {Error} Network or parsing errors\n */\n private async request(\n path: string,\n options: RequestInit = {},\n { host }: { host?: string } = {},\n ): Promise<Response> {\n const url = host\n ? new URL(`/api/0${path}`, `https://${host}`).href\n : `${this.apiPrefix}${path}`;\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n \"User-Agent\": \"Sentry MCP Server\",\n };\n if (this.accessToken) {\n headers.Authorization = `Bearer ${this.accessToken}`;\n }\n\n // Check if fetch is available, otherwise provide a helpful error message\n if (typeof globalThis.fetch === \"undefined\") {\n throw new Error(\n \"fetch is not available. Please use Node.js >= 18 or ensure fetch is available in your environment.\",\n );\n }\n\n // logger.info(logger.fmt`[sentryApi] ${options.method || \"GET\"} ${url}`);\n let response: Response;\n try {\n response = await fetch(url, {\n ...options,\n headers,\n });\n } catch (error) {\n // Extract the root cause from the error chain\n let rootCause = error;\n while (rootCause instanceof Error && rootCause.cause) {\n rootCause = rootCause.cause;\n }\n\n const errorMessage =\n rootCause instanceof Error ? rootCause.message : String(rootCause);\n\n let friendlyMessage = `Unable to connect to ${url}`;\n\n // Check if we have a specific message for this error\n const errorCode = Object.keys(NETWORK_ERROR_MESSAGES).find((code) =>\n errorMessage.includes(code),\n );\n\n if (errorCode) {\n friendlyMessage += ` - ${NETWORK_ERROR_MESSAGES[errorCode]}`;\n } else {\n friendlyMessage += ` - ${errorMessage}`;\n }\n\n throw new Error(friendlyMessage, { cause: error });\n }\n\n if (!response.ok) {\n const errorText = await response.text();\n let parsed: unknown | undefined;\n try {\n parsed = JSON.parse(errorText);\n } catch (error) {\n console.error(\n `[sentryApi] Failed to parse error response: ${errorText}`,\n error,\n );\n }\n\n if (parsed) {\n const { data, success, error } = ApiErrorSchema.safeParse(parsed);\n\n if (success) {\n throw new ApiError(data.detail, response.status);\n }\n\n console.error(\n `[sentryApi] Failed to parse error response: ${errorText}`,\n error,\n );\n }\n\n throw new Error(\n `API request failed: ${response.status} ${response.statusText}\\n${errorText}`,\n );\n }\n\n return response;\n }\n\n /**\n * Generates a Sentry issue URL for browser navigation.\n *\n * Handles both SaaS (subdomain-based) and self-hosted URL formats.\n *\n * @param organizationSlug Organization identifier\n * @param issueId Issue identifier (short ID or numeric ID)\n * @returns Full HTTPS URL to the issue in Sentry UI\n *\n * @example\n * ```typescript\n * // SaaS: https://my-org.sentry.io/issues/PROJ-123\n * apiService.getIssueUrl(\"my-org\", \"PROJ-123\")\n *\n * // Self-hosted: https://sentry.company.com/organizations/my-org/issues/PROJ-123\n * apiService.getIssueUrl(\"my-org\", \"PROJ-123\")\n * ```\n */\n getIssueUrl(organizationSlug: string, issueId: string): string {\n return this.host !== \"sentry.io\"\n ? `https://${this.host}/organizations/${organizationSlug}/issues/${issueId}`\n : `https://${organizationSlug}.${this.host}/issues/${issueId}`;\n }\n\n /**\n * Generates a Sentry trace URL for performance investigation.\n *\n * @param organizationSlug Organization identifier\n * @param traceId Trace identifier (hex string)\n * @returns Full HTTPS URL to the trace in Sentry UI\n *\n * @example\n * ```typescript\n * const traceUrl = apiService.getTraceUrl(\"my-org\", \"6a477f5b0f31ef7b6b9b5e1dea66c91d\");\n * // https://my-org.sentry.io/explore/traces/trace/6a477f5b0f31ef7b6b9b5e1dea66c91d\n * ```\n */\n getTraceUrl(organizationSlug: string, traceId: string): string {\n return this.host !== \"sentry.io\"\n ? `https://${this.host}/organizations/${organizationSlug}/explore/traces/trace/${traceId}`\n : `https://${organizationSlug}.${this.host}/explore/traces/trace/${traceId}`;\n }\n\n /**\n * Retrieves the authenticated user's profile information.\n *\n * @param opts Request options including host override\n * @returns User profile data\n * @throws {ApiError} If authentication fails or user not found\n */\n async getAuthenticatedUser(opts?: RequestOptions): Promise<User> {\n const response = await this.request(\"/auth/\", undefined, opts);\n const body = await response.json();\n return UserSchema.parse(body);\n }\n\n /**\n * Lists all organizations accessible to the authenticated user.\n *\n * Automatically handles multi-region queries by fetching from all\n * available regions and combining results.\n *\n * @param opts Request options\n * @returns Array of organizations across all accessible regions\n *\n * @example\n * ```typescript\n * const orgs = await apiService.listOrganizations();\n * orgs.forEach(org => {\n * // regionUrl present for Cloud Service, empty for self-hosted\n * console.log(`${org.name} (${org.slug}) - ${org.links?.regionUrl || 'No region URL'}`);\n * });\n * ```\n */\n async listOrganizations(opts?: RequestOptions): Promise<OrganizationList> {\n // TODO: Sentry is currently not returning all orgs without hitting region endpoints\n const regionResponse = await this.request(\n \"/users/me/regions/\",\n undefined,\n opts,\n );\n const regionData = UserRegionsSchema.parse(await regionResponse.json());\n\n return (\n await Promise.all(\n regionData.regions.map(async (region) =>\n this.request(`/organizations/`, undefined, {\n ...opts,\n host: new URL(region.url).host,\n }).then((response) => response.json()),\n ),\n )\n )\n .map((data) => OrganizationListSchema.parse(data))\n .reduce((acc, curr) => acc.concat(curr), []);\n }\n\n /**\n * Lists teams within an organization.\n *\n * @param organizationSlug Organization identifier\n * @param opts Request options including host override\n * @returns Array of teams in the organization\n */\n async listTeams(\n organizationSlug: string,\n opts?: RequestOptions,\n ): Promise<TeamList> {\n const response = await this.request(\n `/organizations/${organizationSlug}/teams/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return TeamListSchema.parse(body);\n }\n\n /**\n * Creates a new team within an organization.\n *\n * @param params Team creation parameters\n * @param params.organizationSlug Organization identifier\n * @param params.name Team name\n * @param opts Request options\n * @returns Created team data\n * @throws {ApiError} If team creation fails (e.g., name conflicts)\n */\n async createTeam(\n {\n organizationSlug,\n name,\n }: {\n organizationSlug: string;\n name: string;\n },\n opts?: RequestOptions,\n ): Promise<Team> {\n const response = await this.request(\n `/organizations/${organizationSlug}/teams/`,\n {\n method: \"POST\",\n body: JSON.stringify({ name }),\n },\n opts,\n );\n\n return TeamSchema.parse(await response.json());\n }\n\n /**\n * Lists projects within an organization.\n *\n * @param organizationSlug Organization identifier\n * @param opts Request options\n * @returns Array of projects in the organization\n */\n async listProjects(\n organizationSlug: string,\n opts?: RequestOptions,\n ): Promise<ProjectList> {\n const response = await this.request(\n `/organizations/${organizationSlug}/projects/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return ProjectListSchema.parse(body);\n }\n\n /**\n * Creates a new project within a team.\n *\n * @param params Project creation parameters\n * @param params.organizationSlug Organization identifier\n * @param params.teamSlug Team identifier\n * @param params.name Project name\n * @param params.platform Platform identifier (e.g., \"javascript\", \"python\")\n * @param opts Request options\n * @returns Created project data\n */\n async createProject(\n {\n organizationSlug,\n teamSlug,\n name,\n platform,\n }: {\n organizationSlug: string;\n teamSlug: string;\n name: string;\n platform?: string;\n },\n opts?: RequestOptions,\n ): Promise<Project> {\n const response = await this.request(\n `/teams/${organizationSlug}/${teamSlug}/projects/`,\n {\n method: \"POST\",\n body: JSON.stringify({\n name,\n platform,\n }),\n },\n opts,\n );\n return ProjectSchema.parse(await response.json());\n }\n\n /**\n * Updates an existing project's configuration.\n *\n * @param params Project update parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Current project identifier\n * @param params.name New project name (optional)\n * @param params.slug New project slug (optional)\n * @param params.platform New platform identifier (optional)\n * @param opts Request options\n * @returns Updated project data\n */\n async updateProject(\n {\n organizationSlug,\n projectSlug,\n name,\n slug,\n platform,\n }: {\n organizationSlug: string;\n projectSlug: string;\n name?: string;\n slug?: string;\n platform?: string;\n },\n opts?: RequestOptions,\n ): Promise<Project> {\n const updateData: Record<string, any> = {};\n if (name !== undefined) updateData.name = name;\n if (slug !== undefined) updateData.slug = slug;\n if (platform !== undefined) updateData.platform = platform;\n\n const response = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/`,\n {\n method: \"PUT\",\n body: JSON.stringify(updateData),\n },\n opts,\n );\n return ProjectSchema.parse(await response.json());\n }\n\n /**\n * Assigns a team to a project.\n *\n * @param params Assignment parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier\n * @param params.teamSlug Team identifier to assign\n * @param opts Request options\n */\n async addTeamToProject(\n {\n organizationSlug,\n projectSlug,\n teamSlug,\n }: {\n organizationSlug: string;\n projectSlug: string;\n teamSlug: string;\n },\n opts?: RequestOptions,\n ): Promise<void> {\n await this.request(\n `/projects/${organizationSlug}/${projectSlug}/teams/${teamSlug}/`,\n {\n method: \"POST\",\n body: JSON.stringify({}),\n },\n opts,\n );\n }\n\n /**\n * Creates a new client key (DSN) for a project.\n *\n * Client keys are used to identify and authenticate SDK requests to Sentry.\n *\n * @param params Key creation parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier\n * @param params.name Human-readable name for the key (optional)\n * @param opts Request options\n * @returns Created client key with DSN information\n *\n * @example\n * ```typescript\n * const key = await apiService.createClientKey({\n * organizationSlug: \"my-org\",\n * projectSlug: \"my-project\",\n * name: \"Production\"\n * });\n * console.log(`DSN: ${key.dsn.public}`);\n * ```\n */\n async createClientKey(\n {\n organizationSlug,\n projectSlug,\n name,\n }: {\n organizationSlug: string;\n projectSlug: string;\n name?: string;\n },\n opts?: RequestOptions,\n ): Promise<ClientKey> {\n const response = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/keys/`,\n {\n method: \"POST\",\n body: JSON.stringify({\n name,\n }),\n },\n opts,\n );\n return ClientKeySchema.parse(await response.json());\n }\n\n /**\n * Lists all client keys (DSNs) for a project.\n *\n * @param params Query parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier\n * @param opts Request options\n * @returns Array of client keys with DSN information\n */\n async listClientKeys(\n {\n organizationSlug,\n projectSlug,\n }: {\n organizationSlug: string;\n projectSlug: string;\n },\n opts?: RequestOptions,\n ): Promise<ClientKeyList> {\n const response = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/keys/`,\n undefined,\n opts,\n );\n return ClientKeyListSchema.parse(await response.json());\n }\n\n /**\n * Lists releases for an organization or specific project.\n *\n * @param params Query parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier (optional, scopes to specific project)\n * @param params.query Search query for filtering releases\n * @param opts Request options\n * @returns Array of releases with deployment and commit information\n *\n * @example\n * ```typescript\n * // All releases for organization\n * const releases = await apiService.listReleases({\n * organizationSlug: \"my-org\"\n * });\n *\n * // Search for specific version\n * const filtered = await apiService.listReleases({\n * organizationSlug: \"my-org\",\n * query: \"v1.2.3\"\n * });\n * ```\n */\n async listReleases(\n {\n organizationSlug,\n projectSlug,\n query,\n }: {\n organizationSlug: string;\n projectSlug?: string;\n query?: string;\n },\n opts?: RequestOptions,\n ): Promise<ReleaseList> {\n const searchQuery = new URLSearchParams();\n if (query) {\n searchQuery.set(\"query\", query);\n }\n\n const path = projectSlug\n ? `/projects/${organizationSlug}/${projectSlug}/releases/`\n : `/organizations/${organizationSlug}/releases/`;\n\n const response = await this.request(\n `${path}${searchQuery.toString()}`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return ReleaseListSchema.parse(body);\n }\n\n /**\n * Lists available tags for search queries.\n *\n * Tags represent indexed fields that can be used in Sentry search queries.\n *\n * @param params Query parameters\n * @param params.organizationSlug Organization identifier\n * @param params.dataset Dataset to query tags for (\"errors\" or \"search_issues\")\n * @param opts Request options\n * @returns Array of available tags with metadata\n *\n * @example\n * ```typescript\n * const tags = await apiService.listTags({\n * organizationSlug: \"my-org\",\n * dataset: \"errors\"\n * });\n * tags.forEach(tag => console.log(`${tag.key}: ${tag.name}`));\n * ```\n */\n async listTags(\n {\n organizationSlug,\n dataset,\n }: {\n organizationSlug: string;\n dataset?: \"errors\" | \"search_issues\";\n },\n opts?: RequestOptions,\n ): Promise<TagList> {\n // TODO: this supports project in the query, but needs fixed\n // to accept slugs\n const searchQuery = new URLSearchParams();\n if (dataset) {\n searchQuery.set(\"dataset\", dataset);\n }\n\n const response = await this.request(\n `/organizations/${organizationSlug}/tags/${searchQuery.toString()}`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return TagListSchema.parse(body);\n }\n\n /**\n * Lists issues within an organization or project.\n *\n * Issues represent groups of similar errors or problems in your application.\n * Supports Sentry's powerful query syntax for filtering and sorting.\n *\n * @param params Query parameters\n * @param params.organizationSlug Organization identifier\n * @param params.projectSlug Project identifier (optional, scopes to specific project)\n * @param params.query Sentry search query (e.g., \"is:unresolved browser:chrome\")\n * @param params.sortBy Sort order (\"user\", \"freq\", \"date\", \"new\")\n * @param opts Request options\n * @returns Array of issues with metadata and statistics\n *\n * @example\n * ```typescript\n * // Recent unresolved issues\n * const issues = await apiService.listIssues({\n * organizationSlug: \"my-org\",\n * query: \"is:unresolved\",\n * sortBy: \"date\"\n * });\n *\n * // High-frequency errors in specific project\n * const critical = await apiService.listIssues({\n * organizationSlug: \"my-org\",\n * projectSlug: \"backend\",\n * query: \"level:error\",\n * sortBy: \"freq\"\n * });\n * ```\n */\n async listIssues(\n {\n organizationSlug,\n projectSlug,\n query,\n sortBy,\n }: {\n organizationSlug: string;\n projectSlug?: string;\n query?: string;\n sortBy?: \"user\" | \"freq\" | \"date\" | \"new\";\n },\n opts?: RequestOptions,\n ): Promise<IssueList> {\n const sentryQuery: string[] = [];\n if (query) {\n sentryQuery.push(query);\n }\n\n const queryParams = new URLSearchParams();\n queryParams.set(\"per_page\", \"10\");\n queryParams.set(\"referrer\", \"sentry-mcp\");\n if (sortBy) queryParams.set(\"sort\", sortBy);\n queryParams.set(\"statsPeriod\", \"24h\");\n queryParams.set(\"query\", sentryQuery.join(\" \"));\n\n queryParams.append(\"collapse\", \"unhandled\");\n\n const apiUrl = projectSlug\n ? `/projects/${organizationSlug}/${projectSlug}/issues/?${queryParams.toString()}`\n : `/organizations/${organizationSlug}/issues/?${queryParams.toString()}`;\n\n const response = await this.request(apiUrl, undefined, opts);\n\n const body = await response.json();\n return IssueListSchema.parse(body);\n }\n\n async getIssue(\n {\n organizationSlug,\n issueId,\n }: {\n organizationSlug: string;\n issueId: string;\n },\n opts?: RequestOptions,\n ): Promise<Issue> {\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return IssueSchema.parse(body);\n }\n\n async getEventForIssue(\n {\n organizationSlug,\n issueId,\n eventId,\n }: {\n organizationSlug: string;\n issueId: string;\n eventId: string;\n },\n opts?: RequestOptions,\n ): Promise<Event> {\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/events/${eventId}/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return EventSchema.parse(body);\n }\n\n async getLatestEventForIssue(\n {\n organizationSlug,\n issueId,\n }: {\n organizationSlug: string;\n issueId: string;\n },\n opts?: RequestOptions,\n ): Promise<Event> {\n return this.getEventForIssue(\n {\n organizationSlug,\n issueId,\n eventId: \"latest\",\n },\n opts,\n );\n }\n\n async listEventAttachments(\n {\n organizationSlug,\n projectSlug,\n eventId,\n }: {\n organizationSlug: string;\n projectSlug: string;\n eventId: string;\n },\n opts?: RequestOptions,\n ) {\n const response = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/`,\n undefined,\n opts,\n );\n\n const body = await response.json();\n return EventAttachmentListSchema.parse(body);\n }\n\n async getEventAttachment(\n {\n organizationSlug,\n projectSlug,\n eventId,\n attachmentId,\n }: {\n organizationSlug: string;\n projectSlug: string;\n eventId: string;\n attachmentId: string;\n },\n opts?: RequestOptions,\n ): Promise<{\n attachment: any;\n downloadUrl: string;\n filename: string;\n blob: Blob;\n }> {\n // Get the attachment metadata first\n const attachmentsResponse = await this.request(\n `/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/`,\n undefined,\n opts,\n );\n\n const attachments = EventAttachmentListSchema.parse(\n await attachmentsResponse.json(),\n );\n const attachment = attachments.find((att) => att.id === attachmentId);\n\n if (!attachment) {\n throw new Error(\n `Attachment with ID ${attachmentId} not found for event ${eventId}`,\n );\n }\n\n // Download the actual file content\n const downloadUrl = `/projects/${organizationSlug}/${projectSlug}/events/${eventId}/attachments/${attachmentId}/?download=1`;\n const downloadResponse = await this.request(\n downloadUrl,\n {\n method: \"GET\",\n headers: {\n Accept: \"application/octet-stream\",\n },\n },\n opts,\n );\n\n return {\n attachment,\n downloadUrl: downloadResponse.url,\n filename: attachment.name,\n blob: await downloadResponse.blob(),\n };\n }\n\n async updateIssue(\n {\n organizationSlug,\n issueId,\n status,\n assignedTo,\n }: {\n organizationSlug: string;\n issueId: string;\n status?: string;\n assignedTo?: string;\n },\n opts?: RequestOptions,\n ): Promise<Issue> {\n const updateData: Record<string, any> = {};\n if (status !== undefined) updateData.status = status;\n if (assignedTo !== undefined) updateData.assignedTo = assignedTo;\n\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/`,\n {\n method: \"PUT\",\n body: JSON.stringify(updateData),\n },\n opts,\n );\n\n const body = await response.json();\n return IssueSchema.parse(body);\n }\n\n // TODO: Sentry is not yet exposing a reasonable API to fetch trace data\n // async getTrace({\n // organizationSlug,\n // traceId,\n // }: {\n // organizationSlug: string;\n // traceId: string;\n // }): Promise<z.infer<typeof SentryIssueSchema>> {\n // const response = await this.request(\n // `/organizations/${organizationSlug}/issues/${traceId}/`,\n // );\n\n // const body = await response.json();\n // return SentryIssueSchema.parse(body);\n // }\n\n async searchErrors(\n {\n organizationSlug,\n projectSlug,\n filename,\n transaction,\n query,\n sortBy = \"last_seen\",\n }: {\n organizationSlug: string;\n projectSlug?: string;\n filename?: string;\n transaction?: string;\n query?: string;\n sortBy?: \"last_seen\" | \"count\";\n },\n opts?: RequestOptions,\n ) {\n const sentryQuery: string[] = [];\n if (filename) {\n sentryQuery.push(`stack.filename:\"*${filename.replace(/\"/g, '\\\\\"')}\"`);\n }\n if (transaction) {\n sentryQuery.push(`transaction:\"${transaction.replace(/\"/g, '\\\\\"')}\"`);\n }\n if (query) {\n sentryQuery.push(query);\n }\n if (projectSlug) {\n sentryQuery.push(`project:${projectSlug}`);\n }\n\n const queryParams = new URLSearchParams();\n queryParams.set(\"dataset\", \"errors\");\n queryParams.set(\"per_page\", \"10\");\n queryParams.set(\"referrer\", \"sentry-mcp\");\n queryParams.set(\n \"sort\",\n `-${sortBy === \"last_seen\" ? \"last_seen\" : \"count\"}`,\n );\n queryParams.set(\"statsPeriod\", \"24h\");\n queryParams.append(\"field\", \"issue\");\n queryParams.append(\"field\", \"title\");\n queryParams.append(\"field\", \"project\");\n queryParams.append(\"field\", \"last_seen()\");\n queryParams.append(\"field\", \"count()\");\n queryParams.set(\"query\", sentryQuery.join(\" \"));\n // if (projectSlug) queryParams.set(\"project\", projectSlug);\n\n const apiUrl = `/organizations/${organizationSlug}/events/?${queryParams.toString()}`;\n\n const response = await this.request(apiUrl, undefined, opts);\n\n const body = await response.json();\n // TODO(dcramer): If you're using an older version of Sentry this API had a breaking change\n // meaning this endpoint will error.\n return ErrorsSearchResponseSchema.parse(body).data;\n }\n\n async searchSpans(\n {\n organizationSlug,\n projectSlug,\n transaction,\n query,\n sortBy = \"timestamp\",\n }: {\n organizationSlug: string;\n projectSlug?: string;\n transaction?: string;\n query?: string;\n sortBy?: \"timestamp\" | \"duration\";\n },\n opts?: RequestOptions,\n ) {\n const sentryQuery: string[] = [\"is_transaction:true\"];\n if (transaction) {\n sentryQuery.push(`transaction:\"${transaction.replace(/\"/g, '\\\\\"')}\"`);\n }\n if (query) {\n sentryQuery.push(query);\n }\n if (projectSlug) {\n sentryQuery.push(`project:${projectSlug}`);\n }\n\n const queryParams = new URLSearchParams();\n queryParams.set(\"dataset\", \"spans\");\n queryParams.set(\"per_page\", \"10\");\n queryParams.set(\"referrer\", \"sentry-mcp\");\n queryParams.set(\n \"sort\",\n `-${sortBy === \"timestamp\" ? \"timestamp\" : \"span.duration\"}`,\n );\n queryParams.set(\"allowAggregateConditions\", \"0\");\n queryParams.set(\"useRpc\", \"1\");\n queryParams.append(\"field\", \"id\");\n queryParams.append(\"field\", \"trace\");\n queryParams.append(\"field\", \"span.op\");\n queryParams.append(\"field\", \"span.description\");\n queryParams.append(\"field\", \"span.duration\");\n queryParams.append(\"field\", \"transaction\");\n queryParams.append(\"field\", \"project\");\n queryParams.append(\"field\", \"timestamp\");\n queryParams.set(\"query\", sentryQuery.join(\" \"));\n // if (projectSlug) queryParams.set(\"project\", projectSlug);\n\n const apiUrl = `/organizations/${organizationSlug}/events/?${queryParams.toString()}`;\n\n const response = await this.request(apiUrl, undefined, opts);\n\n const body = await response.json();\n return SpansSearchResponseSchema.parse(body).data;\n }\n\n // POST https://us.sentry.io/api/0/issues/5485083130/autofix/\n async startAutofix(\n {\n organizationSlug,\n issueId,\n eventId,\n instruction = \"\",\n }: {\n organizationSlug: string;\n issueId: string;\n eventId?: string;\n instruction?: string;\n },\n opts?: RequestOptions,\n ): Promise<AutofixRun> {\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/autofix/`,\n {\n method: \"POST\",\n body: JSON.stringify({\n event_id: eventId,\n instruction,\n }),\n },\n opts,\n );\n const body = await response.json();\n return AutofixRunSchema.parse(body);\n }\n\n // GET https://us.sentry.io/api/0/issues/5485083130/autofix/\n async getAutofixState(\n {\n organizationSlug,\n issueId,\n }: {\n organizationSlug: string;\n issueId: string;\n },\n opts?: RequestOptions,\n ): Promise<AutofixRunState> {\n const response = await this.request(\n `/organizations/${organizationSlug}/issues/${issueId}/autofix/`,\n undefined,\n opts,\n );\n const body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;YAmBF,iBACN,QAAQ;;;;;;;;;YAqBF,iBAAc;;;;;;;;cAAA;;;;;;;;;;;;YAwBd,iBACN;;;;UAIK;;;;;;;;;;;;YAqDC,iBACN,QAAQ;;;;;;;;;;;;;;;YAkDF,iBAAc;;;;;;;;;;;;;;;;;;;;YAyDd,iBAAc;;;;;;;;;;;;;;;;;;;;YAuDd,iBACN,QAAQ;;;;;;;YAyBF,iBACN,QAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch-utils-B-a92ObC.d.ts","names":[],"sources":["../src/internal/fetch-utils.ts"],"sourcesContent":[],"mappings":";;AAQA;;;;;;AAIU;iBAJY,gBAAA,eACN,eACL,kCAER,QAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatting-B-u5CbYn.d.ts","names":[],"sources":["../src/internal/formatting.ts"],"sourcesContent":[],"mappings":";;;;;;;AA+EgB;AAoEhB;AAkdA;;;;;;;AAQS,iBA/hBO,iBAAA,CA+hBP,KAAA,EA9hBA,CAAA,CAAE,KA8hBF,CAAA,OA9hBe,cA8hBf,CAAA,EAAA,UAAA,CAAA,EAAA,MAAA,EAAA,QAAA,CAAA,EAAA,MAAA,GAAA,IAAA,CAAA,EAAA,MAAA;;AACqB;;;;;;iBA3dd,iBAAA,QAAyB;;;;;;;;iBAkdzB,iBAAA;;;;;;;SAOP;SACA;cACK"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatting-BlMiQa9i.cjs","names":["LANGUAGE_EXTENSIONS: Record<string, string>","LANGUAGE_MODULE_PATTERNS: Array<[RegExp, string]>","frame: z.infer<typeof FrameInterface>","platform?: string | null","frameIndex?: number","event: Event","parts: string[]","data: z.infer<typeof ErrorEntrySchema>","platform: string | null","index: number","totalExceptions: number","data: z.infer<typeof RequestEntrySchema>","data: z.infer<typeof MessageEntrySchema>","data: z.infer<typeof ThreadsEntrySchema>","lines: string[]","value: unknown","vars: Record<string, unknown>","frames: z.infer<typeof FrameInterface>[]","contexts: z.infer<typeof EventSchema>[\"contexts\"]"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["/**\n * LLM response formatting utilities for Sentry data.\n *\n * Converts Sentry API responses into structured markdown format optimized\n * for LLM consumption. Handles stacktraces, event details, issue summaries,\n * and contextual information with consistent formatting patterns.\n */\nimport type { z } from \"zod\";\nimport type { Event, Issue } from \"../api-client/types\";\nimport type {\n ErrorEntrySchema,\n ErrorEventSchema,\n EventSchema,\n FrameInterface,\n RequestEntrySchema,\n MessageEntrySchema,\n ThreadsEntrySchema,\n SentryApiService,\n} from \"../api-client\";\n\n// Language detection mappings\nconst LANGUAGE_EXTENSIONS: Record<string, string> = {\n \".java\": \"java\",\n \".py\": \"python\",\n \".js\": \"javascript\",\n \".jsx\": \"javascript\",\n \".ts\": \"javascript\",\n \".tsx\": \"javascript\",\n \".rb\": \"ruby\",\n \".php\": \"php\",\n};\n\nconst LANGUAGE_MODULE_PATTERNS: Array<[RegExp, string]> = [\n [/^(java\\.|com\\.|org\\.)/, \"java\"],\n];\n\n/**\n * Detects the programming language of a stack frame based on the file extension.\n * Falls back to the platform parameter if no filename is available or extension is unrecognized.\n *\n * @param frame - The stack frame containing file and location information\n * @param platform - Optional platform hint to use as fallback\n * @returns The detected language or platform fallback or \"unknown\"\n */\nfunction detectLanguage(\n frame: z.infer<typeof FrameInterface>,\n platform?: string | null,\n): string {\n // Check filename extensions\n if (frame.filename) {\n const ext = frame.filename.toLowerCase().match(/\\.[^.]+$/)?.[0];\n if (ext && LANGUAGE_EXTENSIONS[ext]) {\n return LANGUAGE_EXTENSIONS[ext];\n }\n }\n\n // Check module patterns\n if (frame.module) {\n for (const [pattern, language] of LANGUAGE_MODULE_PATTERNS) {\n if (pattern.test(frame.module)) {\n return language;\n }\n }\n }\n\n // Fallback to platform or unknown\n return platform || \"unknown\";\n}\n\n/**\n * Formats a stack frame into a language-specific string representation.\n * Different languages have different conventions for displaying stack traces.\n *\n * @param frame - The stack frame to format\n * @param frameIndex - Optional frame index for languages that display frame numbers\n * @param platform - Optional platform hint for language detection fallback\n * @returns Formatted stack frame string\n */\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n frameIndex?: number,\n platform?: string | null,\n) {\n const language = detectLanguage(frame, platform);\n\n switch (language) {\n case \"java\": {\n // at com.example.ClassName.methodName(FileName.java:123)\n const className = frame.module || \"UnknownClass\";\n const method = frame.function || \"<unknown>\";\n const source = frame.filename || \"Unknown Source\";\n const location = frame.lineNo ? `:${frame.lineNo}` : \"\";\n return `at ${className}.${method}(${source}${location})`;\n }\n\n case \"python\": {\n // File \"/path/to/file.py\", line 42, in function_name\n const file =\n frame.filename || frame.absPath || frame.module || \"<unknown>\";\n const func = frame.function || \"<module>\";\n const line = frame.lineNo ? `, line ${frame.lineNo}` : \"\";\n return ` File \"${file}\"${line}, in ${func}`;\n }\n\n case \"javascript\": {\n // Original compact format: filename:line:col (function)\n // This preserves backward compatibility\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n\n case \"ruby\": {\n // from /path/to/file.rb:42:in `method_name'\n const file = frame.filename || frame.module || \"<unknown>\";\n const func = frame.function ? ` \\`${frame.function}\\`` : \"\";\n const line = frame.lineNo ? `:${frame.lineNo}:in` : \"\";\n return ` from ${file}${line}${func}`;\n }\n\n case \"php\": {\n // #0 /path/to/file.php(42): functionName()\n const file = frame.filename || \"<unknown>\";\n const line = frame.lineNo ? `(${frame.lineNo})` : \"\";\n const func = frame.function || \"<unknown>\";\n const prefix = frameIndex !== undefined ? `#${frameIndex} ` : \"\";\n return `${prefix}${file}${line}: ${func}()`;\n }\n\n default: {\n // Generic format for unknown languages\n const func = frame.function || \"<unknown>\";\n const location = frame.filename || frame.module || \"<unknown>\";\n const line = frame.lineNo ? `:${frame.lineNo}` : \"\";\n const col = frame.colNo != null ? `:${frame.colNo}` : \"\";\n return ` at ${func} (${location}${line}${col})`;\n }\n }\n}\n\n/**\n * Formats a Sentry event into a structured markdown output.\n * Includes error messages, stack traces, request info, and contextual data.\n *\n * @param event - The Sentry event to format\n * @returns Formatted markdown string\n */\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n\n // Look for the primary error information\n const messageEntry = event.entries.find((e) => e.type === \"message\");\n const exceptionEntry = event.entries.find((e) => e.type === \"exception\");\n const threadsEntry = event.entries.find((e) => e.type === \"threads\");\n const requestEntry = event.entries.find((e) => e.type === \"request\");\n\n // Error message (if present)\n if (messageEntry) {\n output += formatMessageInterfaceOutput(\n event,\n messageEntry.data as z.infer<typeof MessageEntrySchema>,\n );\n }\n\n // Stack trace (from exception or threads)\n if (exceptionEntry) {\n output += formatExceptionInterfaceOutput(\n event,\n exceptionEntry.data as z.infer<typeof ErrorEntrySchema>,\n );\n } else if (threadsEntry) {\n output += formatThreadsInterfaceOutput(\n event,\n threadsEntry.data as z.infer<typeof ThreadsEntrySchema>,\n );\n }\n\n // Request info (if HTTP error)\n if (requestEntry) {\n output += formatRequestInterfaceOutput(\n event,\n requestEntry.data as z.infer<typeof RequestEntrySchema>,\n );\n }\n\n output += formatContexts(event.contexts);\n return output;\n}\n\n/**\n * Extracts the context line matching the frame's line number for inline display.\n * This is used in the full stacktrace view to show the actual line of code\n * that caused the error inline with the stack frame.\n *\n * @param frame - The stack frame containing context lines\n * @returns The line of code at the frame's line number, or empty string if not available\n */\nfunction renderInlineContext(frame: z.infer<typeof FrameInterface>): string {\n if (!frame.context?.length || !frame.lineNo) {\n return \"\";\n }\n\n const contextLine = frame.context.find(([lineNo]) => lineNo === frame.lineNo);\n return contextLine ? `\\n${contextLine[1]}` : \"\";\n}\n\n/**\n * Renders an enhanced view of a stack frame with context lines and variables.\n * Used for the \"Most Relevant Frame\" section to provide detailed information\n * about the most relevant application frame where the error occurred.\n *\n * @param frame - The stack frame to render with enhanced information\n * @param event - The Sentry event containing platform information for language detection\n * @returns Formatted string with frame header, context lines, and variables table\n */\nfunction renderEnhancedFrame(\n frame: z.infer<typeof FrameInterface>,\n event: Event,\n): string {\n const parts: string[] = [];\n\n parts.push(\"**Most Relevant Frame:**\");\n parts.push(\"─────────────────────\");\n parts.push(formatFrameHeader(frame, undefined, event.platform));\n\n // Add context lines if available\n if (frame.context?.length) {\n const contextLines = renderContextLines(frame);\n if (contextLines) {\n parts.push(\"\");\n parts.push(contextLines);\n }\n }\n\n // Add variables table if available\n if (frame.vars && Object.keys(frame.vars).length > 0) {\n parts.push(\"\");\n parts.push(renderVariablesTable(frame.vars));\n }\n\n return parts.join(\"\\n\");\n}\n\nfunction formatExceptionInterfaceOutput(\n event: Event,\n data: z.infer<typeof ErrorEntrySchema>,\n) {\n const parts: string[] = [];\n\n // Handle both single exception (value) and chained exceptions (values)\n const exceptions = data.values || (data.value ? [data.value] : []);\n\n if (exceptions.length === 0) {\n return \"\";\n }\n\n // For chained exceptions, they are typically ordered from innermost to outermost\n // We'll render them in reverse order (outermost first) to match how they occurred\n const isChained = exceptions.length > 1;\n\n // Create a copy before reversing to avoid mutating the original array\n [...exceptions].reverse().forEach((exception, index) => {\n if (!exception) return;\n\n // Add language-specific chain indicator for multiple exceptions\n if (isChained && index > 0) {\n parts.push(\"\");\n parts.push(\n getExceptionChainMessage(event.platform, index, exceptions.length),\n );\n parts.push(\"\");\n }\n\n // Use the actual exception type and value as the heading\n const exceptionTitle = `${exception.type}${exception.value ? `: ${exception.value}` : \"\"}`;\n\n parts.push(index === 0 ? \"### Error\" : `### ${exceptionTitle}`);\n parts.push(\"\");\n\n // Add the error details in a code block for the first exception\n // to maintain backward compatibility\n if (index === 0) {\n parts.push(\"```\");\n parts.push(exceptionTitle);\n parts.push(\"```\");\n parts.push(\"\");\n }\n\n if (!exception.stacktrace || !exception.stacktrace.frames) {\n parts.push(\"**Stacktrace:**\");\n parts.push(\"```\");\n parts.push(\"No stacktrace available\");\n parts.push(\"```\");\n return;\n }\n\n const frames = exception.stacktrace.frames;\n\n // Only show enhanced frame for the first (outermost) exception to avoid overwhelming output\n if (index === 0) {\n const firstInAppFrame = findFirstInAppFrame(frames);\n if (\n firstInAppFrame &&\n (firstInAppFrame.context?.length || firstInAppFrame.vars)\n ) {\n parts.push(renderEnhancedFrame(firstInAppFrame, event));\n parts.push(\"\");\n parts.push(\"**Full Stacktrace:**\");\n parts.push(\"────────────────\");\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n\n parts.push(\"```\");\n parts.push(\n frames\n .map((frame) => {\n const header = formatFrameHeader(frame, undefined, event.platform);\n const context = renderInlineContext(frame);\n return `${header}${context}`;\n })\n .join(\"\\n\"),\n );\n parts.push(\"```\");\n });\n\n parts.push(\"\");\n parts.push(\"\");\n\n return parts.join(\"\\n\");\n}\n\n/**\n * Get the appropriate exception chain message based on the platform\n */\nfunction getExceptionChainMessage(\n platform: string | null,\n index: number,\n totalExceptions: number,\n): string {\n // Default message for unknown platforms\n const defaultMessage =\n \"**During handling of the above exception, another exception occurred:**\";\n\n if (!platform) {\n return defaultMessage;\n }\n\n switch (platform.toLowerCase()) {\n case \"python\":\n // Python has two distinct messages, but without additional metadata\n // we default to the implicit chaining message\n return \"**During handling of the above exception, another exception occurred:**\";\n\n case \"java\":\n return \"**Caused by:**\";\n\n case \"csharp\":\n case \"dotnet\":\n return \"**---> Inner Exception:**\";\n\n case \"ruby\":\n return \"**Caused by:**\";\n\n case \"go\":\n return \"**Wrapped error:**\";\n\n case \"rust\":\n return `**Caused by (${index}):**`;\n\n default:\n return defaultMessage;\n }\n}\n\nfunction formatRequestInterfaceOutput(\n event: Event,\n data: z.infer<typeof RequestEntrySchema>,\n) {\n if (!data.method || !data.url) {\n return \"\";\n }\n return `### HTTP Request\\n\\n**Method:** ${data.method}\\n**URL:** ${data.url}\\n\\n`;\n}\n\nfunction formatMessageInterfaceOutput(\n event: Event,\n data: z.infer<typeof MessageEntrySchema>,\n) {\n if (!data.formatted && !data.message) {\n return \"\";\n }\n const message = data.formatted || data.message || \"\";\n return `### Error\\n\\n${\"```\"}\\n${message}\\n${\"```\"}\\n\\n`;\n}\n\nfunction formatThreadsInterfaceOutput(\n event: Event,\n data: z.infer<typeof ThreadsEntrySchema>,\n) {\n if (!data.values || data.values.length === 0) {\n return \"\";\n }\n\n // Find the crashed thread only\n const crashedThread = data.values.find((t) => t.crashed);\n\n if (!crashedThread?.stacktrace?.frames) {\n return \"\";\n }\n\n const parts: string[] = [];\n\n // Include thread name if available\n if (crashedThread.name) {\n parts.push(`**Thread** (${crashedThread.name})`);\n parts.push(\"\");\n }\n\n const frames = crashedThread.stacktrace.frames;\n\n // Find and format the first in-app frame with enhanced view\n const firstInAppFrame = findFirstInAppFrame(frames);\n if (\n firstInAppFrame &&\n (firstInAppFrame.context?.length || firstInAppFrame.vars)\n ) {\n parts.push(renderEnhancedFrame(firstInAppFrame, event));\n parts.push(\"\");\n parts.push(\"**Full Stacktrace:**\");\n parts.push(\"────────────────\");\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n\n parts.push(\"```\");\n parts.push(\n frames\n .map((frame) => {\n const header = formatFrameHeader(frame, undefined, event.platform);\n const context = renderInlineContext(frame);\n return `${header}${context}`;\n })\n .join(\"\\n\"),\n );\n parts.push(\"```\");\n parts.push(\"\");\n\n return parts.join(\"\\n\");\n}\n\n/**\n * Renders surrounding source code context for a stack frame.\n * Shows a window of code lines around the error line with visual indicators.\n *\n * @param frame - The stack frame containing context lines\n * @param contextSize - Number of lines to show before and after the error line (default: 3)\n * @returns Formatted context lines with line numbers and arrow indicator for the error line\n */\nfunction renderContextLines(\n frame: z.infer<typeof FrameInterface>,\n contextSize = 3,\n): string {\n if (!frame.context || frame.context.length === 0 || !frame.lineNo) {\n return \"\";\n }\n\n const lines: string[] = [];\n const errorLine = frame.lineNo;\n const maxLineNoWidth = Math.max(\n ...frame.context.map(([lineNo]) => lineNo.toString().length),\n );\n\n for (const [lineNo, code] of frame.context) {\n const isErrorLine = lineNo === errorLine;\n const lineNoStr = lineNo.toString().padStart(maxLineNoWidth, \" \");\n\n if (Math.abs(lineNo - errorLine) <= contextSize) {\n if (isErrorLine) {\n lines.push(` → ${lineNoStr} │ ${code}`);\n } else {\n lines.push(` ${lineNoStr} │ ${code}`);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Formats a variable value for display in the variables table.\n * Handles different types appropriately and safely, converting complex objects\n * to readable representations and handling edge cases like circular references.\n *\n * @param value - The variable value to format (can be any type)\n * @param maxLength - Maximum length for stringified objects/arrays (default: 80)\n * @returns Human-readable string representation of the value\n */\nfunction formatVariableValue(value: unknown, maxLength = 80): string {\n try {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n if (value === null) {\n return \"null\";\n }\n if (value === undefined) {\n return \"undefined\";\n }\n if (typeof value === \"object\") {\n const stringified = JSON.stringify(value);\n if (stringified.length > maxLength) {\n // Leave room for \", ...]\" or \", ...}\"\n const truncateAt = maxLength - 6;\n let truncated = stringified.substring(0, truncateAt);\n\n // Find the last complete element by looking for the last comma\n const lastComma = truncated.lastIndexOf(\",\");\n if (lastComma > 0) {\n truncated = truncated.substring(0, lastComma);\n }\n\n // Add the appropriate ending\n if (Array.isArray(value)) {\n return `${truncated}, ...]`;\n }\n return `${truncated}, ...}`;\n }\n return stringified;\n }\n return String(value);\n } catch {\n // Handle circular references or other stringify errors\n return `<${typeof value}>`;\n }\n}\n\n/**\n * Renders a table of local variables in a tree-like format.\n * Uses box-drawing characters to create a visual hierarchy of variables\n * and their values at the point where the error occurred.\n *\n * @param vars - Object containing variable names as keys and their values\n * @returns Formatted variables table with tree-style prefix characters\n */\nfunction renderVariablesTable(vars: Record<string, unknown>): string {\n const entries = Object.entries(vars);\n if (entries.length === 0) {\n return \"\";\n }\n\n const lines: string[] = [\"Local Variables:\"];\n const lastIndex = entries.length - 1;\n\n entries.forEach(([key, value], index) => {\n const prefix = index === lastIndex ? \"└─\" : \"├─\";\n const valueStr = formatVariableValue(value);\n lines.push(`${prefix} ${key}: ${valueStr}`);\n });\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Finds the first application frame (in_app) in a stack trace.\n * Searches from the bottom of the stack (oldest frame) to find the first\n * frame that belongs to the user's application code rather than libraries.\n *\n * @param frames - Array of stack frames, typically in reverse chronological order\n * @returns The first in-app frame found, or undefined if none exist\n */\nfunction findFirstInAppFrame(\n frames: z.infer<typeof FrameInterface>[],\n): z.infer<typeof FrameInterface> | undefined {\n // Frames are usually in reverse order (most recent first)\n // We want the first in-app frame from the bottom\n for (let i = frames.length - 1; i >= 0; i--) {\n if (frames[i].inApp === true) {\n return frames[i];\n }\n }\n return undefined;\n}\n\nfunction formatContexts(contexts: z.infer<typeof EventSchema>[\"contexts\"]) {\n if (!contexts || Object.keys(contexts).length === 0) {\n return \"\";\n }\n return `### Additional Context\\n\\nThese are additional context provided by the user when they're instrumenting their application.\\n\\n${Object.entries(\n contexts,\n )\n .map(\n ([name, data]) =>\n `**${name}**\\n${Object.entries(data)\n .filter(([key, _]) => key !== \"type\")\n .map(([key, value]) => {\n return `${key}: ${JSON.stringify(value, undefined, 2)}`;\n })\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\")}\\n\\n`;\n}\n\n/**\n * Formats a Sentry issue with its latest event into comprehensive markdown output.\n * Includes issue metadata, event details, and usage instructions.\n *\n * @param params - Object containing organization slug, issue, event, and API service\n * @returns Formatted markdown string with complete issue information\n */\nexport function formatIssueOutput({\n organizationSlug,\n issue,\n event,\n apiService,\n}: {\n organizationSlug: string;\n issue: Issue;\n event: Event;\n apiService: SentryApiService;\n}) {\n let output = `# Issue ${issue.shortId} in **${organizationSlug}**\\n\\n`;\n output += `**Description**: ${issue.title}\\n`;\n output += `**Culprit**: ${issue.culprit}\\n`;\n output += `**First Seen**: ${new Date(issue.firstSeen).toISOString()}\\n`;\n output += `**Last Seen**: ${new Date(issue.lastSeen).toISOString()}\\n`;\n output += `**Occurrences**: ${issue.count}\\n`;\n output += `**Users Impacted**: ${issue.userCount}\\n`;\n output += `**Status**: ${issue.status}\\n`;\n output += `**Platform**: ${issue.platform}\\n`;\n output += `**Project**: ${issue.project.name}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, issue.shortId)}\\n`;\n output += \"\\n\";\n output += \"## Event Details\\n\\n\";\n output += `**Event ID**: ${event.id}\\n`;\n if (event.type === \"error\") {\n output += `**Occurred At**: ${new Date((event as z.infer<typeof ErrorEventSchema>).dateCreated).toISOString()}\\n`;\n }\n if (event.message) {\n output += `**Message**:\\n${event.message}\\n`;\n }\n output += \"\\n\";\n output += formatEventOutput(event);\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the IssueID in commit messages (e.g. \\`Fixes ${issue.shortId}\\`) to automatically close the issue when the commit is merged.\\n`;\n output +=\n \"- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\\n\";\n return output;\n}\n"],"mappings":";;AAqBA,MAAMA,sBAA8C;CAClD,SAAS;CACT,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;AACT;AAED,MAAMC,2BAAoD,CACxD,CAAC,yBAAyB,MAAO,CAClC;;;;;;;;;AAUD,SAAS,eACPC,OACAC,UACQ;AAER,KAAI,MAAM,UAAU;EAClB,MAAM,MAAM,MAAM,SAAS,aAAa,CAAC,MAAM,WAAW,GAAG;AAC7D,MAAI,OAAO,oBAAoB,KAC7B,QAAO,oBAAoB;CAE9B;AAGD,KAAI,MAAM,QACR;OAAK,MAAM,CAAC,SAAS,SAAS,IAAI,yBAChC,KAAI,QAAQ,KAAK,MAAM,OAAO,CAC5B,QAAO;CAEV;AAIH,QAAO,YAAY;AACpB;;;;;;;;;;AAWD,SAAgB,kBACdD,OACAE,YACAD,UACA;CACA,MAAM,WAAW,eAAe,OAAO,SAAS;AAEhD,SAAQ,UAAR;EACE,KAAK,QAAQ;GAEX,MAAM,YAAY,MAAM,UAAU;GAClC,MAAM,SAAS,MAAM,YAAY;GACjC,MAAM,SAAS,MAAM,YAAY;GACjC,MAAM,WA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A,QAAyB;;;;;;;;iBAkdzB,iBAAA;;;;;;;SAOP;SACA;cACK"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatting-pUm38KOj.js","names":["LANGUAGE_EXTENSIONS: Record<string, string>","LANGUAGE_MODULE_PATTERNS: Array<[RegExp, string]>","frame: z.infer<typeof FrameInterface>","platform?: string | null","frameIndex?: number","event: Event","parts: string[]","data: z.infer<typeof ErrorEntrySchema>","platform: string | null","index: number","totalExceptions: number","data: z.infer<typeof RequestEntrySchema>","data: z.infer<typeof MessageEntrySchema>","data: z.infer<typeof ThreadsEntrySchema>","lines: string[]","value: unknown","vars: Record<string, unknown>","frames: z.infer<typeof FrameInterface>[]","contexts: z.infer<typeof EventSchema>[\"contexts\"]"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["/**\n * LLM response formatting utilities for Sentry data.\n *\n * Converts Sentry API responses into structured markdown format optimized\n * for LLM consumption. Handles stacktraces, event details, issue summaries,\n * and contextual information with consistent formatting patterns.\n */\nimport type { z } from \"zod\";\nimport type { Event, Issue } from \"../api-client/types\";\nimport type {\n ErrorEntrySchema,\n ErrorEventSchema,\n EventSchema,\n FrameInterface,\n RequestEntrySchema,\n MessageEntrySchema,\n ThreadsEntrySchema,\n SentryApiService,\n} from \"../api-client\";\n\n// Language detection mappings\nconst LANGUAGE_EXTENSIONS: Record<string, string> = {\n \".java\": \"java\",\n \".py\": \"python\",\n \".js\": \"javascript\",\n \".jsx\": \"javascript\",\n \".ts\": \"javascript\",\n \".tsx\": \"javascript\",\n \".rb\": \"ruby\",\n \".php\": \"php\",\n};\n\nconst LANGUAGE_MODULE_PATTERNS: Array<[RegExp, string]> = [\n [/^(java\\.|com\\.|org\\.)/, \"java\"],\n];\n\n/**\n * Detects the programming language of a stack frame based on the file extension.\n * Falls back to the platform parameter if no filename is available or extension is unrecognized.\n *\n * @param frame - The stack frame containing file and location information\n * @param platform - Optional platform hint to use as fallback\n * @returns The detected language or platform fallback or \"unknown\"\n */\nfunction detectLanguage(\n frame: z.infer<typeof FrameInterface>,\n platform?: string | null,\n): string {\n // Check filename extensions\n if (frame.filename) {\n const ext = frame.filename.toLowerCase().match(/\\.[^.]+$/)?.[0];\n if (ext && LANGUAGE_EXTENSIONS[ext]) {\n return LANGUAGE_EXTENSIONS[ext];\n }\n }\n\n // Check module patterns\n if (frame.module) {\n for (const [pattern, language] of LANGUAGE_MODULE_PATTERNS) {\n if (pattern.test(frame.module)) {\n return language;\n }\n }\n }\n\n // Fallback to platform or unknown\n return platform || \"unknown\";\n}\n\n/**\n * Formats a stack frame into a language-specific string representation.\n * Different languages have different conventions for displaying stack traces.\n *\n * @param frame - The stack frame to format\n * @param frameIndex - Optional frame index for languages that display frame numbers\n * @param platform - Optional platform hint for language detection fallback\n * @returns Formatted stack frame string\n */\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n frameIndex?: number,\n platform?: string | null,\n) {\n const language = detectLanguage(frame, platform);\n\n switch (language) {\n case \"java\": {\n // at com.example.ClassName.methodName(FileName.java:123)\n const className = frame.module || \"UnknownClass\";\n const method = frame.function || \"<unknown>\";\n const source = frame.filename || \"Unknown Source\";\n const location = frame.lineNo ? `:${frame.lineNo}` : \"\";\n return `at ${className}.${method}(${source}${location})`;\n }\n\n case \"python\": {\n // File \"/path/to/file.py\", line 42, in function_name\n const file =\n frame.filename || frame.absPath || frame.module || \"<unknown>\";\n const func = frame.function || \"<module>\";\n const line = frame.lineNo ? `, line ${frame.lineNo}` : \"\";\n return ` File \"${file}\"${line}, in ${func}`;\n }\n\n case \"javascript\": {\n // Original compact format: filename:line:col (function)\n // This preserves backward compatibility\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n\n case \"ruby\": {\n // from /path/to/file.rb:42:in `method_name'\n const file = frame.filename || frame.module || \"<unknown>\";\n const func = frame.function ? ` \\`${frame.function}\\`` : \"\";\n const line = frame.lineNo ? `:${frame.lineNo}:in` : \"\";\n return ` from ${file}${line}${func}`;\n }\n\n case \"php\": {\n // #0 /path/to/file.php(42): functionName()\n const file = frame.filename || \"<unknown>\";\n const line = frame.lineNo ? `(${frame.lineNo})` : \"\";\n const func = frame.function || \"<unknown>\";\n const prefix = frameIndex !== undefined ? `#${frameIndex} ` : \"\";\n return `${prefix}${file}${line}: ${func}()`;\n }\n\n default: {\n // Generic format for unknown languages\n const func = frame.function || \"<unknown>\";\n const location = frame.filename || frame.module || \"<unknown>\";\n const line = frame.lineNo ? `:${frame.lineNo}` : \"\";\n const col = frame.colNo != null ? `:${frame.colNo}` : \"\";\n return ` at ${func} (${location}${line}${col})`;\n }\n }\n}\n\n/**\n * Formats a Sentry event into a structured markdown output.\n * Includes error messages, stack traces, request info, and contextual data.\n *\n * @param event - The Sentry event to format\n * @returns Formatted markdown string\n */\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n\n // Look for the primary error information\n const messageEntry = event.entries.find((e) => e.type === \"message\");\n const exceptionEntry = event.entries.find((e) => e.type === \"exception\");\n const threadsEntry = event.entries.find((e) => e.type === \"threads\");\n const requestEntry = event.entries.find((e) => e.type === \"request\");\n\n // Error message (if present)\n if (messageEntry) {\n output += formatMessageInterfaceOutput(\n event,\n messageEntry.data as z.infer<typeof MessageEntrySchema>,\n );\n }\n\n // Stack trace (from exception or threads)\n if (exceptionEntry) {\n output += formatExceptionInterfaceOutput(\n event,\n exceptionEntry.data as z.infer<typeof ErrorEntrySchema>,\n );\n } else if (threadsEntry) {\n output += formatThreadsInterfaceOutput(\n event,\n threadsEntry.data as z.infer<typeof ThreadsEntrySchema>,\n );\n }\n\n // Request info (if HTTP error)\n if (requestEntry) {\n output += formatRequestInterfaceOutput(\n event,\n requestEntry.data as z.infer<typeof RequestEntrySchema>,\n );\n }\n\n output += formatContexts(event.contexts);\n return output;\n}\n\n/**\n * Extracts the context line matching the frame's line number for inline display.\n * This is used in the full stacktrace view to show the actual line of code\n * that caused the error inline with the stack frame.\n *\n * @param frame - The stack frame containing context lines\n * @returns The line of code at the frame's line number, or empty string if not available\n */\nfunction renderInlineContext(frame: z.infer<typeof FrameInterface>): string {\n if (!frame.context?.length || !frame.lineNo) {\n return \"\";\n }\n\n const contextLine = frame.context.find(([lineNo]) => lineNo === frame.lineNo);\n return contextLine ? `\\n${contextLine[1]}` : \"\";\n}\n\n/**\n * Renders an enhanced view of a stack frame with context lines and variables.\n * Used for the \"Most Relevant Frame\" section to provide detailed information\n * about the most relevant application frame where the error occurred.\n *\n * @param frame - The stack frame to render with enhanced information\n * @param event - The Sentry event containing platform information for language detection\n * @returns Formatted string with frame header, context lines, and variables table\n */\nfunction renderEnhancedFrame(\n frame: z.infer<typeof FrameInterface>,\n event: Event,\n): string {\n const parts: string[] = [];\n\n parts.push(\"**Most Relevant Frame:**\");\n parts.push(\"─────────────────────\");\n parts.push(formatFrameHeader(frame, undefined, event.platform));\n\n // Add context lines if available\n if (frame.context?.length) {\n const contextLines = renderContextLines(frame);\n if (contextLines) {\n parts.push(\"\");\n parts.push(contextLines);\n }\n }\n\n // Add variables table if available\n if (frame.vars && Object.keys(frame.vars).length > 0) {\n parts.push(\"\");\n parts.push(renderVariablesTable(frame.vars));\n }\n\n return parts.join(\"\\n\");\n}\n\nfunction formatExceptionInterfaceOutput(\n event: Event,\n data: z.infer<typeof ErrorEntrySchema>,\n) {\n const parts: string[] = [];\n\n // Handle both single exception (value) and chained exceptions (values)\n const exceptions = data.values || (data.value ? [data.value] : []);\n\n if (exceptions.length === 0) {\n return \"\";\n }\n\n // For chained exceptions, they are typically ordered from innermost to outermost\n // We'll render them in reverse order (outermost first) to match how they occurred\n const isChained = exceptions.length > 1;\n\n // Create a copy before reversing to avoid mutating the original array\n [...exceptions].reverse().forEach((exception, index) => {\n if (!exception) return;\n\n // Add language-specific chain indicator for multiple exceptions\n if (isChained && index > 0) {\n parts.push(\"\");\n parts.push(\n getExceptionChainMessage(event.platform, index, exceptions.length),\n );\n parts.push(\"\");\n }\n\n // Use the actual exception type and value as the heading\n const exceptionTitle = `${exception.type}${exception.value ? `: ${exception.value}` : \"\"}`;\n\n parts.push(index === 0 ? \"### Error\" : `### ${exceptionTitle}`);\n parts.push(\"\");\n\n // Add the error details in a code block for the first exception\n // to maintain backward compatibility\n if (index === 0) {\n parts.push(\"```\");\n parts.push(exceptionTitle);\n parts.push(\"```\");\n parts.push(\"\");\n }\n\n if (!exception.stacktrace || !exception.stacktrace.frames) {\n parts.push(\"**Stacktrace:**\");\n parts.push(\"```\");\n parts.push(\"No stacktrace available\");\n parts.push(\"```\");\n return;\n }\n\n const frames = exception.stacktrace.frames;\n\n // Only show enhanced frame for the first (outermost) exception to avoid overwhelming output\n if (index === 0) {\n const firstInAppFrame = findFirstInAppFrame(frames);\n if (\n firstInAppFrame &&\n (firstInAppFrame.context?.length || firstInAppFrame.vars)\n ) {\n parts.push(renderEnhancedFrame(firstInAppFrame, event));\n parts.push(\"\");\n parts.push(\"**Full Stacktrace:**\");\n parts.push(\"────────────────\");\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n\n parts.push(\"```\");\n parts.push(\n frames\n .map((frame) => {\n const header = formatFrameHeader(frame, undefined, event.platform);\n const context = renderInlineContext(frame);\n return `${header}${context}`;\n })\n .join(\"\\n\"),\n );\n parts.push(\"```\");\n });\n\n parts.push(\"\");\n parts.push(\"\");\n\n return parts.join(\"\\n\");\n}\n\n/**\n * Get the appropriate exception chain message based on the platform\n */\nfunction getExceptionChainMessage(\n platform: string | null,\n index: number,\n totalExceptions: number,\n): string {\n // Default message for unknown platforms\n const defaultMessage =\n \"**During handling of the above exception, another exception occurred:**\";\n\n if (!platform) {\n return defaultMessage;\n }\n\n switch (platform.toLowerCase()) {\n case \"python\":\n // Python has two distinct messages, but without additional metadata\n // we default to the implicit chaining message\n return \"**During handling of the above exception, another exception occurred:**\";\n\n case \"java\":\n return \"**Caused by:**\";\n\n case \"csharp\":\n case \"dotnet\":\n return \"**---> Inner Exception:**\";\n\n case \"ruby\":\n return \"**Caused by:**\";\n\n case \"go\":\n return \"**Wrapped error:**\";\n\n case \"rust\":\n return `**Caused by (${index}):**`;\n\n default:\n return defaultMessage;\n }\n}\n\nfunction formatRequestInterfaceOutput(\n event: Event,\n data: z.infer<typeof RequestEntrySchema>,\n) {\n if (!data.method || !data.url) {\n return \"\";\n }\n return `### HTTP Request\\n\\n**Method:** ${data.method}\\n**URL:** ${data.url}\\n\\n`;\n}\n\nfunction formatMessageInterfaceOutput(\n event: Event,\n data: z.infer<typeof MessageEntrySchema>,\n) {\n if (!data.formatted && !data.message) {\n return \"\";\n }\n const message = data.formatted || data.message || \"\";\n return `### Error\\n\\n${\"```\"}\\n${message}\\n${\"```\"}\\n\\n`;\n}\n\nfunction formatThreadsInterfaceOutput(\n event: Event,\n data: z.infer<typeof ThreadsEntrySchema>,\n) {\n if (!data.values || data.values.length === 0) {\n return \"\";\n }\n\n // Find the crashed thread only\n const crashedThread = data.values.find((t) => t.crashed);\n\n if (!crashedThread?.stacktrace?.frames) {\n return \"\";\n }\n\n const parts: string[] = [];\n\n // Include thread name if available\n if (crashedThread.name) {\n parts.push(`**Thread** (${crashedThread.name})`);\n parts.push(\"\");\n }\n\n const frames = crashedThread.stacktrace.frames;\n\n // Find and format the first in-app frame with enhanced view\n const firstInAppFrame = findFirstInAppFrame(frames);\n if (\n firstInAppFrame &&\n (firstInAppFrame.context?.length || firstInAppFrame.vars)\n ) {\n parts.push(renderEnhancedFrame(firstInAppFrame, event));\n parts.push(\"\");\n parts.push(\"**Full Stacktrace:**\");\n parts.push(\"────────────────\");\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n\n parts.push(\"```\");\n parts.push(\n frames\n .map((frame) => {\n const header = formatFrameHeader(frame, undefined, event.platform);\n const context = renderInlineContext(frame);\n return `${header}${context}`;\n })\n .join(\"\\n\"),\n );\n parts.push(\"```\");\n parts.push(\"\");\n\n return parts.join(\"\\n\");\n}\n\n/**\n * Renders surrounding source code context for a stack frame.\n * Shows a window of code lines around the error line with visual indicators.\n *\n * @param frame - The stack frame containing context lines\n * @param contextSize - Number of lines to show before and after the error line (default: 3)\n * @returns Formatted context lines with line numbers and arrow indicator for the error line\n */\nfunction renderContextLines(\n frame: z.infer<typeof FrameInterface>,\n contextSize = 3,\n): string {\n if (!frame.context || frame.context.length === 0 || !frame.lineNo) {\n return \"\";\n }\n\n const lines: string[] = [];\n const errorLine = frame.lineNo;\n const maxLineNoWidth = Math.max(\n ...frame.context.map(([lineNo]) => lineNo.toString().length),\n );\n\n for (const [lineNo, code] of frame.context) {\n const isErrorLine = lineNo === errorLine;\n const lineNoStr = lineNo.toString().padStart(maxLineNoWidth, \" \");\n\n if (Math.abs(lineNo - errorLine) <= contextSize) {\n if (isErrorLine) {\n lines.push(` → ${lineNoStr} │ ${code}`);\n } else {\n lines.push(` ${lineNoStr} │ ${code}`);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Formats a variable value for display in the variables table.\n * Handles different types appropriately and safely, converting complex objects\n * to readable representations and handling edge cases like circular references.\n *\n * @param value - The variable value to format (can be any type)\n * @param maxLength - Maximum length for stringified objects/arrays (default: 80)\n * @returns Human-readable string representation of the value\n */\nfunction formatVariableValue(value: unknown, maxLength = 80): string {\n try {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n if (value === null) {\n return \"null\";\n }\n if (value === undefined) {\n return \"undefined\";\n }\n if (typeof value === \"object\") {\n const stringified = JSON.stringify(value);\n if (stringified.length > maxLength) {\n // Leave room for \", ...]\" or \", ...}\"\n const truncateAt = maxLength - 6;\n let truncated = stringified.substring(0, truncateAt);\n\n // Find the last complete element by looking for the last comma\n const lastComma = truncated.lastIndexOf(\",\");\n if (lastComma > 0) {\n truncated = truncated.substring(0, lastComma);\n }\n\n // Add the appropriate ending\n if (Array.isArray(value)) {\n return `${truncated}, ...]`;\n }\n return `${truncated}, ...}`;\n }\n return stringified;\n }\n return String(value);\n } catch {\n // Handle circular references or other stringify errors\n return `<${typeof value}>`;\n }\n}\n\n/**\n * Renders a table of local variables in a tree-like format.\n * Uses box-drawing characters to create a visual hierarchy of variables\n * and their values at the point where the error occurred.\n *\n * @param vars - Object containing variable names as keys and their values\n * @returns Formatted variables table with tree-style prefix characters\n */\nfunction renderVariablesTable(vars: Record<string, unknown>): string {\n const entries = Object.entries(vars);\n if (entries.length === 0) {\n return \"\";\n }\n\n const lines: string[] = [\"Local Variables:\"];\n const lastIndex = entries.length - 1;\n\n entries.forEach(([key, value], index) => {\n const prefix = index === lastIndex ? \"└─\" : \"├─\";\n const valueStr = formatVariableValue(value);\n lines.push(`${prefix} ${key}: ${valueStr}`);\n });\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Finds the first application frame (in_app) in a stack trace.\n * Searches from the bottom of the stack (oldest frame) to find the first\n * frame that belongs to the user's application code rather than libraries.\n *\n * @param frames - Array of stack frames, typically in reverse chronological order\n * @returns The first in-app frame found, or undefined if none exist\n */\nfunction findFirstInAppFrame(\n frames: z.infer<typeof FrameInterface>[],\n): z.infer<typeof FrameInterface> | undefined {\n // Frames are usually in reverse order (most recent first)\n // We want the first in-app frame from the bottom\n for (let i = frames.length - 1; i >= 0; i--) {\n if (frames[i].inApp === true) {\n return frames[i];\n }\n }\n return undefined;\n}\n\nfunction formatContexts(contexts: z.infer<typeof EventSchema>[\"contexts\"]) {\n if (!contexts || Object.keys(contexts).length === 0) {\n return \"\";\n }\n return `### Additional Context\\n\\nThese are additional context provided by the user when they're instrumenting their application.\\n\\n${Object.entries(\n contexts,\n )\n .map(\n ([name, data]) =>\n `**${name}**\\n${Object.entries(data)\n .filter(([key, _]) => key !== \"type\")\n .map(([key, value]) => {\n return `${key}: ${JSON.stringify(value, undefined, 2)}`;\n })\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\")}\\n\\n`;\n}\n\n/**\n * Formats a Sentry issue with its latest event into comprehensive markdown output.\n * Includes issue metadata, event details, and usage instructions.\n *\n * @param params - Object containing organization slug, issue, event, and API service\n * @returns Formatted markdown string with complete issue information\n */\nexport function formatIssueOutput({\n organizationSlug,\n issue,\n event,\n apiService,\n}: {\n organizationSlug: string;\n issue: Issue;\n event: Event;\n apiService: SentryApiService;\n}) {\n let output = `# Issue ${issue.shortId} in **${organizationSlug}**\\n\\n`;\n output += `**Description**: ${issue.title}\\n`;\n output += `**Culprit**: ${issue.culprit}\\n`;\n output += `**First Seen**: ${new Date(issue.firstSeen).toISOString()}\\n`;\n output += `**Last Seen**: ${new Date(issue.lastSeen).toISOString()}\\n`;\n output += `**Occurrences**: ${issue.count}\\n`;\n output += `**Users Impacted**: ${issue.userCount}\\n`;\n output += `**Status**: ${issue.status}\\n`;\n output += `**Platform**: ${issue.platform}\\n`;\n output += `**Project**: ${issue.project.name}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, issue.shortId)}\\n`;\n output += \"\\n\";\n output += \"## Event Details\\n\\n\";\n output += `**Event ID**: ${event.id}\\n`;\n if (event.type === \"error\") {\n output += `**Occurred At**: ${new Date((event as z.infer<typeof ErrorEventSchema>).dateCreated).toISOString()}\\n`;\n }\n if (event.message) {\n output += `**Message**:\\n${event.message}\\n`;\n }\n output += \"\\n\";\n output += formatEventOutput(event);\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the IssueID in commit messages (e.g. \\`Fixes ${issue.shortId}\\`) to automatically close the issue when the commit is merged.\\n`;\n output +=\n \"- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\\n\";\n return output;\n}\n"],"mappings":";AAqBA,MAAMA,sBAA8C;CAClD,SAAS;CACT,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;AACT;AAED,MAAMC,2BAAoD,CACxD,CAAC,yBAAyB,MAAO,CAClC;;;;;;;;;AAUD,SAAS,eACPC,OACAC,UACQ;AAER,KAAI,MAAM,UAAU;EAClB,MAAM,MAAM,MAAM,SAAS,aAAa,CAAC,MAA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AkB,MAAM;AAClC,WAAU;AACV,YAAW,mEAAmE,MAAM,QAAQ;AAC5F,WACE;AACF,QAAO;AACR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-issue-details-DrpD5LlK.js","names":["context: ServerContext","orgSlug","issue","event"],"sources":["../src/tools/get-issue-details.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext } from \"./utils/api-utils\";\nimport { parseIssueParams, formatIssueOutput } from \"./utils/issue-utils\";\nimport { UserInputError } from \"../errors\";\nimport type { ServerContext } from \"../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamIssueShortId,\n ParamIssueUrl,\n} from \"../schema\";\n\nexport default defineTool({\n name: \"get_issue_details\",\n description: [\n \"Retrieve issue details from Sentry for a specific Issue ID, including the stacktrace and error message if available. Either issueId or issueUrl MUST be provided.\",\n \"\",\n \"**NOTE: If the user asks HOW TO FIX an issue, use `analyze_issue_with_seer` instead!**\",\n \"\",\n \"Use this tool when you need to:\",\n \"- View error details, stacktraces, and metadata\",\n \"- Investigate when/where an error occurred\",\n \"- Access raw error information from Sentry\",\n \"\",\n \"Do NOT use this tool when:\",\n '- User asks \"how do I fix this?\" → Use `analyze_issue_with_seer`',\n \"- User wants root cause analysis → Use `analyze_issue_with_seer`\",\n \"- User needs code fixes → Use `analyze_issue_with_seer`\",\n \"\",\n \"<examples>\",\n \"### Get details for issue ID 'CLOUDFLARE-MCP-41'\",\n \"\",\n \"```\",\n \"get_issue_details(organizationSlug='my-organization', issueId='CLOUDFLARE-MCP-41')\",\n \"```\",\n \"\",\n \"### Get details for event ID 'c49541c747cb4d8aa3efb70ca5aba243'\",\n \"\",\n \"```\",\n \"get_issue_details(organizationSlug='my-organization', eventId='c49541c747cb4d8aa3efb70ca5aba243')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user provides the `issueUrl`, you can ignore the other parameters.\",\n \"- If the user provides `issueId` or `eventId` (only one is needed), `organizationSlug` is required.\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug.optional(),\n regionUrl: ParamRegionUrl.optional(),\n issueId: ParamIssueShortId.optional(),\n eventId: z.string().trim().describe(\"The ID of the event.\").optional(),\n issueUrl: ParamIssueUrl.optional(),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n\n if (params.eventId) {\n const orgSlug = params.organizationSlug;\n if (!orgSlug) {\n throw new UserInputError(\n \"`organizationSlug` is required when providing `eventId`\",\n );\n }\n\n setTag(\"organization.slug\", orgSlug);\n const [issue] = await apiService.listIssues({\n organizationSlug: orgSlug,\n query: params.eventId,\n });\n if (!issue) {\n return `# Event Not Found\\n\\nNo issue found for Event ID: ${params.eventId}`;\n }\n const event = await apiService.getEventForIssue({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n eventId: params.eventId,\n });\n return formatIssueOutput({\n organizationSlug: orgSlug,\n issue,\n event,\n apiService,\n });\n }\n\n // Validate that we have the minimum required parameters\n if (!params.issueUrl && !params.issueId) {\n throw new UserInputError(\n \"Either `issueId` or `issueUrl` must be provided\",\n );\n }\n\n if (!params.issueUrl && !params.organizationSlug) {\n throw new UserInputError(\n \"`organizationSlug` is required when providing `issueId`\",\n );\n }\n\n const { organizationSlug: orgSlug, issueId: parsedIssueId } =\n parseIssueParams({\n organizationSlug: params.organizationSlug,\n issueId: params.issueId,\n issueUrl: params.issueUrl,\n });\n\n setTag(\"organization.slug\", orgSlug);\n\n const issue = await apiService.getIssue({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n });\n const event = await apiService.getLatestEventForIssue({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n });\n return formatIssueOutput({\n organizationSlug: orgSlug,\n issue,\n event,\n apiService,\n });\n },\n});\n"],"mappings":";;;;;;;;;;AAcA,gCAAe,WAAW;CACxB,M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,EAAC;EACF,MAAM,QAAQ,MAAM,WAAW,uBAAuB;GACpD,kBAAkB;GAClB,SAAS,MAAM;EAChB,EAAC;AACF,SAAO,kBAAkB;GACvB,kBAAkB;GAClB;GACA;GACA;EACD,EAAC;CACH;AACF,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-issue-details-qGwu18JX.cjs","names":["context: ServerContext","orgSlug","UserInputError","issue","event"],"sources":["../src/tools/get-issue-details.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext } from \"./utils/api-utils\";\nimport { parseIssueParams, formatIssueOutput } from \"./utils/issue-utils\";\nimport { UserInputError } from \"../errors\";\nimport type { ServerContext } from \"../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamIssueShortId,\n ParamIssueUrl,\n} from \"../schema\";\n\nexport default defineTool({\n name: \"get_issue_details\",\n description: [\n \"Retrieve issue details from Sentry for a specific Issue ID, including the stacktrace and error message if available. Either issueId or issueUrl MUST be provided.\",\n \"\",\n \"**NOTE: If the user asks HOW TO FIX an issue, use `analyze_issue_with_seer` instead!**\",\n \"\",\n \"Use this tool when you need to:\",\n \"- View error details, stacktraces, and metadata\",\n \"- Investigate when/where an error occurred\",\n \"- Access raw error information from Sentry\",\n \"\",\n \"Do NOT use this tool when:\",\n '- User asks \"how do I fix this?\" → Use `analyze_issue_with_seer`',\n \"- User wants root cause analysis → Use `analyze_issue_with_seer`\",\n \"- User needs code fixes → Use `analyze_issue_with_seer`\",\n \"\",\n \"<examples>\",\n \"### Get details for issue ID 'CLOUDFLARE-MCP-41'\",\n \"\",\n \"```\",\n \"get_issue_details(organizationSlug='my-organization', issueId='CLOUDFLARE-MCP-41')\",\n \"```\",\n \"\",\n \"### Get details for event ID 'c49541c747cb4d8aa3efb70ca5aba243'\",\n \"\",\n \"```\",\n \"get_issue_details(organizationSlug='my-organization', eventId='c49541c747cb4d8aa3efb70ca5aba243')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user provides the `issueUrl`, you can ignore the other parameters.\",\n \"- If the user provides `issueId` or `eventId` (only one is needed), `organizationSlug` is required.\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug.optional(),\n regionUrl: ParamRegionUrl.optional(),\n issueId: ParamIssueShortId.optional(),\n eventId: z.string().trim().describe(\"The ID of the event.\").optional(),\n issueUrl: ParamIssueUrl.optional(),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n\n if (params.eventId) {\n const orgSlug = params.organizationSlug;\n if (!orgSlug) {\n throw new UserInputError(\n \"`organizationSlug` is required when providing `eventId`\",\n );\n }\n\n setTag(\"organization.slug\", orgSlug);\n const [issue] = await apiService.listIssues({\n organizationSlug: orgSlug,\n query: params.eventId,\n });\n if (!issue) {\n return `# Event Not Found\\n\\nNo issue found for Event ID: ${params.eventId}`;\n }\n const event = await apiService.getEventForIssue({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n eventId: params.eventId,\n });\n return formatIssueOutput({\n organizationSlug: orgSlug,\n issue,\n event,\n apiService,\n });\n }\n\n // Validate that we have the minimum required parameters\n if (!params.issueUrl && !params.issueId) {\n throw new UserInputError(\n \"Either `issueId` or `issueUrl` must be provided\",\n );\n }\n\n if (!params.issueUrl && !params.organizationSlug) {\n throw new UserInputError(\n \"`organizationSlug` is required when providing `issueId`\",\n );\n }\n\n const { organizationSlug: orgSlug, issueId: parsedIssueId } =\n parseIssueParams({\n organizationSlug: params.organizationSlug,\n issueId: params.issueId,\n issueUrl: params.issueUrl,\n });\n\n setTag(\"organization.slug\", orgSlug);\n\n const issue = await apiService.getIssue({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n });\n const event = await apiService.getLatestEventForIssue({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n });\n return formatIssueOutput({\n organizationSlug: orgSlug,\n issue,\n event,\n apiService,\n });\n },\n});\n"],"mappings":";;;;;;;;;;;AAcA,gCAAe,8BAAW;CACxB,MAAM;CACN,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkB,qCAAsB,UAAU;EAClD,WAAW,8BAAe,UAAU;EACpC,SAAS,iCAAkB,UAAU;EACrC,SAAS,MAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,uBAAuB,CAAC,UAAU;EACtE,UAAU,6BAAc,UAAU;CACnC;CACD,MAAM,QAAQ,QAAQA,SAAwB;EAC5C,MAAM,aAAa,wCAAsB,SAAS,EAChD,WAAW,OAAO,UACnB,EAAC;AAEF,MAAI,OAAO,SAAS;GAClB,MAAMC,YAAU,OAAO;AACvB,QAAKA,UACH,OAAM,IAAIC,8BACR;AAIJ,6BAAO,qBAAqBD,UAAQ;GACpC,MAAM,CAACE,QAAM,GAAG,MAAM,WAAW,WAAW;IAC1C,kBAAkBF;IAClB,OAAO,OAAO;GACf,EAAC;AACF,QAAKE,QACH,SAAQ,oDAAoD,OAAO;GAErE,MAAMC,UAAQ,MAAM,WAAW,iBAAiB;IAC9C,kBAAkBH;IAClB,SAASE,QAAM;IACf,SAAS,OAAO;GACjB,EAAC;AACF,UAAO,qCAAkB;IACvB,kBAAkBF;IAClB;IACA;IACA;GACD,EAAC;EACH;AAGD,OAAK,OAAO,aAAa,OAAO,QAC9B,OAAM,IAAIC,8BACR;AAIJ,OAAK,OAAO,aAAa,OAAO,iBAC9B,OAAM,IAAIA,8BACR;EAIJ,MAAM,EAAE,kBAAkB,SAAS,SAAS,eAAe,GACzD,uCAAiB;GACf,kBAAkB,OAAO;GACzB,SAAS,OAAO;GAChB,UAAU,OAAO;EAClB,EAAC;AAEJ,4BAAO,qBAAqB,QAAQ;EAEpC,MAAM,QAAQ,MAAM,WAAW,SAAS;GACtC,kBAAkB;GAClB,SAAS;EACV,EAAC;EACF,MAAM,QAAQ,MAAM,WAAW,uBAAuB;GACpD,kBAAkB;GAClB,SAAS,MAAM;EAChB,EAAC;AACF,SAAO,qCAAkB;GACvB,kBAAkB;GAClB;GACA;GACA;EACD,EAAC;CACH;AACF,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"promptDefinitions-6xelipaz.d.ts","names":[],"sources":["../src/promptDefinitions.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAoCa;;;;sBAuBZ,CAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"search-docs-CrMdRDJy.js","names":["context: ServerContext"],"sources":["../src/tools/search-docs.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { fetchWithTimeout } from \"./utils/fetch-utils\";\nimport { ApiError } from \"../api-client/index\";\nimport type { ServerContext } from \"../types\";\nimport type { SearchResponse } from \"./types\";\nimport { ParamSentryGuide } from \"../schema\";\n\nexport default defineTool({\n name: \"search_docs\",\n description: [\n \"Search Sentry documentation for SDK setup, instrumentation, and configuration guidance.\",\n \"\",\n \"Use this tool when you need to:\",\n \"- Set up Sentry SDK in any language (Python, JavaScript, Go, Ruby, etc.)\",\n \"- Configure specific features like performance monitoring, error sampling, or release tracking\",\n \"- Implement custom instrumentation (spans, transactions, breadcrumbs)\",\n \"- Set up integrations with frameworks (Django, Flask, Express, Next.js, etc.)\",\n \"- Configure data scrubbing, filtering, or sampling rules\",\n \"- Troubleshoot SDK issues or find best practices\",\n \"\",\n \"This tool searches technical documentation, NOT general information about Sentry as a company.\",\n \"\",\n \"<examples>\",\n \"### Setting up Sentry in a Python Django app\",\n \"\",\n \"```\",\n \"search_docs(query='Django setup configuration SENTRY_DSN', guide='python/django')\",\n \"```\",\n \"\",\n \"### Setting up source maps for Next.js\",\n \"\",\n \"```\",\n \"search_docs(query='source maps webpack upload', guide='javascript/nextjs')\",\n \"```\",\n \"\",\n \"### Configuring release tracking\",\n \"\",\n \"```\",\n \"search_docs(query='release tracking deployment integration CI/CD')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- Use guide parameter to filter results to specific technologies (e.g., 'javascript' or 'javascript/nextjs')\",\n \"- Include the programming language/framework in your query for SDK-specific results\",\n \"- Use technical terms like 'instrumentation', 'spans', 'transactions' for performance docs\",\n \"- Include specific feature names like 'beforeSend', 'tracesSampleRate', 'SENTRY_DSN'\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n query: z\n .string()\n .trim()\n .min(\n 2,\n \"Search query is too short. Please provide at least 2 characters.\",\n )\n .max(\n 200,\n \"Search query is too long. Please keep your query under 200 characters.\",\n )\n .describe(\n \"The search query in natural language. Be specific about what you're looking for.\",\n ),\n maxResults: z\n .number()\n .int()\n .min(1)\n .max(10)\n .default(3)\n .describe(\"Maximum number of results to return (1-10)\")\n .optional(),\n guide: ParamSentryGuide.optional(),\n },\n async handler(params, context: ServerContext) {\n let output = `# Documentation Search Results\\n\\n`;\n output += `**Query**: \"${params.query}\"\\n`;\n if (params.guide) {\n output += `**Guide**: ${params.guide}\\n`;\n }\n output += `\\n`;\n\n // Determine the host - use context.host if available, then check env var, otherwise default to production\n const host = context.mcpHost || \"https://mcp.sentry.dev\";\n const searchUrl = new URL(\"/api/search\", host);\n\n const response = await fetchWithTimeout(\n searchUrl.toString(),\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n query: params.query,\n maxResults: params.maxResults,\n guide: params.guide,\n }),\n },\n 15000, // 15 second timeout\n );\n\n if (!response.ok) {\n // TODO: improve error responses with types\n const errorData = (await response.json().catch(() => null)) as {\n error?: string;\n } | null;\n\n const errorMessage =\n errorData?.error || `Search failed with status ${response.status}`;\n throw new ApiError(errorMessage, response.status);\n }\n\n const data = (await response.json()) as SearchResponse;\n\n // Handle error in response\n if (\"error\" in data && data.error) {\n output += `**Error**: ${data.error}\\n\\n`;\n return output;\n }\n\n // Display results\n if (data.results.length === 0) {\n output += \"No documentation found matching your query.\\n\\n\";\n return output;\n }\n\n output += `Found ${data.results.length} match${data.results.length === 1 ? \"\" : \"es\"}\\n\\n`;\n\n output += `These are just snippets. Use \\`get_doc(path='...')\\` to fetch the full content.\\n\\n`;\n\n for (const [index, result] of data.results.entries()) {\n output += `## ${index + 1}. ${result.url}\\n\\n`;\n output += `**Path**: ${result.id}\\n`;\n output += `**Relevance**: ${(result.relevance * 100).toFixed(1)}%\\n\\n`;\n if (index < 3) {\n output += \"**Matching Context**\\n\";\n output += `> ${result.snippet.replace(/\\n/g, \"\\n> \")}\\n\\n`;\n }\n }\n\n return output;\n },\n});\n"],"mappings":";;;;;;;AAQA,0BAAe,WAAW;CACxB,MAAM;CACN,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,OAAO,EACJ,QAAQ,CACR,MAAM,CACN,IACC,GACA,mEACD,CACA,IACC,KACA,yEACD,CACA,SACC,mFACD;EACH,YAAY,EACT,QAAQ,CACR,KAAK,CACL,IAAI,EAAE,CACN,IAAI,GAAG,CACP,QAAQ,EAAE,CACV,SAAS,6CAA6C,CACtD,UAAU;EACb,OAAO,iBAAiB,UAAU;CACnC;CACD,MAAM,QAAQ,QAAQA,SAAwB;EAC5C,IAAI,UAAU;AACd,aAAW,cAAc,OAAO,MAAM;AACtC,MAAI,OAAO,MACT,YAAW,aAAa,OAAO,MAAM;AAEvC,aAAW;EAGX,MAAM,OAAO,QAAQ,WAAW;EAChC,MAAM,YAAY,IAAI,IAAI,eAAe;EAEzC,MAAM,WAAW,MAAM,iBACrB,UAAU,UAAU,EACpB;GACE,QAAQ;GACR,SAAS,EACP,gBAAgB,mBACjB;GACD,MAAM,KAAK,UAAU;IACnB,OAAO,OAAO;IACd,YAAY,OAAO;IACnB,OAAO,OAAO;GACf,EAAC;EACH,GACD,KACD;AAED,OAAK,SAAS,IAAI;GAEhB,MAAM,YAAa,MAAM,SAAS,MAAM,CAAC,MAAM,MAAM,KAAK;GAI1D,MAAM,eACJ,WAAW,UAAU,4BAA4B,SAAS;AAC5D,SAAM,IAAI,SAAS,cAAc,SAAS;EAC3C;EAED,MAAM,OAAQ,MAAM,SAAS,MAAM;AAGnC,MAAI,WAAW,QAAQ,KAAK,OAAO;AACjC,cAAW,aAAa,KAAK,MAAM;AACnC,UAAO;EACR;AAGD,MAAI,KAAK,QAAQ,WAAW,GAAG;AAC7B,aAAU;AACV,UAAO;EACR;AAED,aAAW,QAAQ,KAAK,QAAQ,OAAO,QAAQ,KAAK,QAAQ,WAAW,IAAI,KAAK,KAAK;AAErF,aAAW;AAEX,OAAK,MAAM,CAAC,OAAO,OAAO,IAAI,KAAK,QAAQ,SAAS,EAAE;AACpD,cAAW,KAAK,QAAQ,EAAE,IAAI,OAAO,IAAI;AACzC,cAAW,YAAY,OAAO,GAAG;AACjC,cAAW,iBAAiB,CAAC,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;AAChE,OAAI,QAAQ,GAAG;AACb,cAAU;AACV,eAAW,IAAI,OAAO,QAAQ,QAAQ,OAAO,OAAO,CAAC;GACtD;EACF;AAED,SAAO;CACR;AACF,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"search-docs-VhefTOOH.cjs","names":["context: ServerContext","ApiError"],"sources":["../src/tools/search-docs.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { fetchWithTimeout } from \"./utils/fetch-utils\";\nimport { ApiError } from \"../api-client/index\";\nimport type { ServerContext } from \"../types\";\nimport type { SearchResponse } from \"./types\";\nimport { ParamSentryGuide } from \"../schema\";\n\nexport default defineTool({\n name: \"search_docs\",\n description: [\n \"Search Sentry documentation for SDK setup, instrumentation, and configuration guidance.\",\n \"\",\n \"Use this tool when you need to:\",\n \"- Set up Sentry SDK in any language (Python, JavaScript, Go, Ruby, etc.)\",\n \"- Configure specific features like performance monitoring, error sampling, or release tracking\",\n \"- Implement custom instrumentation (spans, transactions, breadcrumbs)\",\n \"- Set up integrations with frameworks (Django, Flask, Express, Next.js, etc.)\",\n \"- Configure data scrubbing, filtering, or sampling rules\",\n \"- Troubleshoot SDK issues or find best practices\",\n \"\",\n \"This tool searches technical documentation, NOT general information about Sentry as a company.\",\n \"\",\n \"<examples>\",\n \"### Setting up Sentry in a Python Django app\",\n \"\",\n \"```\",\n \"search_docs(query='Django setup configuration SENTRY_DSN', guide='python/django')\",\n \"```\",\n \"\",\n \"### Setting up source maps for Next.js\",\n \"\",\n \"```\",\n \"search_docs(query='source maps webpack upload', guide='javascript/nextjs')\",\n \"```\",\n \"\",\n \"### Configuring release tracking\",\n \"\",\n \"```\",\n \"search_docs(query='release tracking deployment integration CI/CD')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- Use guide parameter to filter results to specific technologies (e.g., 'javascript' or 'javascript/nextjs')\",\n \"- Include the programming language/framework in your query for SDK-specific results\",\n \"- Use technical terms like 'instrumentation', 'spans', 'transactions' for performance docs\",\n \"- Include specific feature names like 'beforeSend', 'tracesSampleRate', 'SENTRY_DSN'\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n query: z\n .string()\n .trim()\n .min(\n 2,\n \"Search query is too short. Please provide at least 2 characters.\",\n )\n .max(\n 200,\n \"Search query is too long. Please keep your query under 200 characters.\",\n )\n .describe(\n \"The search query in natural language. Be specific about what you're looking for.\",\n ),\n maxResults: z\n .number()\n .int()\n .min(1)\n .max(10)\n .default(3)\n .describe(\"Maximum number of results to return (1-10)\")\n .optional(),\n guide: ParamSentryGuide.optional(),\n },\n async handler(params, context: ServerContext) {\n let output = `# Documentation Search Results\\n\\n`;\n output += `**Query**: \"${params.query}\"\\n`;\n if (params.guide) {\n output += `**Guide**: ${params.guide}\\n`;\n }\n output += `\\n`;\n\n // Determine the host - use context.host if available, then check env var, otherwise default to production\n const host = context.mcpHost || \"https://mcp.sentry.dev\";\n const searchUrl = new URL(\"/api/search\", host);\n\n const response = await fetchWithTimeout(\n searchUrl.toString(),\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n query: params.query,\n maxResults: params.maxResults,\n guide: params.guide,\n }),\n },\n 15000, // 15 second timeout\n );\n\n if (!response.ok) {\n // TODO: improve error responses with types\n const errorData = (await response.json().catch(() => null)) as {\n error?: string;\n } | null;\n\n const errorMessage =\n errorData?.error || `Search failed with status ${response.status}`;\n throw new ApiError(errorMessage, response.status);\n }\n\n const data = (await response.json()) as SearchResponse;\n\n // Handle error in response\n if (\"error\" in data && data.error) {\n output += `**Error**: ${data.error}\\n\\n`;\n return output;\n }\n\n // Display results\n if (data.results.length === 0) {\n output += \"No documentation found matching your query.\\n\\n\";\n return output;\n }\n\n output += `Found ${data.results.length} match${data.results.length === 1 ? \"\" : \"es\"}\\n\\n`;\n\n output += `These are just snippets. Use \\`get_doc(path='...')\\` to fetch the full content.\\n\\n`;\n\n for (const [index, result] of data.results.entries()) {\n output += `## ${index + 1}. ${result.url}\\n\\n`;\n output += `**Path**: ${result.id}\\n`;\n output += `**Relevance**: ${(result.relevance * 100).toFixed(1)}%\\n\\n`;\n if (index < 3) {\n output += \"**Matching Context**\\n\";\n output += `> ${result.snippet.replace(/\\n/g, \"\\n> \")}\\n\\n`;\n }\n }\n\n return output;\n },\n});\n"],"mappings":";;;;;;;;AAQA,0BAAe,8BAAW;CACxB,MAAM;CACN,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAC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EX,OAAK,MAAM,CAAC,OAAO,OAAO,IAAI,KAAK,QAAQ,SAAS,EAAE;AACpD,cAAW,KAAK,QAAQ,EAAE,IAAI,OAAO,IAAI;AACzC,cAAW,YAAY,OAAO,GAAG;AACjC,cAAW,iBAAiB,CAAC,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;AAChE,OAAI,QAAQ,GAAG;AACb,cAAU;AACV,eAAW,IAAI,OAAO,QAAQ,QAAQ,OAAO,OAAO,CAAC;GACtD;EACF;AAED,SAAO;CACR;AACF,EAAC"}
@@ -1,6 +0,0 @@
1
- //#region src/version.ts
2
- const LIB_VERSION = typeof process !== "undefined" && "0.13.0" || "0.0.0";
3
-
4
- //#endregion
5
- export { LIB_VERSION };
6
- //# sourceMappingURL=version-DvMKCu-i.js.map