@sentry/mcp-server 0.14.0 → 0.16.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.
- package/dist/{analyze-issue-with-seer-DbAWpyTC.cjs → analyze-issue-with-seer-B8ZWokLV.cjs} +57 -24
- package/dist/analyze-issue-with-seer-B8ZWokLV.cjs.map +1 -0
- package/dist/{analyze-issue-with-seer-BsNarzJN.js → analyze-issue-with-seer-szIqv1_I.js} +57 -24
- package/dist/analyze-issue-with-seer-szIqv1_I.js.map +1 -0
- package/dist/api-client/client.cjs +2 -1
- package/dist/api-client/client.d.cts +3 -3
- package/dist/api-client/client.d.ts +3 -3
- package/dist/api-client/client.js +2 -1
- package/dist/api-client/index.cjs +2 -1
- package/dist/api-client/index.d.cts +3 -3
- package/dist/api-client/index.d.ts +3 -3
- package/dist/api-client/index.js +2 -1
- package/dist/api-client/schema.d.cts +1 -1
- package/dist/api-client/schema.d.ts +1 -1
- package/dist/api-client/types.d.cts +2 -2
- package/dist/api-client/types.d.ts +2 -2
- package/dist/api-utils-B-9vnzoA.cjs +86 -0
- package/dist/api-utils-B-9vnzoA.cjs.map +1 -0
- package/dist/api-utils-CHRiLf2Y.js +69 -0
- package/dist/api-utils-CHRiLf2Y.js.map +1 -0
- package/dist/{client-Dkw5iYu3.cjs → client-C_lwH0jz.cjs} +102 -51
- package/dist/client-C_lwH0jz.cjs.map +1 -0
- package/dist/{client-CILwfx6G.d.cts → client-D8vrUp2k.d.cts} +39 -7
- package/dist/client-D8vrUp2k.d.cts.map +1 -0
- package/dist/{client-BCN17Wbp.d.ts → client-h32L1Hx5.d.ts} +39 -7
- package/dist/client-h32L1Hx5.d.ts.map +1 -0
- package/dist/{client-DOYWNvVM.js → client-pyNUFaLN.js} +102 -51
- package/dist/client-pyNUFaLN.js.map +1 -0
- package/dist/{create-dsn-CDcL2DLD.js → create-dsn-CEEytIa4.js} +2 -2
- package/dist/{create-dsn-CDcL2DLD.js.map → create-dsn-CEEytIa4.js.map} +1 -1
- package/dist/{create-dsn-fESUtX3R.cjs → create-dsn-CI7MSiQu.cjs} +2 -2
- package/dist/{create-dsn-fESUtX3R.cjs.map → create-dsn-CI7MSiQu.cjs.map} +1 -1
- package/dist/{create-project-DY5mFznV.js → create-project-CoV1e-vp.js} +3 -3
- package/dist/{create-project-DY5mFznV.js.map → create-project-CoV1e-vp.js.map} +1 -1
- package/dist/{create-project-Bg5uDkc4.cjs → create-project-DnLKRG1p.cjs} +3 -3
- package/dist/{create-project-Bg5uDkc4.cjs.map → create-project-DnLKRG1p.cjs.map} +1 -1
- package/dist/{create-team-5purh64V.cjs → create-team-DKpKxVIY.cjs} +2 -2
- package/dist/{create-team-5purh64V.cjs.map → create-team-DKpKxVIY.cjs.map} +1 -1
- package/dist/{create-team-C2R7EUC3.js → create-team-HWN88CJQ.js} +2 -2
- package/dist/{create-team-C2R7EUC3.js.map → create-team-HWN88CJQ.js.map} +1 -1
- package/dist/errors-BtJEw2Z-.cjs +38 -0
- package/dist/errors-BtJEw2Z-.cjs.map +1 -0
- package/dist/errors-D_R568zP.js +26 -0
- package/dist/errors-D_R568zP.js.map +1 -0
- package/dist/errors.cjs +2 -1
- package/dist/errors.d.cts +10 -2
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.ts +10 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -2
- package/dist/fetch-utils-B0CB5xLM.d.ts +33 -0
- package/dist/fetch-utils-B0CB5xLM.d.ts.map +1 -0
- package/dist/fetch-utils-CTLoW1R8.d.cts +33 -0
- package/dist/fetch-utils-CTLoW1R8.d.cts.map +1 -0
- package/dist/fetch-utils-SuGtrQRz.cjs +64 -0
- package/dist/fetch-utils-SuGtrQRz.cjs.map +1 -0
- package/dist/fetch-utils-gHZdOZV2.js +52 -0
- package/dist/fetch-utils-gHZdOZV2.js.map +1 -0
- package/dist/{find-dsns-CvfcLB9Z.js → find-dsns-BB9dQP0b.js} +2 -2
- package/dist/{find-dsns-CvfcLB9Z.js.map → find-dsns-BB9dQP0b.js.map} +1 -1
- package/dist/{find-dsns-ZZ-thiNk.cjs → find-dsns-vriZSwr7.cjs} +2 -2
- package/dist/{find-dsns-ZZ-thiNk.cjs.map → find-dsns-vriZSwr7.cjs.map} +1 -1
- package/dist/{find-errors-Drzv7hzM.cjs → find-errors-BQFHuBHi.cjs} +6 -3
- package/dist/find-errors-BQFHuBHi.cjs.map +1 -0
- package/dist/{find-errors-CuRm4PzL.js → find-errors-CSPsT-Jp.js} +6 -3
- package/dist/find-errors-CSPsT-Jp.js.map +1 -0
- package/dist/{find-issues-C3uk59rn.cjs → find-issues-BG80wLZw.cjs} +7 -4
- package/dist/find-issues-BG80wLZw.cjs.map +1 -0
- package/dist/{find-issues-CAtNGBly.js → find-issues-DoUD8vP0.js} +7 -4
- package/dist/find-issues-DoUD8vP0.js.map +1 -0
- package/dist/{find-organizations-ojXwWWzk.js → find-organizations-BILg1hUb.js} +3 -3
- package/dist/find-organizations-BILg1hUb.js.map +1 -0
- package/dist/{find-organizations-BrdMfZRO.cjs → find-organizations-Cx5vCj4j.cjs} +3 -3
- package/dist/find-organizations-Cx5vCj4j.cjs.map +1 -0
- package/dist/{find-projects-BZWhlYJh.cjs → find-projects-CN99WBex.cjs} +3 -3
- package/dist/{find-projects-BZWhlYJh.cjs.map → find-projects-CN99WBex.cjs.map} +1 -1
- package/dist/{find-projects-fcLG4KpT.js → find-projects-CgCj2_eq.js} +3 -3
- package/dist/{find-projects-fcLG4KpT.js.map → find-projects-CgCj2_eq.js.map} +1 -1
- package/dist/{find-releases-BUozr0Z-.js → find-releases-BsQF3wc5.js} +2 -2
- package/dist/{find-releases-BUozr0Z-.js.map → find-releases-BsQF3wc5.js.map} +1 -1
- package/dist/{find-releases-CZCVEOHZ.cjs → find-releases-Cm11xU5S.cjs} +2 -2
- package/dist/{find-releases-CZCVEOHZ.cjs.map → find-releases-Cm11xU5S.cjs.map} +1 -1
- package/dist/{find-tags-d-wF1Se8.js → find-tags-BRaa2i-r.js} +2 -2
- package/dist/{find-tags-d-wF1Se8.js.map → find-tags-BRaa2i-r.js.map} +1 -1
- package/dist/{find-tags-Byk4d3oZ.cjs → find-tags-BjibTJBm.cjs} +2 -2
- package/dist/{find-tags-Byk4d3oZ.cjs.map → find-tags-BjibTJBm.cjs.map} +1 -1
- package/dist/{find-teams-CnU5x9rQ.cjs → find-teams-CS443jRa.cjs} +3 -3
- package/dist/{find-teams-CnU5x9rQ.cjs.map → find-teams-CS443jRa.cjs.map} +1 -1
- package/dist/{find-teams-BZ118EIK.js → find-teams-XgUg8Nj5.js} +3 -3
- package/dist/{find-teams-BZ118EIK.js.map → find-teams-XgUg8Nj5.js.map} +1 -1
- package/dist/{find-transactions-DIJ80wkd.cjs → find-transactions-B0s_rr0H.cjs} +2 -2
- package/dist/{find-transactions-DIJ80wkd.cjs.map → find-transactions-B0s_rr0H.cjs.map} +1 -1
- package/dist/{find-transactions-DZCj81jP.js → find-transactions-Cob_B_3u.js} +2 -2
- package/dist/{find-transactions-DZCj81jP.js.map → find-transactions-Cob_B_3u.js.map} +1 -1
- package/dist/{formatting-BlMiQa9i.cjs → formatting-AXU4XsjJ.cjs} +33 -2
- package/dist/formatting-AXU4XsjJ.cjs.map +1 -0
- package/dist/{formatting-CHh9Q_OW.d.cts → formatting-DnSI0DHf.d.ts} +7 -5
- package/dist/formatting-DnSI0DHf.d.ts.map +1 -0
- package/dist/{formatting-pUm38KOj.js → formatting-WGc5qrhv.js} +34 -2
- package/dist/formatting-WGc5qrhv.js.map +1 -0
- package/dist/{formatting-kdIeURER.d.ts → formatting-aGQ7M_2w.d.cts} +7 -5
- package/dist/formatting-aGQ7M_2w.d.cts.map +1 -0
- package/dist/{formatting-utils-C3sej5ER.js → formatting-utils-DgOyTl-m.js} +1 -1
- package/dist/{formatting-utils-C3sej5ER.js.map → formatting-utils-DgOyTl-m.js.map} +1 -1
- package/dist/{formatting-utils-DDz14xeB.cjs → formatting-utils-m9R5bsRU.cjs} +1 -1
- package/dist/{formatting-utils-DDz14xeB.cjs.map → formatting-utils-m9R5bsRU.cjs.map} +1 -1
- package/dist/{get-doc-DaTCenOE.cjs → get-doc-ByXR3EWc.cjs} +4 -4
- package/dist/{get-doc-DaTCenOE.cjs.map → get-doc-ByXR3EWc.cjs.map} +1 -1
- package/dist/{get-doc-YTiQznr1.js → get-doc-C1IEG2pH.js} +4 -4
- package/dist/{get-doc-YTiQznr1.js.map → get-doc-C1IEG2pH.js.map} +1 -1
- package/dist/{get-event-attachment-ChRw3jlQ.cjs → get-event-attachment-CuGUfVAD.cjs} +2 -2
- package/dist/{get-event-attachment-ChRw3jlQ.cjs.map → get-event-attachment-CuGUfVAD.cjs.map} +1 -1
- package/dist/{get-event-attachment-CuU-_5T6.js → get-event-attachment-N11gSV23.js} +2 -2
- package/dist/{get-event-attachment-CuU-_5T6.js.map → get-event-attachment-N11gSV23.js.map} +1 -1
- package/dist/{get-issue-details-CxChU4U9.js → get-issue-details-BrEGybe0.js} +30 -14
- package/dist/get-issue-details-BrEGybe0.js.map +1 -0
- package/dist/{get-issue-details-DFwZRbmU.cjs → get-issue-details-EklkHsWi.cjs} +30 -14
- package/dist/get-issue-details-EklkHsWi.cjs.map +1 -0
- package/dist/index.cjs +37 -37
- package/dist/index.js +37 -37
- package/dist/internal/fetch-utils.cjs +3 -2
- package/dist/internal/fetch-utils.d.cts +2 -2
- package/dist/internal/fetch-utils.d.ts +2 -2
- package/dist/internal/fetch-utils.js +2 -2
- package/dist/internal/formatting.cjs +2 -1
- package/dist/internal/formatting.d.cts +4 -4
- package/dist/internal/formatting.d.ts +4 -4
- package/dist/internal/formatting.js +2 -1
- package/dist/internal/issue-helpers.cjs +2 -1
- package/dist/internal/issue-helpers.js +2 -1
- package/dist/internal/test-fixtures.d.cts +38 -38
- package/dist/internal/test-fixtures.d.cts.map +1 -1
- package/dist/internal/test-fixtures.d.ts +170 -170
- package/dist/internal/test-fixtures.d.ts.map +1 -1
- package/dist/issue-helpers-BJffpNoO.d.ts.map +1 -1
- package/dist/issue-helpers-Cz01Ipvl.d.cts.map +1 -1
- package/dist/{issue-helpers-CqqYnwYE.js → issue-helpers-D2p1Gkgm.js} +15 -19
- package/dist/issue-helpers-D2p1Gkgm.js.map +1 -0
- package/dist/{issue-helpers-DyAIO0w6.cjs → issue-helpers-DvsTfq9u.cjs} +14 -19
- package/dist/issue-helpers-DvsTfq9u.cjs.map +1 -0
- package/dist/{logging-oIouXrcb.cjs → logging-CX2buXiG.cjs} +1 -1
- package/dist/{logging-oIouXrcb.cjs.map → logging-CX2buXiG.cjs.map} +1 -1
- package/dist/{logging-LnQMFw-_.js → logging-DzxYBMrn.js} +1 -1
- package/dist/{logging-LnQMFw-_.js.map → logging-DzxYBMrn.js.map} +1 -1
- package/dist/logging.cjs +1 -1
- package/dist/logging.js +1 -1
- package/dist/{prompts-C8Y9w5c4.js → prompts-Cuwmybyc.js} +2 -2
- package/dist/{prompts-C8Y9w5c4.js.map → prompts-Cuwmybyc.js.map} +1 -1
- package/dist/{prompts-Df3i1XSB.cjs → prompts-uWAbMvLe.cjs} +2 -2
- package/dist/{prompts-Df3i1XSB.cjs.map → prompts-uWAbMvLe.cjs.map} +1 -1
- package/dist/prompts.cjs +2 -2
- package/dist/prompts.js +2 -2
- package/dist/{resources-BM_YQGcb.cjs → resources-BlgeiG6C.cjs} +2 -2
- package/dist/{resources-BM_YQGcb.cjs.map → resources-BlgeiG6C.cjs.map} +1 -1
- package/dist/{resources-BHF8a1ZB.js → resources-CwWOjB8_.js} +2 -2
- package/dist/{resources-BHF8a1ZB.js.map → resources-CwWOjB8_.js.map} +1 -1
- package/dist/resources.cjs +2 -2
- package/dist/resources.js +2 -2
- package/dist/{schema--5m4KI84.d.ts → schema-BW_fxx99.d.cts} +559 -559
- package/dist/{schema-ya35hkEL.d.cts.map → schema-BW_fxx99.d.cts.map} +1 -1
- package/dist/{schema-ya35hkEL.d.cts → schema-DkWOa2-c.d.ts} +428 -428
- package/dist/{schema--5m4KI84.d.ts.map → schema-DkWOa2-c.d.ts.map} +1 -1
- package/dist/{search-docs-BLbB_GV2.js → search-docs-BKUeMSyn.js} +3 -3
- package/dist/{search-docs-BLbB_GV2.js.map → search-docs-BKUeMSyn.js.map} +1 -1
- package/dist/{search-docs-D5Foht_0.cjs → search-docs-Cr-gyE5m.cjs} +3 -3
- package/dist/{search-docs-D5Foht_0.cjs.map → search-docs-Cr-gyE5m.cjs.map} +1 -1
- package/dist/{seer-utils-Ckr8nYlz.js → seer-utils-BdE7DddW.js} +5 -3
- package/dist/seer-utils-BdE7DddW.js.map +1 -0
- package/dist/{seer-utils-CzYEEZb2.cjs → seer-utils-BvdVTH85.cjs} +16 -2
- package/dist/seer-utils-BvdVTH85.cjs.map +1 -0
- package/dist/{server-BpEIZVaZ.cjs → server-9IEGGN8V.cjs} +41 -25
- package/dist/{server-DOy-M9Ko.js.map → server-9IEGGN8V.cjs.map} +1 -1
- package/dist/{server-DOy-M9Ko.js → server-BhNrW6bw.js} +41 -25
- package/dist/server-BhNrW6bw.js.map +1 -0
- package/dist/server.cjs +34 -34
- package/dist/server.d.cts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +34 -34
- package/dist/{stdio-B2NDq7Ax.js → stdio-CQmibRBR.js} +3 -3
- package/dist/{stdio-B2NDq7Ax.js.map → stdio-CQmibRBR.js.map} +1 -1
- package/dist/{stdio-DMEgJ_fG.cjs → stdio-mw-fEjO4.cjs} +3 -3
- package/dist/{stdio-DMEgJ_fG.cjs.map → stdio-mw-fEjO4.cjs.map} +1 -1
- package/dist/test-setup.cjs +1 -16
- package/dist/test-setup.cjs.map +1 -1
- package/dist/test-setup.js +1 -16
- package/dist/test-setup.js.map +1 -1
- package/dist/toolDefinitions.js +2 -2
- package/dist/tools/analyze-issue-with-seer.cjs +9 -8
- package/dist/tools/analyze-issue-with-seer.js +9 -8
- package/dist/tools/create-dsn.cjs +4 -4
- package/dist/tools/create-dsn.js +4 -4
- package/dist/tools/create-project.cjs +5 -5
- package/dist/tools/create-project.js +5 -5
- package/dist/tools/create-team.cjs +4 -4
- package/dist/tools/create-team.js +4 -4
- package/dist/tools/find-dsns.cjs +4 -4
- package/dist/tools/find-dsns.js +4 -4
- package/dist/tools/find-errors.cjs +4 -4
- package/dist/tools/find-errors.js +4 -4
- package/dist/tools/find-issues.cjs +4 -4
- package/dist/tools/find-issues.js +4 -4
- package/dist/tools/find-organizations.cjs +4 -4
- package/dist/tools/find-organizations.js +4 -4
- package/dist/tools/find-projects.cjs +4 -4
- package/dist/tools/find-projects.js +4 -4
- package/dist/tools/find-releases.cjs +4 -4
- package/dist/tools/find-releases.js +4 -4
- package/dist/tools/find-tags.cjs +4 -4
- package/dist/tools/find-tags.js +4 -4
- package/dist/tools/find-teams.cjs +4 -4
- package/dist/tools/find-teams.js +4 -4
- package/dist/tools/find-transactions.cjs +4 -4
- package/dist/tools/find-transactions.js +4 -4
- package/dist/tools/get-doc.cjs +4 -4
- package/dist/tools/get-doc.js +4 -4
- package/dist/tools/get-event-attachment.cjs +4 -4
- package/dist/tools/get-event-attachment.js +4 -4
- package/dist/tools/get-issue-details.cjs +8 -7
- package/dist/tools/get-issue-details.js +8 -7
- package/dist/tools/index.cjs +31 -31
- package/dist/tools/index.d.cts +76 -76
- package/dist/tools/index.d.ts +76 -76
- package/dist/tools/index.js +31 -31
- package/dist/tools/search-docs.cjs +4 -3
- package/dist/tools/search-docs.js +4 -3
- package/dist/tools/update-issue.cjs +9 -8
- package/dist/tools/update-issue.js +9 -8
- package/dist/tools/update-project.cjs +5 -5
- package/dist/tools/update-project.js +5 -5
- package/dist/tools/utils/api-utils.cjs +6 -4
- package/dist/tools/utils/api-utils.d.cts +22 -5
- package/dist/tools/utils/api-utils.d.cts.map +1 -1
- package/dist/tools/utils/api-utils.d.ts +22 -5
- package/dist/tools/utils/api-utils.d.ts.map +1 -1
- package/dist/tools/utils/api-utils.js +4 -4
- package/dist/tools/utils/fetch-utils.cjs +3 -2
- package/dist/tools/utils/fetch-utils.d.cts +2 -2
- package/dist/tools/utils/fetch-utils.d.ts +2 -2
- package/dist/tools/utils/fetch-utils.js +2 -2
- package/dist/tools/utils/formatting-utils.cjs +1 -1
- package/dist/tools/utils/formatting-utils.d.cts +3 -3
- package/dist/tools/utils/formatting-utils.d.ts +3 -3
- package/dist/tools/utils/formatting-utils.js +1 -1
- package/dist/tools/utils/issue-utils.cjs +5 -3
- package/dist/tools/utils/issue-utils.d.cts +4 -4
- package/dist/tools/utils/issue-utils.d.ts +4 -4
- package/dist/tools/utils/issue-utils.js +5 -3
- package/dist/tools/utils/seer-utils.cjs +3 -1
- package/dist/tools/utils/seer-utils.d.cts +6 -4
- package/dist/tools/utils/seer-utils.d.cts.map +1 -1
- package/dist/tools/utils/seer-utils.d.ts +6 -4
- package/dist/tools/utils/seer-utils.d.ts.map +1 -1
- package/dist/tools/utils/seer-utils.js +2 -2
- package/dist/tools/whoami.cjs +4 -4
- package/dist/tools/whoami.js +4 -4
- package/dist/tools-AYbI0sEf.js +48 -0
- package/dist/{tools-mThAUo_3.js.map → tools-AYbI0sEf.js.map} +1 -1
- package/dist/{tools-19Ms1kck.cjs → tools-CwQFlJzn.cjs} +21 -21
- package/dist/{tools-19Ms1kck.cjs.map → tools-CwQFlJzn.cjs.map} +1 -1
- package/dist/transports/stdio.cjs +36 -36
- package/dist/transports/stdio.js +36 -36
- package/dist/{types-Bg17IGWJ.d.cts → types-BAbu4Vzx.d.cts} +2 -2
- package/dist/{types-Bg17IGWJ.d.cts.map → types-BAbu4Vzx.d.cts.map} +1 -1
- package/dist/{types-CtTBwGbw.d.ts → types-CoY5KVni.d.ts} +2 -2
- package/dist/{types-CtTBwGbw.d.ts.map → types-CoY5KVni.d.ts.map} +1 -1
- package/dist/{update-issue-DmLElHPS.js → update-issue-ClbiTLyL.js} +13 -7
- package/dist/update-issue-ClbiTLyL.js.map +1 -0
- package/dist/{update-issue-B6eZhAPJ.cjs → update-issue-_4vzwHfZ.cjs} +13 -7
- package/dist/update-issue-_4vzwHfZ.cjs.map +1 -0
- package/dist/{update-project-CijYCtG1.cjs → update-project-2EEnezbZ.cjs} +4 -4
- package/dist/{update-project-CijYCtG1.cjs.map → update-project-2EEnezbZ.cjs.map} +1 -1
- package/dist/{update-project-BNPev7W8.js → update-project-CExfO7tG.js} +4 -4
- package/dist/{update-project-BNPev7W8.js.map → update-project-CExfO7tG.js.map} +1 -1
- package/dist/version-3e1twbPm.js +6 -0
- package/dist/{version-C4uvMmw0.js.map → version-3e1twbPm.js.map} +1 -1
- package/dist/{version-Ddz4xg_q.cjs → version-Cp9p-38J.cjs} +2 -2
- package/dist/{version-Ddz4xg_q.cjs.map → version-Cp9p-38J.cjs.map} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/{whoami-DesNZnaQ.js → whoami-DhoaHHY5.js} +2 -2
- package/dist/{whoami-DesNZnaQ.js.map → whoami-DhoaHHY5.js.map} +1 -1
- package/dist/{whoami-CEgbTUqt.cjs → whoami-m0N5F6BN.cjs} +2 -2
- package/dist/{whoami-CEgbTUqt.cjs.map → whoami-m0N5F6BN.cjs.map} +1 -1
- package/package.json +3 -3
- package/dist/analyze-issue-with-seer-BsNarzJN.js.map +0 -1
- package/dist/analyze-issue-with-seer-DbAWpyTC.cjs.map +0 -1
- package/dist/api-utils-C6QJAzFL.js +0 -31
- package/dist/api-utils-C6QJAzFL.js.map +0 -1
- package/dist/api-utils-d36iteNO.cjs +0 -36
- package/dist/api-utils-d36iteNO.cjs.map +0 -1
- package/dist/client-BCN17Wbp.d.ts.map +0 -1
- package/dist/client-CILwfx6G.d.cts.map +0 -1
- package/dist/client-DOYWNvVM.js.map +0 -1
- package/dist/client-Dkw5iYu3.cjs.map +0 -1
- package/dist/errors-CIoxzIug.js +0 -15
- package/dist/errors-CIoxzIug.js.map +0 -1
- package/dist/errors-YmiXLOyx.cjs +0 -21
- package/dist/errors-YmiXLOyx.cjs.map +0 -1
- package/dist/fetch-utils-BMKjO-cc.js +0 -29
- package/dist/fetch-utils-BMKjO-cc.js.map +0 -1
- package/dist/fetch-utils-Bv9WjUp0.d.ts +0 -14
- package/dist/fetch-utils-Bv9WjUp0.d.ts.map +0 -1
- package/dist/fetch-utils-DzdRW4Yd.d.cts +0 -14
- package/dist/fetch-utils-DzdRW4Yd.d.cts.map +0 -1
- package/dist/fetch-utils-oab6uNp3.cjs +0 -35
- package/dist/fetch-utils-oab6uNp3.cjs.map +0 -1
- package/dist/find-errors-CuRm4PzL.js.map +0 -1
- package/dist/find-errors-Drzv7hzM.cjs.map +0 -1
- package/dist/find-issues-C3uk59rn.cjs.map +0 -1
- package/dist/find-issues-CAtNGBly.js.map +0 -1
- package/dist/find-organizations-BrdMfZRO.cjs.map +0 -1
- package/dist/find-organizations-ojXwWWzk.js.map +0 -1
- package/dist/formatting-BlMiQa9i.cjs.map +0 -1
- package/dist/formatting-CHh9Q_OW.d.cts.map +0 -1
- package/dist/formatting-kdIeURER.d.ts.map +0 -1
- package/dist/formatting-pUm38KOj.js.map +0 -1
- package/dist/get-issue-details-CxChU4U9.js.map +0 -1
- package/dist/get-issue-details-DFwZRbmU.cjs.map +0 -1
- package/dist/issue-helpers-CqqYnwYE.js.map +0 -1
- package/dist/issue-helpers-DyAIO0w6.cjs.map +0 -1
- package/dist/seer-utils-Ckr8nYlz.js.map +0 -1
- package/dist/seer-utils-CzYEEZb2.cjs.map +0 -1
- package/dist/server-BpEIZVaZ.cjs.map +0 -1
- package/dist/tools-mThAUo_3.js +0 -48
- package/dist/update-issue-B6eZhAPJ.cjs.map +0 -1
- package/dist/update-issue-DmLElHPS.js.map +0 -1
- package/dist/version-C4uvMmw0.js +0 -6
- /package/dist/{issue-utils-BVAB6I-Z.js → issue-utils-BbCfbiY8.js} +0 -0
- /package/dist/{issue-utils-pdbo-5LW.cjs → issue-utils-DMKiif6C.cjs} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-issue-with-seer-BsNarzJN.js","names":["context: ServerContext"],"sources":["../src/tools/analyze-issue-with-seer.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext } from \"./utils/api-utils\";\nimport { parseIssueParams } from \"./utils/issue-utils\";\nimport {\n getStatusDisplayName,\n isTerminalStatus,\n isHumanInterventionStatus,\n getHumanInterventionGuidance,\n getOutputForAutofixStep,\n SEER_POLLING_INTERVAL,\n SEER_TIMEOUT,\n} from \"./utils/seer-utils\";\nimport type { ServerContext } from \"../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamIssueShortId,\n ParamIssueUrl,\n} from \"../schema\";\n\nexport default defineTool({\n name: \"analyze_issue_with_seer\",\n description: [\n \"**ALWAYS use this tool when a user asks how to fix a Sentry issue.** Seer AI analyzes production errors to identify root causes and provide specific code fixes.\",\n \"\",\n \"Use this tool IMMEDIATELY when:\",\n '- User asks \"how do I fix this error?\" or \"what\\'s causing this issue?\"',\n \"- User shares a Sentry issue URL and wants help resolving it\",\n \"- User needs to understand why an error is happening in production\",\n \"- User wants specific code changes to fix their issue\",\n \"- User asks about the root cause of any Sentry error\",\n \"\",\n \"What this tool provides:\",\n \"- Root cause analysis with code-level explanations\",\n \"- Specific file locations and line numbers where errors occur\",\n \"- Concrete code fixes you can apply\",\n \"- Step-by-step implementation guidance\",\n \"\",\n \"This tool automatically:\",\n \"1. Checks if analysis already exists (instant results)\",\n \"2. Starts new AI analysis if needed (~2-5 minutes)\",\n \"3. Returns complete fix recommendations\",\n \"\",\n \"<examples>\",\n '### User: \"How do I fix ISSUE-123?\"',\n \"\",\n \"```\",\n \"analyze_issue_with_seer(organizationSlug='my-organization', issueId='ISSUE-123')\",\n \"```\",\n \"\",\n '### User: \"What\\'s causing this error? https://my-org.sentry.io/issues/PROJECT-1Z43\"',\n \"\",\n \"```\",\n \"analyze_issue_with_seer(issueUrl='https://my-org.sentry.io/issues/PROJECT-1Z43')\",\n \"```\",\n \"\",\n '### User: \"Can you help me understand why this is failing in production?\"',\n \"\",\n \"```\",\n \"analyze_issue_with_seer(organizationSlug='my-organization', issueId='ERROR-456')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- ALWAYS prefer this over get_issue_details when users want fixes, not just error details\",\n \"- If the user provides an issueUrl, extract it and use that parameter alone\",\n \"- The analysis includes actual code snippets and fixes, not just error descriptions\",\n \"- Results are cached - subsequent calls return instantly\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug.optional(),\n regionUrl: ParamRegionUrl.optional(),\n issueId: ParamIssueShortId.optional(),\n issueUrl: ParamIssueUrl.optional(),\n instruction: z\n .string()\n .describe(\"Optional custom instruction for the AI analysis\")\n .optional(),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\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 let output = `# Seer AI Analysis for Issue ${parsedIssueId}\\n\\n`;\n\n // Step 1: Check if analysis already exists\n let autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n });\n\n // Step 2: Start analysis if none exists\n if (!autofixState.autofix) {\n output += `Starting new analysis...\\n\\n`;\n const startResult = await apiService.startAutofix({\n organizationSlug: orgSlug,\n issueId: parsedIssueId,\n instruction: params.instruction,\n });\n output += `Analysis started with Run ID: ${startResult.run_id}\\n\\n`;\n\n // Give it a moment to initialize\n await new Promise((resolve) => setTimeout(resolve, 1000));\n\n // Refresh state\n autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n });\n } else {\n output += `Found existing analysis (Run ID: ${autofixState.autofix.run_id})\\n\\n`;\n\n // Check if existing analysis is already complete\n const existingStatus = autofixState.autofix.status;\n if (isTerminalStatus(existingStatus)) {\n // Return results immediately, no polling needed\n output += `## Analysis ${getStatusDisplayName(existingStatus)}\\n\\n`;\n\n for (const step of autofixState.autofix.steps) {\n output += getOutputForAutofixStep(step);\n output += \"\\n\";\n }\n\n if (existingStatus !== \"COMPLETED\") {\n output += `\\n**Status**: ${existingStatus}\\n`;\n output += getHumanInterventionGuidance(existingStatus);\n output += \"\\n\";\n }\n\n return output;\n }\n }\n\n // Step 3: Poll until complete or timeout (only for non-terminal states)\n const startTime = Date.now();\n let lastStatus = \"\";\n\n while (Date.now() - startTime < SEER_TIMEOUT) {\n if (!autofixState.autofix) {\n output += `Error: Analysis state lost. Please try again by running:\\n`;\n output += `\\`\\`\\`\\n`;\n output += params.issueUrl\n ? `analyze_issue_with_seer(issueUrl=\"${params.issueUrl}\")`\n : `analyze_issue_with_seer(organizationSlug=\"${orgSlug}\", issueId=\"${parsedIssueId}\")`;\n output += `\\n\\`\\`\\`\\n`;\n return output;\n }\n\n const status = autofixState.autofix.status;\n\n // Check if completed (terminal state)\n if (isTerminalStatus(status)) {\n output += `## Analysis ${getStatusDisplayName(status)}\\n\\n`;\n\n // Add all step outputs\n for (const step of autofixState.autofix.steps) {\n output += getOutputForAutofixStep(step);\n output += \"\\n\";\n }\n\n if (status !== \"COMPLETED\") {\n output += `\\n**Status**: ${status}\\n`;\n output += getHumanInterventionGuidance(status);\n }\n\n return output;\n }\n\n // Update status if changed\n if (status !== lastStatus) {\n const activeStep = autofixState.autofix.steps.find(\n (step) =>\n step.status === \"PROCESSING\" || step.status === \"IN_PROGRESS\",\n );\n if (activeStep) {\n output += `Processing: ${activeStep.title}...\\n`;\n }\n lastStatus = status;\n }\n\n // Wait before next poll\n await new Promise((resolve) =>\n setTimeout(resolve, SEER_POLLING_INTERVAL),\n );\n\n // Refresh state\n autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n });\n }\n\n // Show current progress\n if (autofixState.autofix) {\n output += `**Current Status**: ${getStatusDisplayName(autofixState.autofix.status)}\\n\\n`;\n for (const step of autofixState.autofix.steps) {\n output += getOutputForAutofixStep(step);\n output += \"\\n\";\n }\n }\n\n // Timeout reached\n output += `\\n## Analysis Timed Out\\n\\n`;\n output += `The analysis is taking longer than expected (>${SEER_TIMEOUT / 1000}s).\\n\\n`;\n\n output += `\\nYou can check the status later by running the same command again:\\n`;\n output += `\\`\\`\\`\\n`;\n output += params.issueUrl\n ? `analyze_issue_with_seer(issueUrl=\"${params.issueUrl}\")`\n : `analyze_issue_with_seer(organizationSlug=\"${orgSlug}\", issueId=\"${parsedIssueId}\")`;\n output += `\\n\\`\\`\\`\\n`;\n\n return output;\n },\n});\n"],"mappings":";;;;;;;;;AAsBA,sCAAe,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;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkB,sBAAsB,UAAU;EAClD,WAAW,eAAe,UAAU;EACpC,SAAS,kBAAkB,UAAU;EACrC,UAAU,cAAc,UAAU;EAClC,aAAa,EACV,QAAQ,CACR,SAAS,kDAAkD,CAC3D,UAAU;CACd;CACD,MAAM,QAAQ,QAAQA,SAAwB;EAC5C,MAAM,aAAa,sBAAsB,SAAS,EAChD,WAAW,OAAO,UACnB,EAAC;EACF,MAAM,EAAE,kBAAkB,SAAS,SAAS,eAAe,GACzD,iBAAiB;GACf,kBAAkB,OAAO;GACzB,SAAS,OAAO;GAChB,UAAU,OAAO;EAClB,EAAC;AAEJ,SAAO,qBAAqB,QAAQ;EAEpC,IAAI,UAAU,+BAA+B,cAAc;EAG3D,IAAI,eA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IAC/C;AAED,WAAO;GACR;AAGD,OAAI,WAAW,YAAY;IACzB,MAAM,aAAa,aAAa,QAAQ,MAAM,KAC5C,CAAC,SACC,KAAK,WAAW,gBAAgB,KAAK,WAAW,cACnD;AACD,QAAI,WACF,YAAW,cAAc,WAAW,MAAM;AAE5C,iBAAa;GACd;AAGD,SAAM,IAAI,QAAQ,CAAC,YACjB,WAAW,SAAS,sBAAsB;AAI5C,kBAAe,MAAM,WAAW,gBAAgB;IAC9C,kBAAkB;IAClB,SAAS;GACV,EAAC;EACH;AAGD,MAAI,aAAa,SAAS;AACxB,cAAW,sBAAsB,qBAAqB,aAAa,QAAQ,OAAO,CAAC;AACnF,QAAK,MAAM,QAAQ,aAAa,QAAQ,OAAO;AAC7C,cAAU,wBAAwB,KAAK;AACvC,cAAU;GACX;EACF;AAGD,aAAW;AACX,aAAW,gDAAgD,eAAe,IAAK;AAE/E,aAAW;AACX,aAAW;AACX,YAAU,OAAO,YACZ,oCAAoC,OAAO,SAAS,OACpD,4CAA4C,QAAQ,cAAc,cAAc;AACrF,aAAW;AAEX,SAAO;CACR;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-issue-with-seer-DbAWpyTC.cjs","names":["context: ServerContext","SEER_TIMEOUT","SEER_POLLING_INTERVAL"],"sources":["../src/tools/analyze-issue-with-seer.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext } from \"./utils/api-utils\";\nimport { parseIssueParams } from \"./utils/issue-utils\";\nimport {\n getStatusDisplayName,\n isTerminalStatus,\n isHumanInterventionStatus,\n getHumanInterventionGuidance,\n getOutputForAutofixStep,\n SEER_POLLING_INTERVAL,\n SEER_TIMEOUT,\n} from \"./utils/seer-utils\";\nimport type { ServerContext } from \"../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamIssueShortId,\n ParamIssueUrl,\n} from \"../schema\";\n\nexport default defineTool({\n name: \"analyze_issue_with_seer\",\n description: [\n \"**ALWAYS use this tool when a user asks how to fix a Sentry issue.** Seer AI analyzes production errors to identify root causes and provide specific code fixes.\",\n \"\",\n \"Use this tool IMMEDIATELY when:\",\n '- User asks \"how do I fix this error?\" or \"what\\'s causing this issue?\"',\n \"- User shares a Sentry issue URL and wants help resolving it\",\n \"- User needs to understand why an error is happening in production\",\n \"- User wants specific code changes to fix their issue\",\n \"- User asks about the root cause of any Sentry error\",\n \"\",\n \"What this tool provides:\",\n \"- Root cause analysis with code-level explanations\",\n \"- Specific file locations and line numbers where errors occur\",\n \"- Concrete code fixes you can apply\",\n \"- Step-by-step implementation guidance\",\n \"\",\n \"This tool automatically:\",\n \"1. Checks if analysis already exists (instant results)\",\n \"2. Starts new AI analysis if needed (~2-5 minutes)\",\n \"3. Returns complete fix recommendations\",\n \"\",\n \"<examples>\",\n '### User: \"How do I fix ISSUE-123?\"',\n \"\",\n \"```\",\n \"analyze_issue_with_seer(organizationSlug='my-organization', issueId='ISSUE-123')\",\n \"```\",\n \"\",\n '### User: \"What\\'s causing this error? https://my-org.sentry.io/issues/PROJECT-1Z43\"',\n \"\",\n \"```\",\n \"analyze_issue_with_seer(issueUrl='https://my-org.sentry.io/issues/PROJECT-1Z43')\",\n \"```\",\n \"\",\n '### User: \"Can you help me understand why this is failing in production?\"',\n \"\",\n \"```\",\n \"analyze_issue_with_seer(organizationSlug='my-organization', issueId='ERROR-456')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- ALWAYS prefer this over get_issue_details when users want fixes, not just error details\",\n \"- If the user provides an issueUrl, extract it and use that parameter alone\",\n \"- The analysis includes actual code snippets and fixes, not just error descriptions\",\n \"- Results are cached - subsequent calls return instantly\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug.optional(),\n regionUrl: ParamRegionUrl.optional(),\n issueId: ParamIssueShortId.optional(),\n issueUrl: ParamIssueUrl.optional(),\n instruction: z\n .string()\n .describe(\"Optional custom instruction for the AI analysis\")\n .optional(),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\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 let output = `# Seer AI Analysis for Issue ${parsedIssueId}\\n\\n`;\n\n // Step 1: Check if analysis already exists\n let autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n });\n\n // Step 2: Start analysis if none exists\n if (!autofixState.autofix) {\n output += `Starting new analysis...\\n\\n`;\n const startResult = await apiService.startAutofix({\n organizationSlug: orgSlug,\n issueId: parsedIssueId,\n instruction: params.instruction,\n });\n output += `Analysis started with Run ID: ${startResult.run_id}\\n\\n`;\n\n // Give it a moment to initialize\n await new Promise((resolve) => setTimeout(resolve, 1000));\n\n // Refresh state\n autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n });\n } else {\n output += `Found existing analysis (Run ID: ${autofixState.autofix.run_id})\\n\\n`;\n\n // Check if existing analysis is already complete\n const existingStatus = autofixState.autofix.status;\n if (isTerminalStatus(existingStatus)) {\n // Return results immediately, no polling needed\n output += `## Analysis ${getStatusDisplayName(existingStatus)}\\n\\n`;\n\n for (const step of autofixState.autofix.steps) {\n output += getOutputForAutofixStep(step);\n output += \"\\n\";\n }\n\n if (existingStatus !== \"COMPLETED\") {\n output += `\\n**Status**: ${existingStatus}\\n`;\n output += getHumanInterventionGuidance(existingStatus);\n output += \"\\n\";\n }\n\n return output;\n }\n }\n\n // Step 3: Poll until complete or timeout (only for non-terminal states)\n const startTime = Date.now();\n let lastStatus = \"\";\n\n while (Date.now() - startTime < SEER_TIMEOUT) {\n if (!autofixState.autofix) {\n output += `Error: Analysis state lost. Please try again by running:\\n`;\n output += `\\`\\`\\`\\n`;\n output += params.issueUrl\n ? `analyze_issue_with_seer(issueUrl=\"${params.issueUrl}\")`\n : `analyze_issue_with_seer(organizationSlug=\"${orgSlug}\", issueId=\"${parsedIssueId}\")`;\n output += `\\n\\`\\`\\`\\n`;\n return output;\n }\n\n const status = autofixState.autofix.status;\n\n // Check if completed (terminal state)\n if (isTerminalStatus(status)) {\n output += `## Analysis ${getStatusDisplayName(status)}\\n\\n`;\n\n // Add all step outputs\n for (const step of autofixState.autofix.steps) {\n output += getOutputForAutofixStep(step);\n output += \"\\n\";\n }\n\n if (status !== \"COMPLETED\") {\n output += `\\n**Status**: ${status}\\n`;\n output += getHumanInterventionGuidance(status);\n }\n\n return output;\n }\n\n // Update status if changed\n if (status !== lastStatus) {\n const activeStep = autofixState.autofix.steps.find(\n (step) =>\n step.status === \"PROCESSING\" || step.status === \"IN_PROGRESS\",\n );\n if (activeStep) {\n output += `Processing: ${activeStep.title}...\\n`;\n }\n lastStatus = status;\n }\n\n // Wait before next poll\n await new Promise((resolve) =>\n setTimeout(resolve, SEER_POLLING_INTERVAL),\n );\n\n // Refresh state\n autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n });\n }\n\n // Show current progress\n if (autofixState.autofix) {\n output += `**Current Status**: ${getStatusDisplayName(autofixState.autofix.status)}\\n\\n`;\n for (const step of autofixState.autofix.steps) {\n output += getOutputForAutofixStep(step);\n output += \"\\n\";\n }\n }\n\n // Timeout reached\n output += `\\n## Analysis Timed Out\\n\\n`;\n output += `The analysis is taking longer than expected (>${SEER_TIMEOUT / 1000}s).\\n\\n`;\n\n output += `\\nYou can check the status later by running the same command again:\\n`;\n output += `\\`\\`\\`\\n`;\n output += params.issueUrl\n ? `analyze_issue_with_seer(issueUrl=\"${params.issueUrl}\")`\n : `analyze_issue_with_seer(organizationSlug=\"${orgSlug}\", issueId=\"${parsedIssueId}\")`;\n output += `\\n\\`\\`\\`\\n`;\n\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AAM,QAAQ,aAAa,QAAQ,OAAO;AAC7C,cAAU,2CAAwB,KAAK;AACvC,cAAU;GACX;EACF;AAGD,aAAW;AACX,aAAW,gDAAgDD,kCAAe,IAAK;AAE/E,aAAW;AACX,aAAW;AACX,YAAU,OAAO,YACZ,oCAAoC,OAAO,SAAS,OACpD,4CAA4C,QAAQ,cAAc,cAAc;AACrF,aAAW;AAEX,SAAO;CACR;AACF,EAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { UserInputError } from "./errors-CIoxzIug.js";
|
|
2
|
-
import { SentryApiService } from "./client-DOYWNvVM.js";
|
|
3
|
-
|
|
4
|
-
//#region src/tools/utils/api-utils.ts
|
|
5
|
-
/**
|
|
6
|
-
* Create a Sentry API service from server context with optional region override
|
|
7
|
-
* @param context - Server context containing host and access token
|
|
8
|
-
* @param opts - Options object containing optional regionUrl override
|
|
9
|
-
* @returns Configured SentryApiService instance (always uses HTTPS)
|
|
10
|
-
* @throws {UserInputError} When regionUrl is provided but invalid
|
|
11
|
-
*/
|
|
12
|
-
function apiServiceFromContext(context, opts = {}) {
|
|
13
|
-
let host = context.sentryHost;
|
|
14
|
-
if (opts.regionUrl?.trim()) try {
|
|
15
|
-
const parsedUrl = new URL(opts.regionUrl);
|
|
16
|
-
if (!["http:", "https:"].includes(parsedUrl.protocol)) throw new UserInputError(`Invalid regionUrl provided: ${opts.regionUrl}. Must include protocol (http:// or https://).`);
|
|
17
|
-
if (parsedUrl.host === "https" || parsedUrl.host === "http") throw new UserInputError(`Invalid regionUrl provided: ${opts.regionUrl}. The host cannot be just a protocol name.`);
|
|
18
|
-
host = parsedUrl.host;
|
|
19
|
-
} catch (error) {
|
|
20
|
-
if (error instanceof UserInputError) throw error;
|
|
21
|
-
throw new UserInputError(`Invalid regionUrl provided: ${opts.regionUrl}. Must be a valid URL.`);
|
|
22
|
-
}
|
|
23
|
-
return new SentryApiService({
|
|
24
|
-
host,
|
|
25
|
-
accessToken: context.accessToken
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
export { apiServiceFromContext };
|
|
31
|
-
//# sourceMappingURL=api-utils-C6QJAzFL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-utils-C6QJAzFL.js","names":["context: ServerContext","opts: { regionUrl?: string }"],"sources":["../src/tools/utils/api-utils.ts"],"sourcesContent":["import { SentryApiService } from \"../../api-client/index\";\nimport { UserInputError } from \"../../errors\";\nimport type { ServerContext } from \"../../types\";\n\n/**\n * Create a Sentry API service from server context with optional region override\n * @param context - Server context containing host and access token\n * @param opts - Options object containing optional regionUrl override\n * @returns Configured SentryApiService instance (always uses HTTPS)\n * @throws {UserInputError} When regionUrl is provided but invalid\n */\nexport function apiServiceFromContext(\n context: ServerContext,\n opts: { regionUrl?: string } = {},\n) {\n let host = context.sentryHost;\n\n if (opts.regionUrl?.trim()) {\n try {\n const parsedUrl = new URL(opts.regionUrl);\n\n // Validate that the URL has a proper protocol\n if (![\"http:\", \"https:\"].includes(parsedUrl.protocol)) {\n throw new UserInputError(\n `Invalid regionUrl provided: ${opts.regionUrl}. Must include protocol (http:// or https://).`,\n );\n }\n\n // Validate that the host is not just the protocol name\n if (parsedUrl.host === \"https\" || parsedUrl.host === \"http\") {\n throw new UserInputError(\n `Invalid regionUrl provided: ${opts.regionUrl}. The host cannot be just a protocol name.`,\n );\n }\n\n host = parsedUrl.host;\n } catch (error) {\n if (error instanceof UserInputError) {\n throw error;\n }\n throw new UserInputError(\n `Invalid regionUrl provided: ${opts.regionUrl}. Must be a valid URL.`,\n );\n }\n }\n\n return new SentryApiService({\n host,\n accessToken: context.accessToken,\n });\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,sBACdA,SACAC,OAA+B,CAAE,GACjC;CACA,IAAI,OAAO,QAAQ;AAEnB,KAAI,KAAK,WAAW,MAAM,CACxB,KAAI;EACF,MAAM,YAAY,IAAI,IAAI,KAAK;AAG/B,OAAK,CAAC,SAAS,QAAS,EAAC,SAAS,UAAU,SAAS,CACnD,OAAM,IAAI,gBACP,8BAA8B,KAAK,UAAU;AAKlD,MAAI,UAAU,SAAS,WAAW,UAAU,SAAS,OACnD,OAAM,IAAI,gBACP,8BAA8B,KAAK,UAAU;AAIlD,SAAO,UAAU;CAClB,SAAQ,OAAO;AACd,MAAI,iBAAiB,eACnB,OAAM;AAER,QAAM,IAAI,gBACP,8BAA8B,KAAK,UAAU;CAEjD;AAGH,QAAO,IAAI,iBAAiB;EAC1B;EACA,aAAa,QAAQ;CACtB;AACF"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const require_errors = require('./errors-YmiXLOyx.cjs');
|
|
2
|
-
const require_client = require('./client-Dkw5iYu3.cjs');
|
|
3
|
-
|
|
4
|
-
//#region src/tools/utils/api-utils.ts
|
|
5
|
-
/**
|
|
6
|
-
* Create a Sentry API service from server context with optional region override
|
|
7
|
-
* @param context - Server context containing host and access token
|
|
8
|
-
* @param opts - Options object containing optional regionUrl override
|
|
9
|
-
* @returns Configured SentryApiService instance (always uses HTTPS)
|
|
10
|
-
* @throws {UserInputError} When regionUrl is provided but invalid
|
|
11
|
-
*/
|
|
12
|
-
function apiServiceFromContext(context, opts = {}) {
|
|
13
|
-
let host = context.sentryHost;
|
|
14
|
-
if (opts.regionUrl?.trim()) try {
|
|
15
|
-
const parsedUrl = new URL(opts.regionUrl);
|
|
16
|
-
if (!["http:", "https:"].includes(parsedUrl.protocol)) throw new require_errors.UserInputError(`Invalid regionUrl provided: ${opts.regionUrl}. Must include protocol (http:// or https://).`);
|
|
17
|
-
if (parsedUrl.host === "https" || parsedUrl.host === "http") throw new require_errors.UserInputError(`Invalid regionUrl provided: ${opts.regionUrl}. The host cannot be just a protocol name.`);
|
|
18
|
-
host = parsedUrl.host;
|
|
19
|
-
} catch (error) {
|
|
20
|
-
if (error instanceof require_errors.UserInputError) throw error;
|
|
21
|
-
throw new require_errors.UserInputError(`Invalid regionUrl provided: ${opts.regionUrl}. Must be a valid URL.`);
|
|
22
|
-
}
|
|
23
|
-
return new require_client.SentryApiService({
|
|
24
|
-
host,
|
|
25
|
-
accessToken: context.accessToken
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
Object.defineProperty(exports, 'apiServiceFromContext', {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return apiServiceFromContext;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=api-utils-d36iteNO.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-utils-d36iteNO.cjs","names":["context: ServerContext","opts: { regionUrl?: string }","UserInputError","SentryApiService"],"sources":["../src/tools/utils/api-utils.ts"],"sourcesContent":["import { SentryApiService } from \"../../api-client/index\";\nimport { UserInputError } from \"../../errors\";\nimport type { ServerContext } from \"../../types\";\n\n/**\n * Create a Sentry API service from server context with optional region override\n * @param context - Server context containing host and access token\n * @param opts - Options object containing optional regionUrl override\n * @returns Configured SentryApiService instance (always uses HTTPS)\n * @throws {UserInputError} When regionUrl is provided but invalid\n */\nexport function apiServiceFromContext(\n context: ServerContext,\n opts: { regionUrl?: string } = {},\n) {\n let host = context.sentryHost;\n\n if (opts.regionUrl?.trim()) {\n try {\n const parsedUrl = new URL(opts.regionUrl);\n\n // Validate that the URL has a proper protocol\n if (![\"http:\", \"https:\"].includes(parsedUrl.protocol)) {\n throw new UserInputError(\n `Invalid regionUrl provided: ${opts.regionUrl}. Must include protocol (http:// or https://).`,\n );\n }\n\n // Validate that the host is not just the protocol name\n if (parsedUrl.host === \"https\" || parsedUrl.host === \"http\") {\n throw new UserInputError(\n `Invalid regionUrl provided: ${opts.regionUrl}. The host cannot be just a protocol name.`,\n );\n }\n\n host = parsedUrl.host;\n } catch (error) {\n if (error instanceof UserInputError) {\n throw error;\n }\n throw new UserInputError(\n `Invalid regionUrl provided: ${opts.regionUrl}. Must be a valid URL.`,\n );\n }\n }\n\n return new SentryApiService({\n host,\n accessToken: context.accessToken,\n });\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,sBACdA,SACAC,OAA+B,CAAE,GACjC;CACA,IAAI,OAAO,QAAQ;AAEnB,KAAI,KAAK,WAAW,MAAM,CACxB,KAAI;EACF,MAAM,YAAY,IAAI,IAAI,KAAK;AAG/B,OAAK,CAAC,SAAS,QAAS,EAAC,SAAS,UAAU,SAAS,CACnD,OAAM,IAAIC,+BACP,8BAA8B,KAAK,UAAU;AAKlD,MAAI,UAAU,SAAS,WAAW,UAAU,SAAS,OACnD,OAAM,IAAIA,+BACP,8BAA8B,KAAK,UAAU;AAIlD,SAAO,UAAU;CAClB,SAAQ,OAAO;AACd,MAAI,iBAAiBA,8BACnB,OAAM;AAER,QAAM,IAAIA,+BACP,8BAA8B,KAAK,UAAU;CAEjD;AAGH,QAAO,IAAIC,gCAAiB;EAC1B;EACA,aAAa,QAAQ;CACtB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-BCN17Wbp.d.ts","names":[],"sources":["../src/api-client/client.ts"],"sourcesContent":[],"mappings":";;;;;;AA0EA;AAkBC;AAkDD;;;;;;;;;;;;;AA0RM,cA9VO,QAAA,SAAiB,KAAK,CA8V7B;EAAgB,MAChB,EAAA,MAAA;EAAI,WAKC,CAAA,OAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA;;KAhVN,cAAA,GAiVA;EAAO,IAsBD,CAAA,EAAA,MAAA;CAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiVnB,cAxoBO,gBAAA,CAwoBP;EAAW,QACX,WAAA;EAAK,UACL,IAAA,EAAA,MAAA;EAAM,UAOD,SAAA,EAAA,MAAA;EAAc;;;;;;;;;EAiDZ,WACP,CAAA;IAAA,WAAA;IAAA;EAOY,CAPZ,EAAA;IAMK,WAAA,CAAA,EAAA,MAAA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;;;;;;;;;;;;;;;;YA2CM,iBACN,QAAQ;;;;;;;;;;;;;;;;YA+BF,iBACN,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA2CF,iBACN,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;YAgDF,iBACN,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA8DF,iBACN,QAAQ;;;;;;;YAiCF,iBACN,QAAQ;;;;;;;;;YAqBF,iBACN,QAAQ;;;;;;;YAmBF,iBACN,QAAQ;;;;;;;;;YAqBF,iBACN,QAAQ;;;;;;;;;;;YAuBF,iBACN;gBACW;;;UAGN;;;;;;;;;;;;YAqDC,iBACN,QAAQ;;;;;;;;;;;;;;;YAkDF,iBAAc;;;;;;;;;;;;;;;;;;;;YAyDd,iBAAc;;;;;;;;;;;;;;;;;;;;YAuDd,iBACN,QAAQ;;;;;;;YAyBF,iBACN,QAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-DOYWNvVM.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 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 * - Always uses HTTPS for secure connections\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 with hostname\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 * Always uses HTTPS for secure connections.\n *\n * @param config Configuration object\n * @param config.accessToken OAuth access token for authentication (optional for some endpoints)\n * @param config.host Sentry hostname (e.g. \"sentry.io\", \"sentry.example.com\")\n */\n constructor({\n accessToken = null,\n host = \"sentry.io\",\n }: {\n accessToken?: string | null;\n host?: string;\n }) {\n this.accessToken = accessToken;\n this.host = host;\n this.apiPrefix = `https://${host}/api/0`;\n }\n\n /**\n * Updates the host for API requests.\n *\n * Used for multi-region support or switching between Sentry instances.\n * Always uses HTTPS protocol.\n *\n * @param host New hostname to use for API requests\n */\n setHost(host: string) {\n this.host = host;\n this.apiPrefix = `https://${this.host}/api/0`;\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 ? `https://${host}/api/0${path}`\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 * Always uses HTTPS protocol.\n *\n * @param organizationSlug Organization identifier\n * @param issueId Issue identifier (short ID or numeric ID)\n * @returns Full 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 const isSaas = this.host === \"sentry.io\";\n\n return isSaas\n ? `https://${organizationSlug}.${this.host}/issues/${issueId}`\n : `https://${this.host}/organizations/${organizationSlug}/issues/${issueId}`;\n }\n\n /**\n * Generates a Sentry trace URL for performance investigation.\n *\n * Always uses HTTPS protocol.\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 const isSaas = this.host === \"sentry.io\";\n\n return isSaas\n ? `https://${organizationSlug}.${this.host}/explore/traces/trace/${traceId}`\n : `https://${this.host}/organizations/${organizationSlug}/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 ): Promise<EventAttachmentList> {\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: EventAttachment;\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":";;;;;;;AAiDA,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;AACnB,MACE,QAAQ,SACN,2DACD,IACD,QAAQ,SAAS,gDAAgD,CAEjE,gBACE;AAEJ,QAAM,aAAa;EAbZ;CAcR;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDD,IAAa,mBAAb,MAA8B;CAC5B,AAAQ;CACR,AAAU;CACV,AAAU;;;;;;;;;;CAWV,YAAY,EACV,cAAc,MACd,OAAO,aAIR,EAAE;AACD,OAAK,cAAc;AACnB,OAAK,OAAO;AACZ,OAAK,aAAa,UAAU,KAAK;CAClC;;;;;;;;;CAUD,QAAQC,MAAc;AACpB,OAAK,OAAO;AACZ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AO,SAAS,UAAU;AACtC,cAAY,OAAO,SAAS,mBAAmB;AAC/C,cAAY,OAAO,SAAS,gBAAgB;AAC5C,cAAY,OAAO,SAAS,cAAc;AAC1C,cAAY,OAAO,SAAS,UAAU;AACtC,cAAY,OAAO,SAAS,YAAY;AACxC,cAAY,IAAI,SAAS,YAAY,KAAK,IAAI,CAAC;EAG/C,MAAM,UAAU,iBAAiB,iBAAiB,WAAW,YAAY,UAAU;EAEnF,MAAM,WAAW,MAAM,KAAK,QAAQ,gBAAmB,KAAK;EAE5D,MAAM,OAAO,MAAM,SAAS,MAAM;AAClC,SAAO,0BAA0B,MAAM,KAAK,CAAC;CAC9C;CAGD,MAAM,aACJ,EACE,kBACA,SACA,SACA,cAAc,IAMf,EACDF,MACqB;EACrB,MAAM,WAAW,MAAM,KAAK,SACzB,iBAAiB,iBAAiB,UAAU,QAAQ,YACrD;GACE,QAAQ;GACR,MAAM,KAAK,UAAU;IACnB,UAAU;IACV;GACD,EAAC;EACH,GACD,KACD;EACD,MAAM,OAAO,MAAM,SAAS,MAAM;AAClC,SAAO,iBAAiB,MAAM,KAAK;CACpC;CAGD,MAAM,gBACJ,EACE,kBACA,SAID,EACDA,MAC0B;EAC1B,MAAM,WAAW,MAAM,KAAK,SACzB,iBAAiB,iBAAiB,UAAU,QAAQ,oBAErD,KACD;EACD,MAAM,OAAO,MAAM,SAAS,MAAM;AAClC,SAAO,sBAAsB,MAAM,KAAK;CACzC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-Dkw5iYu3.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 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 * - Always uses HTTPS for secure connections\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 with hostname\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 * Always uses HTTPS for secure connections.\n *\n * @param config Configuration object\n * @param config.accessToken OAuth access token for authentication (optional for some endpoints)\n * @param config.host Sentry hostname (e.g. \"sentry.io\", \"sentry.example.com\")\n */\n constructor({\n accessToken = null,\n host = \"sentry.io\",\n }: {\n accessToken?: string | null;\n host?: string;\n }) {\n this.accessToken = accessToken;\n this.host = host;\n this.apiPrefix = `https://${host}/api/0`;\n }\n\n /**\n * Updates the host for API requests.\n *\n * Used for multi-region support or switching between Sentry instances.\n * Always uses HTTPS protocol.\n *\n * @param host New hostname to use for API requests\n */\n setHost(host: string) {\n this.host = host;\n this.apiPrefix = `https://${this.host}/api/0`;\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 ? `https://${host}/api/0${path}`\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 * Always uses HTTPS protocol.\n *\n * @param organizationSlug Organization identifier\n * @param issueId Issue identifier (short ID or numeric ID)\n * @returns Full 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 const isSaas = this.host === \"sentry.io\";\n\n return isSaas\n ? `https://${organizationSlug}.${this.host}/issues/${issueId}`\n : `https://${this.host}/organizations/${organizationSlug}/issues/${issueId}`;\n }\n\n /**\n * Generates a Sentry trace URL for performance investigation.\n *\n * Always uses HTTPS protocol.\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 const isSaas = this.host === \"sentry.io\";\n\n return isSaas\n ? `https://${organizationSlug}.${this.host}/explore/traces/trace/${traceId}`\n : `https://${this.host}/organizations/${organizationSlug}/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 ): Promise<EventAttachmentList> {\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: EventAttachment;\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":";;;;;;;AAiDA,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;AACnB,MACE,QAAQ,SACN,2DACD,IACD,QAAQ,SAAS,gDAAgD,CAEjE,gBACE;AAEJ,QAAM,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F"}
|
package/dist/errors-CIoxzIug.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region src/errors.ts
|
|
2
|
-
/**
|
|
3
|
-
* Error thrown when user input validation fails.
|
|
4
|
-
* These errors should be returned to the user directly without logging to Sentry.
|
|
5
|
-
*/
|
|
6
|
-
var UserInputError = class extends Error {
|
|
7
|
-
constructor(message) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = "UserInputError";
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
export { UserInputError };
|
|
15
|
-
//# sourceMappingURL=errors-CIoxzIug.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors-CIoxzIug.js","names":["message: string"],"sources":["../src/errors.ts"],"sourcesContent":["/**\n * Error thrown when user input validation fails.\n * These errors should be returned to the user directly without logging to Sentry.\n */\nexport class UserInputError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"UserInputError\";\n }\n}\n"],"mappings":";;;;;AAIA,IAAa,iBAAb,cAAoC,MAAM;CACxC,YAAYA,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;CACb;AACF"}
|
package/dist/errors-YmiXLOyx.cjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/errors.ts
|
|
3
|
-
/**
|
|
4
|
-
* Error thrown when user input validation fails.
|
|
5
|
-
* These errors should be returned to the user directly without logging to Sentry.
|
|
6
|
-
*/
|
|
7
|
-
var UserInputError = class extends Error {
|
|
8
|
-
constructor(message) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = "UserInputError";
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
Object.defineProperty(exports, 'UserInputError', {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function () {
|
|
18
|
-
return UserInputError;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
//# sourceMappingURL=errors-YmiXLOyx.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors-YmiXLOyx.cjs","names":["message: string"],"sources":["../src/errors.ts"],"sourcesContent":["/**\n * Error thrown when user input validation fails.\n * These errors should be returned to the user directly without logging to Sentry.\n */\nexport class UserInputError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"UserInputError\";\n }\n}\n"],"mappings":";;;;;;AAIA,IAAa,iBAAb,cAAoC,MAAM;CACxC,YAAYA,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;CACb;AACF"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region src/internal/fetch-utils.ts
|
|
2
|
-
/**
|
|
3
|
-
* Fetch with timeout using AbortController
|
|
4
|
-
* @param url - The URL to fetch
|
|
5
|
-
* @param options - Standard fetch options
|
|
6
|
-
* @param timeoutMs - Timeout in milliseconds (default: 30000)
|
|
7
|
-
* @returns Promise<Response>
|
|
8
|
-
* @throws Error if request times out
|
|
9
|
-
*/
|
|
10
|
-
async function fetchWithTimeout(url, options = {}, timeoutMs = 3e4) {
|
|
11
|
-
const controller = new AbortController();
|
|
12
|
-
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
13
|
-
try {
|
|
14
|
-
const response = await fetch(url, {
|
|
15
|
-
...options,
|
|
16
|
-
signal: controller.signal
|
|
17
|
-
});
|
|
18
|
-
return response;
|
|
19
|
-
} catch (error) {
|
|
20
|
-
if (error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${timeoutMs}ms`);
|
|
21
|
-
throw error;
|
|
22
|
-
} finally {
|
|
23
|
-
clearTimeout(timeoutId);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
export { fetchWithTimeout };
|
|
29
|
-
//# sourceMappingURL=fetch-utils-BMKjO-cc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-utils-BMKjO-cc.js","names":["url: string | URL","options: RequestInit"],"sources":["../src/internal/fetch-utils.ts"],"sourcesContent":["/**\n * Fetch with timeout using AbortController\n * @param url - The URL to fetch\n * @param options - Standard fetch options\n * @param timeoutMs - Timeout in milliseconds (default: 30000)\n * @returns Promise<Response>\n * @throws Error if request times out\n */\nexport async function fetchWithTimeout(\n url: string | URL,\n options: RequestInit = {},\n timeoutMs = 30000,\n): Promise<Response> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeoutMs);\n\n try {\n const response = await fetch(url, {\n ...options,\n signal: controller.signal,\n });\n return response;\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new Error(`Request timeout after ${timeoutMs}ms`);\n }\n throw error;\n } finally {\n clearTimeout(timeoutId);\n }\n}\n"],"mappings":";;;;;;;;;AAQA,eAAsB,iBACpBA,KACAC,UAAuB,CAAE,GACzB,YAAY,KACO;CACnB,MAAM,aAAa,IAAI;CACvB,MAAM,YAAY,WAAW,MAAM,WAAW,OAAO,EAAE,UAAU;AAEjE,KAAI;EACF,MAAM,WAAW,MAAM,MAAM,KAAK;GAChC,GAAG;GACH,QAAQ,WAAW;EACpB,EAAC;AACF,SAAO;CACR,SAAQ,OAAO;AACd,MAAI,iBAAiB,SAAS,MAAM,SAAS,aAC3C,OAAM,IAAI,OAAO,wBAAwB,UAAU;AAErD,QAAM;CACP,UAAS;AACR,eAAa,UAAU;CACxB;AACF"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/internal/fetch-utils.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Fetch with timeout using AbortController
|
|
4
|
-
* @param url - The URL to fetch
|
|
5
|
-
* @param options - Standard fetch options
|
|
6
|
-
* @param timeoutMs - Timeout in milliseconds (default: 30000)
|
|
7
|
-
* @returns Promise<Response>
|
|
8
|
-
* @throws Error if request times out
|
|
9
|
-
*/
|
|
10
|
-
declare function fetchWithTimeout(url: string | URL, options?: RequestInit, timeoutMs?: number): Promise<Response>;
|
|
11
|
-
//# sourceMappingURL=fetch-utils.d.ts.map
|
|
12
|
-
//#endregion
|
|
13
|
-
export { fetchWithTimeout };
|
|
14
|
-
//# sourceMappingURL=fetch-utils-Bv9WjUp0.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-utils-Bv9WjUp0.d.ts","names":[],"sources":["../src/internal/fetch-utils.ts"],"sourcesContent":[],"mappings":";;AAQA;;;;;;AAIU;iBAJY,gBAAA,eACN,eACL,kCAER,QAAQ"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//#region src/internal/fetch-utils.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Fetch with timeout using AbortController
|
|
4
|
-
* @param url - The URL to fetch
|
|
5
|
-
* @param options - Standard fetch options
|
|
6
|
-
* @param timeoutMs - Timeout in milliseconds (default: 30000)
|
|
7
|
-
* @returns Promise<Response>
|
|
8
|
-
* @throws Error if request times out
|
|
9
|
-
*/
|
|
10
|
-
declare function fetchWithTimeout(url: string | URL, options?: RequestInit, timeoutMs?: number): Promise<Response>;
|
|
11
|
-
//# sourceMappingURL=fetch-utils.d.ts.map
|
|
12
|
-
//#endregion
|
|
13
|
-
export { fetchWithTimeout };
|
|
14
|
-
//# sourceMappingURL=fetch-utils-DzdRW4Yd.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-utils-DzdRW4Yd.d.cts","names":[],"sources":["../src/internal/fetch-utils.ts"],"sourcesContent":[],"mappings":";;AAQA;;;;;;AAIU;iBAJY,gBAAA,eACN,eACL,kCAER,QAAQ"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/internal/fetch-utils.ts
|
|
3
|
-
/**
|
|
4
|
-
* Fetch with timeout using AbortController
|
|
5
|
-
* @param url - The URL to fetch
|
|
6
|
-
* @param options - Standard fetch options
|
|
7
|
-
* @param timeoutMs - Timeout in milliseconds (default: 30000)
|
|
8
|
-
* @returns Promise<Response>
|
|
9
|
-
* @throws Error if request times out
|
|
10
|
-
*/
|
|
11
|
-
async function fetchWithTimeout(url, options = {}, timeoutMs = 3e4) {
|
|
12
|
-
const controller = new AbortController();
|
|
13
|
-
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
14
|
-
try {
|
|
15
|
-
const response = await fetch(url, {
|
|
16
|
-
...options,
|
|
17
|
-
signal: controller.signal
|
|
18
|
-
});
|
|
19
|
-
return response;
|
|
20
|
-
} catch (error) {
|
|
21
|
-
if (error instanceof Error && error.name === "AbortError") throw new Error(`Request timeout after ${timeoutMs}ms`);
|
|
22
|
-
throw error;
|
|
23
|
-
} finally {
|
|
24
|
-
clearTimeout(timeoutId);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
Object.defineProperty(exports, 'fetchWithTimeout', {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return fetchWithTimeout;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=fetch-utils-oab6uNp3.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-utils-oab6uNp3.cjs","names":["url: string | URL","options: RequestInit"],"sources":["../src/internal/fetch-utils.ts"],"sourcesContent":["/**\n * Fetch with timeout using AbortController\n * @param url - The URL to fetch\n * @param options - Standard fetch options\n * @param timeoutMs - Timeout in milliseconds (default: 30000)\n * @returns Promise<Response>\n * @throws Error if request times out\n */\nexport async function fetchWithTimeout(\n url: string | URL,\n options: RequestInit = {},\n timeoutMs = 30000,\n): Promise<Response> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeoutMs);\n\n try {\n const response = await fetch(url, {\n ...options,\n signal: controller.signal,\n });\n return response;\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new Error(`Request timeout after ${timeoutMs}ms`);\n }\n throw error;\n } finally {\n clearTimeout(timeoutId);\n }\n}\n"],"mappings":";;;;;;;;;;AAQA,eAAsB,iBACpBA,KACAC,UAAuB,CAAE,GACzB,YAAY,KACO;CACnB,MAAM,aAAa,IAAI;CACvB,MAAM,YAAY,WAAW,MAAM,WAAW,OAAO,EAAE,UAAU;AAEjE,KAAI;EACF,MAAM,WAAW,MAAM,MAAM,KAAK;GAChC,GAAG;GACH,QAAQ,WAAW;EACpB,EAAC;AACF,SAAO;CACR,SAAQ,OAAO;AACd,MAAI,iBAAiB,SAAS,MAAM,SAAS,aAC3C,OAAM,IAAI,OAAO,wBAAwB,UAAU;AAErD,QAAM;CACP,UAAS;AACR,eAAa,UAAU;CACxB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-errors-CuRm4PzL.js","names":["context: ServerContext"],"sources":["../src/tools/find-errors.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext } from \"./utils/api-utils\";\nimport type { ServerContext } from \"../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamProjectSlugOrAll,\n ParamTransaction,\n ParamQuery,\n} from \"../schema\";\n\nexport default defineTool({\n name: \"find_errors\",\n description: [\n \"Find errors in Sentry using advanced search syntax.\",\n \"\",\n \"Use this tool when you need to:\",\n \"- Search for production errors in a specific file.\",\n \"- Analyze error patterns and frequencies.\",\n \"- Find recent or frequently occurring errors.\",\n \"\",\n \"<examples>\",\n \"### Find common errors within a file\",\n \"\",\n \"To find common errors within a file, you can use the `filename` parameter. This is a suffix based search, so only using the filename or the direct parent folder of the file. The parent folder is preferred when the filename is in a subfolder or a common filename. If you provide generic filenames like `index.js` you're going to end up finding errors that are might be from completely different projects.\",\n \"\",\n \"```\",\n \"find_errors(organizationSlug='my-organization', filename='index.js', sortBy='count')\",\n \"```\",\n \"\",\n \"### Find recent crashes from the 'peated' project\",\n \"\",\n \"```\",\n \"find_errors(organizationSlug='my-organization', query='is:unresolved error.handled:false', projectSlug='peated', sortBy='last_seen')\",\n \"```\",\n \"\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user passes a parameter in the form of name/otherName, its likely in the format of <organizationSlug>/<projectSlug>.\",\n \"- If only one parameter is provided, and it could be either `organizationSlug` or `projectSlug`, its probably `organizationSlug`, but if you're really uncertain you should call `find_organizations()` first.\",\n \"- If you are looking for issues, in a way that you might be looking for something like 'unresolved errors', you should use the `find_issues()` tool\",\n \"- You can use the `find_tags()` tool to see what user-defined tags are available.\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug,\n regionUrl: ParamRegionUrl.optional(),\n projectSlug: ParamProjectSlugOrAll.optional(),\n filename: z\n .string()\n .trim()\n .describe(\"The filename to search for errors in.\")\n .optional(),\n transaction: ParamTransaction.optional(),\n query: ParamQuery.optional(),\n sortBy: z\n .enum([\"last_seen\", \"count\"])\n .optional()\n .default(\"last_seen\")\n .describe(\n \"Sort the results either by the last time they occurred or the count of occurrences.\",\n ),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n const organizationSlug = params.organizationSlug;\n\n setTag(\"organization.slug\", organizationSlug);\n if (params.projectSlug) setTag(\"project.slug\", params.projectSlug);\n\n const eventList = await apiService.searchErrors({\n organizationSlug,\n projectSlug: params.projectSlug,\n filename: params.filename,\n query: params.query,\n transaction: params.transaction,\n sortBy: params.sortBy as \"last_seen\" | \"count\" | undefined,\n });\n let output = `# Errors in **${organizationSlug}${params.projectSlug ? `/${params.projectSlug}` : \"\"}**\\n\\n`;\n if (params.query)\n output += `These errors match the query \\`${params.query}\\`\\n`;\n if (params.filename)\n output += `These errors are limited to the file suffix \\`${params.filename}\\`\\n`;\n output += \"\\n\";\n if (eventList.length === 0) {\n output += `No results found\\n\\n`;\n output += `We searched within the ${organizationSlug} organization.\\n\\n`;\n return output;\n }\n for (const eventSummary of eventList) {\n output += `## ${eventSummary.issue}\\n\\n`;\n output += `**Description**: ${eventSummary.title}\\n`;\n output += `**Issue ID**: ${eventSummary.issue}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, eventSummary.issue)}\\n`;\n output += `**Project**: ${eventSummary.project}\\n`;\n output += `**Last Seen**: ${eventSummary[\"last_seen()\"]}\\n`;\n output += `**Occurrences**: ${eventSummary[\"count()\"]}\\n\\n`;\n }\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the Issue ID in commit messages (e.g. \\`Fixes <issueID>\\`) to automatically close the issue when the commit is merged.\\n`;\n output += `- You can get more details about an error by using the tool: \\`get_issue_details(organizationSlug=\"${organizationSlug}\", issueId=<issueID>)\\`\\n`;\n return output;\n },\n});\n"],"mappings":";;;;;;;AAaA,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkB;EAClB,WAAW,eAAe,UAAU;EACpC,aAAa,sBAAsB,UAAU;EAC7C,UAAU,EACP,QAAQ,CACR,MAAM,CACN,SAAS,wCAAwC,CACjD,UAAU;EACb,aAAa,iBAAiB,UAAU;EACxC,OAAO,WAAW,UAAU;EAC5B,QAAQ,EACL,KAAK,CAAC,aAAa,OAAQ,EAAC,CAC5B,UAAU,CACV,QAAQ,YAAY,CACpB,SACC,sFACD;CACJ;CACD,MAAM,QAAQ,QAAQA,SAAwB;EAC5C,MAAM,aAAa,sBAAsB,SAAS,EAChD,WAAW,OAAO,UACnB,EAAC;EACF,MAAM,mBAAmB,OAAO;AAEhC,SAAO,qBAAqB,iBAAiB;AAC7C,MAAI,OAAO,YAAa,QAAO,gBAAgB,OAAO,YAAY;EAElE,MAAM,YAAY,MAAM,WAAW,aAAa;GAC9C;GACA,aAAa,OAAO;GACpB,UAAU,OAAO;GACjB,OAAO,OAAO;GACd,aAAa,OAAO;GACpB,QAAQ,OAAO;EAChB,EAAC;EACF,IAAI,UAAU,gBAAgB,mBAAmB,OAAO,eAAe,GAAG,OAAO,gBAAgB,GAAG;AACpG,MAAI,OAAO,MACT,YAAW,iCAAiC,OAAO,MAAM;AAC3D,MAAI,OAAO,SACT,YAAW,gDAAgD,OAAO,SAAS;AAC7E,YAAU;AACV,MAAI,UAAU,WAAW,GAAG;AAC1B,cAAW;AACX,cAAW,yBAAyB,iBAAiB;AACrD,UAAO;EACR;AACD,OAAK,MAAM,gBAAgB,WAAW;AACpC,cAAW,KAAK,aAAa,MAAM;AACnC,cAAW,mBAAmB,aAAa,MAAM;AACjD,cAAW,gBAAgB,aAAa,MAAM;AAC9C,cAAW,WAAW,WAAW,YAAY,kBAAkB,aAAa,MAAM,CAAC;AACnF,cAAW,eAAe,aAAa,QAAQ;AAC/C,cAAW,iBAAiB,aAAa,eAAe;AACxD,cAAW,mBAAmB,aAAa,WAAW;EACvD;AACD,YAAU;AACV,aAAW;AACX,aAAW,qGAAqG,iBAAiB;AACjI,SAAO;CACR;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-errors-Drzv7hzM.cjs","names":["ParamOrganizationSlug","context: ServerContext"],"sources":["../src/tools/find-errors.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext } from \"./utils/api-utils\";\nimport type { ServerContext } from \"../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamProjectSlugOrAll,\n ParamTransaction,\n ParamQuery,\n} from \"../schema\";\n\nexport default defineTool({\n name: \"find_errors\",\n description: [\n \"Find errors in Sentry using advanced search syntax.\",\n \"\",\n \"Use this tool when you need to:\",\n \"- Search for production errors in a specific file.\",\n \"- Analyze error patterns and frequencies.\",\n \"- Find recent or frequently occurring errors.\",\n \"\",\n \"<examples>\",\n \"### Find common errors within a file\",\n \"\",\n \"To find common errors within a file, you can use the `filename` parameter. This is a suffix based search, so only using the filename or the direct parent folder of the file. The parent folder is preferred when the filename is in a subfolder or a common filename. If you provide generic filenames like `index.js` you're going to end up finding errors that are might be from completely different projects.\",\n \"\",\n \"```\",\n \"find_errors(organizationSlug='my-organization', filename='index.js', sortBy='count')\",\n \"```\",\n \"\",\n \"### Find recent crashes from the 'peated' project\",\n \"\",\n \"```\",\n \"find_errors(organizationSlug='my-organization', query='is:unresolved error.handled:false', projectSlug='peated', sortBy='last_seen')\",\n \"```\",\n \"\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user passes a parameter in the form of name/otherName, its likely in the format of <organizationSlug>/<projectSlug>.\",\n \"- If only one parameter is provided, and it could be either `organizationSlug` or `projectSlug`, its probably `organizationSlug`, but if you're really uncertain you should call `find_organizations()` first.\",\n \"- If you are looking for issues, in a way that you might be looking for something like 'unresolved errors', you should use the `find_issues()` tool\",\n \"- You can use the `find_tags()` tool to see what user-defined tags are available.\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug,\n regionUrl: ParamRegionUrl.optional(),\n projectSlug: ParamProjectSlugOrAll.optional(),\n filename: z\n .string()\n .trim()\n .describe(\"The filename to search for errors in.\")\n .optional(),\n transaction: ParamTransaction.optional(),\n query: ParamQuery.optional(),\n sortBy: z\n .enum([\"last_seen\", \"count\"])\n .optional()\n .default(\"last_seen\")\n .describe(\n \"Sort the results either by the last time they occurred or the count of occurrences.\",\n ),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n const organizationSlug = params.organizationSlug;\n\n setTag(\"organization.slug\", organizationSlug);\n if (params.projectSlug) setTag(\"project.slug\", params.projectSlug);\n\n const eventList = await apiService.searchErrors({\n organizationSlug,\n projectSlug: params.projectSlug,\n filename: params.filename,\n query: params.query,\n transaction: params.transaction,\n sortBy: params.sortBy as \"last_seen\" | \"count\" | undefined,\n });\n let output = `# Errors in **${organizationSlug}${params.projectSlug ? `/${params.projectSlug}` : \"\"}**\\n\\n`;\n if (params.query)\n output += `These errors match the query \\`${params.query}\\`\\n`;\n if (params.filename)\n output += `These errors are limited to the file suffix \\`${params.filename}\\`\\n`;\n output += \"\\n\";\n if (eventList.length === 0) {\n output += `No results found\\n\\n`;\n output += `We searched within the ${organizationSlug} organization.\\n\\n`;\n return output;\n }\n for (const eventSummary of eventList) {\n output += `## ${eventSummary.issue}\\n\\n`;\n output += `**Description**: ${eventSummary.title}\\n`;\n output += `**Issue ID**: ${eventSummary.issue}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, eventSummary.issue)}\\n`;\n output += `**Project**: ${eventSummary.project}\\n`;\n output += `**Last Seen**: ${eventSummary[\"last_seen()\"]}\\n`;\n output += `**Occurrences**: ${eventSummary[\"count()\"]}\\n\\n`;\n }\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the Issue ID in commit messages (e.g. \\`Fixes <issueID>\\`) to automatically close the issue when the commit is merged.\\n`;\n output += `- You can get more details about an error by using the tool: \\`get_issue_details(organizationSlug=\"${organizationSlug}\", issueId=<issueID>)\\`\\n`;\n return output;\n },\n});\n"],"mappings":";;;;;;;;AAaA,0BAAe,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkBA;EAClB,WAAW,8BAAe,UAAU;EACpC,aAAa,qCAAsB,UAAU;EAC7C,UAAU,MACP,QAAQ,CACR,MAAM,CACN,SAAS,wCAAwC,CACjD,UAAU;E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ServerContext","UserInputError"],"sources":["../src/tools/find-issues.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext } from \"./utils/api-utils\";\nimport { UserInputError } from \"../errors\";\nimport type { ServerContext } from \"../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamProjectSlug,\n ParamQuery,\n} from \"../schema\";\n\nexport default defineTool({\n name: \"find_issues\",\n description: [\n \"Find issues in Sentry.\",\n \"\",\n \"Use this tool when you need to:\",\n \"- View all issues in a Sentry organization\",\n \"\",\n \"If you're looking for more granular data beyond a summary of identified problems, you should use the `find_errors()` or `find_transactions()` tools instead.\",\n \"\",\n \"<examples>\",\n \"### Find the newest unresolved issues across 'my-organization'\",\n \"\",\n \"```\",\n \"find_issues(organizationSlug='my-organization', query='is:unresolved', sortBy='last_seen')\",\n \"```\",\n \"\",\n \"### Find the most frequently occurring crashes in the 'my-project' project\",\n \"\",\n \"```\",\n \"find_issues(organizationSlug='my-organization', projectSlug='my-project', query='is:unresolved error.handled:false', sortBy='count')\",\n \"```\",\n \"\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user passes a parameter in the form of name/otherName, its likely in the format of <organizationSlug>/<projectSlug>.\",\n \"- You can use the `find_tags()` tool to see what user-defined tags are available.\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug,\n regionUrl: ParamRegionUrl.optional(),\n projectSlug: ParamProjectSlug.optional(),\n query: ParamQuery.optional(),\n sortBy: z\n .enum([\"last_seen\", \"first_seen\", \"count\", \"userCount\"])\n .describe(\n \"Sort the results either by the last time they occurred, the first time they occurred, the count of occurrences, or the number of users affected.\",\n )\n .optional(),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n const organizationSlug = params.organizationSlug;\n\n if (!organizationSlug) {\n throw new UserInputError(\n \"Organization slug is required. Please provide an organizationSlug parameter.\",\n );\n }\n\n setTag(\"organization.slug\", organizationSlug);\n\n const sortByMap = {\n last_seen: \"date\" as const,\n first_seen: \"new\" as const,\n count: \"freq\" as const,\n userCount: \"user\" as const,\n };\n const issues = await apiService.listIssues({\n organizationSlug,\n projectSlug: params.projectSlug,\n query: params.query,\n sortBy: params.sortBy\n ? sortByMap[params.sortBy as keyof typeof sortByMap]\n : undefined,\n });\n let output = `# Issues in **${organizationSlug}${params.projectSlug ? `/${params.projectSlug}` : \"\"}**\\n\\n`;\n if (issues.length === 0) {\n output += \"No issues found.\\n\";\n return output;\n }\n output += issues\n .map((issue) =>\n [\n `## ${issue.shortId}`,\n \"\",\n `**Description**: ${issue.title}`,\n `**Culprit**: ${issue.culprit}`,\n `**First Seen**: ${new Date(issue.firstSeen).toISOString()}`,\n `**Last Seen**: ${new Date(issue.lastSeen).toISOString()}`,\n `**URL**: ${apiService.getIssueUrl(organizationSlug, issue.shortId)}`,\n ].join(\"\\n\"),\n )\n .join(\"\\n\\n\");\n output += \"\\n\\n\";\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the Issue ID in commit messages (e.g. \\`Fixes <issueID>\\`) to automatically close the issue when the commit is merged.\\n`;\n output += `- You can get more details about a specific issue by using the tool: \\`get_issue_details(organizationSlug=\"${organizationSlug}\", issueId=<issueID>)\\`\\n`;\n return output;\n },\n});\n"],"mappings":";;;;;;;;;AAaA,0BAAe,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkBA;EAClB,WAAW,8BAAe,UAAU;EACpC,aAAa,gCAAiB,UAAU;EACxC,OAAO,0BAAW,UAAU;EAC5B,QAAQ,MACL,KAAK;GAAC;GAAa;GAAc;GAAS;EAAY,E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