@sentry/mcp-server 0.17.0 → 0.18.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/README.md +32 -11
- package/dist/about-CDAN_HuU.js +136 -0
- package/dist/about-CDAN_HuU.js.map +1 -0
- package/dist/about-CteXVo1Q.d.ts +10 -0
- package/dist/about-CteXVo1Q.d.ts.map +1 -0
- package/dist/about-CwQvsGSc.d.cts +10 -0
- package/dist/about-CwQvsGSc.d.cts.map +1 -0
- package/dist/about-aDGhlM6f.cjs +142 -0
- package/dist/about-aDGhlM6f.cjs.map +1 -0
- package/dist/agent-BF4d0oSb.cjs +66 -0
- package/dist/agent-BF4d0oSb.cjs.map +1 -0
- package/dist/agent-CP5e4nTv.js +60 -0
- package/dist/agent-CP5e4nTv.js.map +1 -0
- package/dist/agent-D9xBrLvD.cjs +49 -0
- package/dist/agent-D9xBrLvD.cjs.map +1 -0
- package/dist/agent-DAlB2lDx.d.cts +34 -0
- package/dist/agent-DAlB2lDx.d.cts.map +1 -0
- package/dist/agent-DD6nYWBQ.d.cts +92 -0
- package/dist/agent-DD6nYWBQ.d.cts.map +1 -0
- package/dist/agent-DzpIyyqs.js +43 -0
- package/dist/agent-DzpIyyqs.js.map +1 -0
- package/dist/agent-UxF0J0wb.d.ts +92 -0
- package/dist/agent-UxF0J0wb.d.ts.map +1 -0
- package/dist/agent-xEtb_OFK.d.ts +34 -0
- package/dist/agent-xEtb_OFK.d.ts.map +1 -0
- package/dist/{analyze-issue-with-seer-Dw9iqvSk.cjs → analyze-issue-with-seer-Cf0jCiKP.cjs} +33 -35
- package/dist/analyze-issue-with-seer-Cf0jCiKP.cjs.map +1 -0
- package/dist/{analyze-issue-with-seer-DcSwrWrs.js → analyze-issue-with-seer-DqwczSTV.js} +12 -14
- package/dist/analyze-issue-with-seer-DqwczSTV.js.map +1 -0
- package/dist/{api-utils-DFWUfQ83.cjs → api-D9yO5I-i.cjs} +15 -20
- package/dist/api-D9yO5I-i.cjs.map +1 -0
- package/dist/api-client/client.cjs +4 -4
- package/dist/api-client/client.d.cts +4 -4
- package/dist/api-client/client.d.ts +4 -4
- package/dist/api-client/client.js +5 -4
- package/dist/api-client/errors.cjs +11 -0
- package/dist/api-client/errors.d.cts +2 -0
- package/dist/api-client/errors.d.ts +2 -0
- package/dist/api-client/errors.js +3 -0
- package/dist/api-client/index.cjs +20 -7
- package/dist/api-client/index.d.cts +6 -5
- package/dist/api-client/index.d.ts +6 -5
- package/dist/api-client/index.js +7 -6
- package/dist/api-client/schema.cjs +5 -1
- package/dist/api-client/schema.d.cts +2 -2
- package/dist/api-client/schema.d.ts +2 -2
- package/dist/api-client/schema.js +2 -2
- package/dist/api-client/types.cjs +1 -1
- package/dist/api-client/types.d.cts +3 -3
- package/dist/api-client/types.d.ts +3 -3
- package/dist/api-client/types.js +1 -1
- package/dist/{api-utils-BlUSO8xh.js → api-mjnGhOW2.js} +15 -20
- package/dist/api-mjnGhOW2.js.map +1 -0
- package/dist/callEmbeddedAgent-BRz60bxa.cjs +44 -0
- package/dist/callEmbeddedAgent-BRz60bxa.cjs.map +1 -0
- package/dist/callEmbeddedAgent-C0pC9du1.js +38 -0
- package/dist/callEmbeddedAgent-C0pC9du1.js.map +1 -0
- package/dist/cli/parse.cjs +5 -0
- package/dist/cli/parse.d.cts +12 -0
- package/dist/cli/parse.d.cts.map +1 -0
- package/dist/cli/parse.d.ts +12 -0
- package/dist/cli/parse.d.ts.map +1 -0
- package/dist/cli/parse.js +3 -0
- package/dist/cli/resolve.cjs +7 -0
- package/dist/cli/resolve.d.cts +11 -0
- package/dist/cli/resolve.d.cts.map +1 -0
- package/dist/cli/resolve.d.ts +11 -0
- package/dist/cli/resolve.d.ts.map +1 -0
- package/dist/cli/resolve.js +6 -0
- package/dist/cli/types.d.cts +3 -0
- package/dist/cli/types.d.ts +3 -0
- package/dist/cli/usage.cjs +3 -0
- package/dist/cli/usage.d.cts +9 -0
- package/dist/cli/usage.d.cts.map +1 -0
- package/dist/cli/usage.d.ts +9 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +3 -0
- package/dist/{client-CPrEfAwa.cjs → client-AVVG7J24.cjs} +126 -71
- package/dist/client-AVVG7J24.cjs.map +1 -0
- package/dist/{client-C_dDreKj.d.ts → client-B0wezrpt.d.cts} +99 -15
- package/dist/client-B0wezrpt.d.cts.map +1 -0
- package/dist/{client-MaVV1gVC.js → client-BqrNpqZW.js} +127 -66
- package/dist/client-BqrNpqZW.js.map +1 -0
- package/dist/{client-CgS3tjJG.d.cts → client-D-KqRd94.d.ts} +101 -17
- package/dist/client-D-KqRd94.d.ts.map +1 -0
- package/dist/config-CqdBCqLx.js +74 -0
- package/dist/config-CqdBCqLx.js.map +1 -0
- package/dist/{config-BvtWiL3I.js → config-DDf8XyZs.js} +173 -2
- package/dist/config-DDf8XyZs.js.map +1 -0
- package/dist/config-DFt-16ni.cjs +80 -0
- package/dist/config-DFt-16ni.cjs.map +1 -0
- package/dist/{config-CD-5FpOO.cjs → config-DsvSjPCG.cjs} +178 -1
- package/dist/config-DsvSjPCG.cjs.map +1 -0
- package/dist/{constants-S7AU45oQ.js → constants-BPM_OWt0.js} +22 -2
- package/dist/constants-BPM_OWt0.js.map +1 -0
- package/dist/{constants-ClkMK29-.cjs → constants-DJrjLmh5.cjs} +39 -1
- package/dist/constants-DJrjLmh5.cjs.map +1 -0
- package/dist/constants.cjs +4 -1
- package/dist/constants.d.cts +12 -1
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.ts +12 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -2
- package/dist/{create-dsn-QDLdwhDO.js → create-dsn-BhshlP7l.js} +5 -4
- package/dist/{create-dsn-QDLdwhDO.js.map → create-dsn-BhshlP7l.js.map} +1 -1
- package/dist/{create-dsn-C6IPwoVO.cjs → create-dsn-DaHidLhE.cjs} +7 -6
- package/dist/{create-dsn-C6IPwoVO.cjs.map → create-dsn-DaHidLhE.cjs.map} +1 -1
- package/dist/{create-project-Cax3fWey.js → create-project-C3laecaU.js} +6 -5
- package/dist/create-project-C3laecaU.js.map +1 -0
- package/dist/{create-project-DdSF58TR.cjs → create-project-xszOpGTC.cjs} +8 -7
- package/dist/create-project-xszOpGTC.cjs.map +1 -0
- package/dist/{create-team-nm06goO5.js → create-team-CTN-DxOE.js} +5 -4
- package/dist/create-team-CTN-DxOE.js.map +1 -0
- package/dist/{create-team-CXaLcylp.cjs → create-team-DmnJHSIx.cjs} +7 -6
- package/dist/create-team-DmnJHSIx.cjs.map +1 -0
- package/dist/{discover-dataset-fields-BEnyqPSq.js → dataset-fields-By43SxJp.js} +13 -14
- package/dist/dataset-fields-By43SxJp.js.map +1 -0
- package/dist/{discover-dataset-fields-Cl7HpVkm.cjs → dataset-fields-DacS0qF0.cjs} +13 -14
- package/dist/dataset-fields-DacS0qF0.cjs.map +1 -0
- package/dist/define-2Lj8Lm1t.js +8 -0
- package/dist/define-2Lj8Lm1t.js.map +1 -0
- package/dist/{defineTool-lWNTzWl_.cjs → define-BfP4rFlE.cjs} +2 -2
- package/dist/define-BfP4rFlE.cjs.map +1 -0
- package/dist/enhance-error-C7AVt85N.js +32 -0
- package/dist/enhance-error-C7AVt85N.js.map +1 -0
- package/dist/enhance-error-CAREhbDf.cjs +37 -0
- package/dist/enhance-error-CAREhbDf.cjs.map +1 -0
- package/dist/error-handling-efwohgKv.js +97 -0
- package/dist/error-handling-efwohgKv.js.map +1 -0
- package/dist/error-handling-qfa1BeDb.cjs +132 -0
- package/dist/error-handling-qfa1BeDb.cjs.map +1 -0
- package/dist/errors-00Iz6Wmy.d.cts +20 -0
- package/dist/errors-00Iz6Wmy.d.cts.map +1 -0
- package/dist/errors-CNTY5dED.cjs +271 -0
- package/dist/errors-CNTY5dED.cjs.map +1 -0
- package/dist/errors-Cn4l-BlC.d.ts +20 -0
- package/dist/errors-Cn4l-BlC.d.ts.map +1 -0
- package/dist/errors-DMiENfq7.d.cts +126 -0
- package/dist/errors-DMiENfq7.d.cts.map +1 -0
- package/dist/errors-Dr7Q6mD5.js +217 -0
- package/dist/errors-Dr7Q6mD5.js.map +1 -0
- package/dist/errors-bxPCd8AO.d.ts +126 -0
- package/dist/errors-bxPCd8AO.d.ts.map +1 -0
- package/dist/errors.d.cts +2 -20
- package/dist/errors.d.ts +2 -20
- package/dist/{fetch-utils-C_Xj921x.js → fetch-utils-DRWItYjp.js} +1 -1
- package/dist/{fetch-utils-C_Xj921x.js.map → fetch-utils-DRWItYjp.js.map} +1 -1
- package/dist/{fetch-utils-DkcYwqBo.cjs → fetch-utils-bHWZV7j9.cjs} +1 -1
- package/dist/{fetch-utils-DkcYwqBo.cjs.map → fetch-utils-bHWZV7j9.cjs.map} +1 -1
- package/dist/{find-dsns-vQolGM7e.cjs → find-dsns-D0l3siyF.cjs} +7 -6
- package/dist/find-dsns-D0l3siyF.cjs.map +1 -0
- package/dist/{find-dsns-C3G5aBm1.js → find-dsns-U4CCcoTv.js} +5 -4
- package/dist/find-dsns-U4CCcoTv.js.map +1 -0
- package/dist/{find-organizations-BDtHkcFV.cjs → find-organizations-Ca-zpAlI.cjs} +7 -6
- package/dist/find-organizations-Ca-zpAlI.cjs.map +1 -0
- package/dist/{find-organizations-Cs1GvZtJ.js → find-organizations-HUZFa8ZA.js} +5 -4
- package/dist/find-organizations-HUZFa8ZA.js.map +1 -0
- package/dist/{find-projects-xM2L0U1W.cjs → find-projects-CWNLthwg.cjs} +7 -6
- package/dist/find-projects-CWNLthwg.cjs.map +1 -0
- package/dist/{find-projects-B0NdOjBO.js → find-projects-Dy1_O9L0.js} +5 -4
- package/dist/find-projects-Dy1_O9L0.js.map +1 -0
- package/dist/{find-releases-BBTYr5Bx.cjs → find-releases-BtazPcQH.cjs} +7 -6
- package/dist/find-releases-BtazPcQH.cjs.map +1 -0
- package/dist/{find-releases-BO2OF_uR.js → find-releases-DN_BfQM2.js} +5 -4
- package/dist/find-releases-DN_BfQM2.js.map +1 -0
- package/dist/{find-teams-CqUwp0EI.js → find-teams-CRVT4KOg.js} +5 -4
- package/dist/find-teams-CRVT4KOg.js.map +1 -0
- package/dist/{find-teams-B237Aq8U.cjs → find-teams-_zAHPVGx.cjs} +7 -6
- package/dist/find-teams-_zAHPVGx.cjs.map +1 -0
- package/dist/{formatters-DbqofIoy.cjs → formatters-Bzx0sr5R.cjs} +17 -4
- package/dist/formatters-Bzx0sr5R.cjs.map +1 -0
- package/dist/{formatters-CfeBjhXZ.cjs → formatters-CCZdBmLd.cjs} +38 -26
- package/dist/formatters-CCZdBmLd.cjs.map +1 -0
- package/dist/{formatters-B3ONbRhI.js → formatters-DJM9_F3A.js} +12 -5
- package/dist/formatters-DJM9_F3A.js.map +1 -0
- package/dist/{formatters-DSYXBiQx.js → formatters-DJSiRyVi.js} +33 -27
- package/dist/formatters-DJSiRyVi.js.map +1 -0
- package/dist/{formatting-DIvCVunN.js → formatting-BjCK9XwW.js} +56 -12
- package/dist/formatting-BjCK9XwW.js.map +1 -0
- package/dist/{formatting-utils-DDz14xeB.cjs → formatting-CJKoPqjy.cjs} +2 -2
- package/dist/formatting-CJKoPqjy.cjs.map +1 -0
- package/dist/{formatting-utils-C3sej5ER.js → formatting-CfpTtZLo.js} +2 -2
- package/dist/formatting-CfpTtZLo.js.map +1 -0
- package/dist/{formatting-C180PVwd.cjs → formatting-CqmsvuAY.cjs} +57 -13
- package/dist/formatting-CqmsvuAY.cjs.map +1 -0
- package/dist/{formatting-BxyhA4G3.d.cts → formatting-XMmhMjRz.d.cts} +4 -4
- package/dist/formatting-XMmhMjRz.d.cts.map +1 -0
- package/dist/{formatting-C80LN9iK.d.ts → formatting-l3qx5d7L.d.ts} +4 -4
- package/dist/formatting-l3qx5d7L.d.ts.map +1 -0
- package/dist/{get-doc-BfMg0GIa.cjs → get-doc-Euz6NiM3.cjs} +7 -6
- package/dist/get-doc-Euz6NiM3.cjs.map +1 -0
- package/dist/{get-doc-DyqJe6TP.js → get-doc-JDwOkY2j.js} +5 -4
- package/dist/get-doc-JDwOkY2j.js.map +1 -0
- package/dist/{get-event-attachment-o0oH43Tv.cjs → get-event-attachment-DvpQ-dEP.cjs} +7 -6
- package/dist/get-event-attachment-DvpQ-dEP.cjs.map +1 -0
- package/dist/{get-event-attachment-B-ElqztF.js → get-event-attachment-pIJmUfFE.js} +5 -4
- package/dist/get-event-attachment-pIJmUfFE.js.map +1 -0
- package/dist/{get-issue-details-CzroF7HR.js → get-issue-details-B1PDMmMY.js} +40 -20
- package/dist/get-issue-details-B1PDMmMY.js.map +1 -0
- package/dist/{get-issue-details-CP_RyCpt.cjs → get-issue-details-BH75EnNk.cjs} +42 -22
- package/dist/get-issue-details-BH75EnNk.cjs.map +1 -0
- package/dist/get-trace-details-Bksygq21.cjs +308 -0
- package/dist/get-trace-details-Bksygq21.cjs.map +1 -0
- package/dist/get-trace-details-CaK0JMf4.js +302 -0
- package/dist/get-trace-details-CaK0JMf4.js.map +1 -0
- package/dist/{handler-aE_8mEm7.js → handler-BbqDy4DA.js} +39 -41
- package/dist/handler-BbqDy4DA.js.map +1 -0
- package/dist/{handler-O9fYgC9a.cjs → handler-C0zOOLbO.cjs} +42 -27
- package/dist/handler-C0zOOLbO.cjs.map +1 -0
- package/dist/{handler-BPPTAi7I.d.ts → handler-CcbbXK_f.d.ts} +4 -4
- package/dist/handler-CcbbXK_f.d.ts.map +1 -0
- package/dist/{handler-cUB6XcUV.d.ts → handler-Ct9Z_sTZ.d.ts} +4 -4
- package/dist/handler-Ct9Z_sTZ.d.ts.map +1 -0
- package/dist/{handler-BGhr9FJM.d.cts → handler-DSYbwPgv.d.cts} +4 -4
- package/dist/handler-DSYbwPgv.d.cts.map +1 -0
- package/dist/{handler-ykkULTZ-.js → handler-DyBdUYam.js} +40 -25
- package/dist/handler-DyBdUYam.js.map +1 -0
- package/dist/{handler-BZ3hKPb8.d.cts → handler-RV4XhU8F.d.cts} +4 -4
- package/dist/handler-RV4XhU8F.d.cts.map +1 -0
- package/dist/{handler-BH_OLIbD.cjs → handler-cy5oD28N.cjs} +41 -43
- package/dist/handler-cy5oD28N.cjs.map +1 -0
- package/dist/index.cjs +113 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +113 -96
- package/dist/index.js.map +1 -1
- package/dist/internal/agents/callEmbeddedAgent.cjs +3 -0
- package/dist/internal/agents/callEmbeddedAgent.d.cts +33 -0
- package/dist/internal/agents/callEmbeddedAgent.d.cts.map +1 -0
- package/dist/internal/agents/callEmbeddedAgent.d.ts +33 -0
- package/dist/internal/agents/callEmbeddedAgent.d.ts.map +1 -0
- package/dist/internal/agents/callEmbeddedAgent.js +3 -0
- package/dist/internal/agents/tools/dataset-fields.cjs +15 -0
- package/dist/{agent-tools/discover-dataset-fields.d.ts → internal/agents/tools/dataset-fields.d.cts} +18 -19
- package/dist/internal/agents/tools/dataset-fields.d.cts.map +1 -0
- package/dist/{agent-tools/discover-dataset-fields.d.cts → internal/agents/tools/dataset-fields.d.ts} +18 -19
- package/dist/internal/agents/tools/dataset-fields.d.ts.map +1 -0
- package/dist/internal/agents/tools/dataset-fields.js +12 -0
- package/dist/internal/agents/tools/otel-semantics.cjs +13 -0
- package/dist/internal/agents/tools/otel-semantics.d.cts +41 -0
- package/dist/internal/agents/tools/otel-semantics.d.cts.map +1 -0
- package/dist/internal/agents/tools/otel-semantics.d.ts +41 -0
- package/dist/internal/agents/tools/otel-semantics.d.ts.map +1 -0
- package/dist/internal/agents/tools/otel-semantics.js +12 -0
- package/dist/internal/agents/tools/utils.cjs +11 -0
- package/dist/internal/agents/tools/utils.d.cts +2 -0
- package/dist/internal/agents/tools/utils.d.ts +2 -0
- package/dist/internal/agents/tools/utils.js +11 -0
- package/dist/internal/agents/tools/whoami.cjs +13 -0
- package/dist/internal/agents/tools/whoami.d.cts +33 -0
- package/dist/internal/agents/tools/whoami.d.cts.map +1 -0
- package/dist/internal/agents/tools/whoami.d.ts +33 -0
- package/dist/internal/agents/tools/whoami.d.ts.map +1 -0
- package/dist/internal/agents/tools/whoami.js +12 -0
- package/dist/internal/error-handling.cjs +16 -0
- package/dist/internal/error-handling.d.cts +40 -0
- package/dist/internal/error-handling.d.cts.map +1 -0
- package/dist/internal/error-handling.d.ts +40 -0
- package/dist/internal/error-handling.d.ts.map +1 -0
- package/dist/internal/error-handling.js +11 -0
- package/dist/internal/fetch-utils.cjs +1 -1
- package/dist/internal/fetch-utils.d.cts +33 -2
- package/dist/internal/fetch-utils.d.cts.map +1 -0
- package/dist/internal/fetch-utils.d.ts +33 -2
- package/dist/internal/fetch-utils.d.ts.map +1 -0
- package/dist/internal/fetch-utils.js +1 -1
- package/dist/internal/formatting.cjs +2 -2
- package/dist/internal/formatting.d.cts +6 -5
- package/dist/internal/formatting.d.ts +6 -5
- package/dist/internal/formatting.js +2 -2
- package/dist/internal/issue-helpers.cjs +1 -1
- package/dist/internal/issue-helpers.d.cts +1 -1
- package/dist/internal/issue-helpers.d.ts +1 -1
- package/dist/internal/issue-helpers.js +1 -1
- package/dist/internal/sentry-scrubbing.cjs +6 -0
- package/dist/internal/sentry-scrubbing.d.cts +28 -0
- package/dist/internal/sentry-scrubbing.d.cts.map +1 -0
- package/dist/internal/sentry-scrubbing.d.ts +28 -0
- package/dist/internal/sentry-scrubbing.d.ts.map +1 -0
- package/dist/internal/sentry-scrubbing.js +3 -0
- package/dist/internal/test-fixtures.d.cts +242 -152
- package/dist/internal/test-fixtures.d.cts.map +1 -1
- package/dist/internal/test-fixtures.d.ts +104 -14
- package/dist/internal/test-fixtures.d.ts.map +1 -1
- package/dist/internal/tool-helpers/api.cjs +14 -0
- package/dist/{tools/utils/api-utils.d.cts → internal/tool-helpers/api.d.cts} +11 -10
- package/dist/internal/tool-helpers/api.d.cts.map +1 -0
- package/dist/{tools/utils/api-utils.d.ts → internal/tool-helpers/api.d.ts} +11 -10
- package/dist/internal/tool-helpers/api.d.ts.map +1 -0
- package/dist/internal/tool-helpers/api.js +12 -0
- package/dist/internal/tool-helpers/define.cjs +3 -0
- package/dist/internal/tool-helpers/define.d.cts +13 -0
- package/dist/internal/tool-helpers/define.d.cts.map +1 -0
- package/dist/internal/tool-helpers/define.d.ts +13 -0
- package/dist/internal/tool-helpers/define.d.ts.map +1 -0
- package/dist/internal/tool-helpers/define.js +3 -0
- package/dist/internal/tool-helpers/enhance-error.cjs +10 -0
- package/dist/internal/tool-helpers/enhance-error.d.cts +29 -0
- package/dist/internal/tool-helpers/enhance-error.d.cts.map +1 -0
- package/dist/internal/tool-helpers/enhance-error.d.ts +29 -0
- package/dist/internal/tool-helpers/enhance-error.d.ts.map +1 -0
- package/dist/internal/tool-helpers/enhance-error.js +10 -0
- package/dist/internal/tool-helpers/formatting.cjs +3 -0
- package/dist/internal/tool-helpers/formatting.d.cts +16 -0
- package/dist/internal/tool-helpers/formatting.d.cts.map +1 -0
- package/dist/internal/tool-helpers/formatting.d.ts +16 -0
- package/dist/internal/tool-helpers/formatting.d.ts.map +1 -0
- package/dist/internal/tool-helpers/formatting.js +3 -0
- package/dist/internal/tool-helpers/issue.cjs +8 -0
- package/dist/internal/tool-helpers/issue.d.cts +8 -0
- package/dist/internal/tool-helpers/issue.d.ts +8 -0
- package/dist/internal/tool-helpers/issue.js +7 -0
- package/dist/internal/tool-helpers/seer.cjs +11 -0
- package/dist/{tools/utils/seer-utils.d.cts → internal/tool-helpers/seer.d.cts} +8 -7
- package/dist/internal/tool-helpers/seer.d.cts.map +1 -0
- package/dist/{tools/utils/seer-utils.d.ts → internal/tool-helpers/seer.d.ts} +8 -7
- package/dist/internal/tool-helpers/seer.d.ts.map +1 -0
- package/dist/{tools/utils/seer-utils.js → internal/tool-helpers/seer.js} +1 -1
- package/dist/internal/tool-helpers/validate-region-url.cjs +5 -0
- package/dist/internal/tool-helpers/validate-region-url.d.cts +20 -0
- package/dist/internal/tool-helpers/validate-region-url.d.cts.map +1 -0
- package/dist/internal/tool-helpers/validate-region-url.d.ts +20 -0
- package/dist/internal/tool-helpers/validate-region-url.d.ts.map +1 -0
- package/dist/internal/tool-helpers/validate-region-url.js +5 -0
- package/dist/{issue-helpers-s5fKLwJZ.cjs → issue-helpers-1qxzc7ww.cjs} +1 -1
- package/dist/{issue-helpers-s5fKLwJZ.cjs.map → issue-helpers-1qxzc7ww.cjs.map} +1 -1
- package/dist/{issue-helpers-CRx45FYG.js → issue-helpers-Bjp6xu5H.js} +1 -1
- package/dist/{issue-helpers-CRx45FYG.js.map → issue-helpers-Bjp6xu5H.js.map} +1 -1
- package/dist/{issue-helpers-Cz01Ipvl.d.cts → issue-helpers-Cf6mvHG1.d.cts} +1 -1
- package/dist/{issue-helpers-Cz01Ipvl.d.cts.map → issue-helpers-Cf6mvHG1.d.cts.map} +1 -1
- package/dist/{issue-helpers-D1_Uqr-F.d.ts → issue-helpers-kwhe1ipy.d.ts} +1 -1
- package/dist/{issue-helpers-D1_Uqr-F.d.ts.map → issue-helpers-kwhe1ipy.d.ts.map} +1 -1
- package/dist/{logging-tGU_SYcA.js → logging-CBMxr4i2.js} +1 -1
- package/dist/{logging-tGU_SYcA.js.map → logging-CBMxr4i2.js.map} +1 -1
- package/dist/{logging-BpL53bY6.cjs → logging-rvUPDKax.cjs} +1 -1
- package/dist/{logging-BpL53bY6.cjs.map → logging-rvUPDKax.cjs.map} +1 -1
- package/dist/logging.cjs +1 -1
- package/dist/logging.js +1 -1
- package/dist/{lookup-otel-semantics-Dt667kdR.js → otel-semantics-BFRGhf6y.js} +88 -94
- package/dist/otel-semantics-BFRGhf6y.js.map +1 -0
- package/dist/{lookup-otel-semantics-BbriXZAx.cjs → otel-semantics-CkUpXWEJ.cjs} +88 -94
- package/dist/otel-semantics-CkUpXWEJ.cjs.map +1 -0
- package/dist/parse-C3tRlsy-.js +89 -0
- package/dist/parse-C3tRlsy-.js.map +1 -0
- package/dist/parse-CeFc4xnt.cjs +107 -0
- package/dist/parse-CeFc4xnt.cjs.map +1 -0
- package/dist/permissions-C-q0Y5bL.d.ts +79 -0
- package/dist/permissions-C-q0Y5bL.d.ts.map +1 -0
- package/dist/permissions-Cm5e34n2.d.cts +79 -0
- package/dist/permissions-Cm5e34n2.d.cts.map +1 -0
- package/dist/permissions-DRdH39Fe.js +155 -0
- package/dist/permissions-DRdH39Fe.js.map +1 -0
- package/dist/permissions-DuDYuCjy.cjs +209 -0
- package/dist/permissions-DuDYuCjy.cjs.map +1 -0
- package/dist/permissions.cjs +11 -0
- package/dist/permissions.d.cts +2 -0
- package/dist/permissions.d.ts +2 -0
- package/dist/permissions.js +3 -0
- package/dist/{promptDefinitions-5V4-M69A.cjs → promptDefinitions-02aQWFKD.cjs} +2 -2
- package/dist/{promptDefinitions-5V4-M69A.cjs.map → promptDefinitions-02aQWFKD.cjs.map} +1 -1
- package/dist/{promptDefinitions-DehpwJfn.d.ts → promptDefinitions-ImFNiWkX.d.cts} +3 -3
- package/dist/promptDefinitions-ImFNiWkX.d.cts.map +1 -0
- package/dist/{promptDefinitions-CVHtYaj8.d.cts → promptDefinitions-Y-mt2_IM.d.ts} +3 -3
- package/dist/promptDefinitions-Y-mt2_IM.d.ts.map +1 -0
- package/dist/{promptDefinitions-DyshsF51.js → promptDefinitions-wR6u6ZJE.js} +2 -2
- package/dist/{promptDefinitions-DyshsF51.js.map → promptDefinitions-wR6u6ZJE.js.map} +1 -1
- package/dist/promptDefinitions.cjs +4 -3
- package/dist/promptDefinitions.d.cts +1 -1
- package/dist/promptDefinitions.d.ts +1 -1
- package/dist/promptDefinitions.js +4 -3
- package/dist/{prompts-BTtNbKQR.cjs → prompts-BwZJaywH.cjs} +1 -1
- package/dist/{prompts-BTtNbKQR.cjs.map → prompts-BwZJaywH.cjs.map} +1 -1
- package/dist/{prompts-CYcvIxWR.js → prompts-DCJ0XraB.js} +1 -1
- package/dist/{prompts-CYcvIxWR.js.map → prompts-DCJ0XraB.js.map} +1 -1
- package/dist/prompts.cjs +1 -1
- package/dist/prompts.d.cts +3 -2
- package/dist/prompts.d.cts.map +1 -1
- package/dist/prompts.d.ts +3 -2
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +1 -1
- package/dist/resolve-B_Fq13Dk.js +52 -0
- package/dist/resolve-B_Fq13Dk.js.map +1 -0
- package/dist/resolve-CAtC1wN-.cjs +63 -0
- package/dist/resolve-CAtC1wN-.cjs.map +1 -0
- package/dist/resources/about.cjs +3 -0
- package/dist/resources/about.d.cts +2 -0
- package/dist/resources/about.d.ts +2 -0
- package/dist/resources/about.js +3 -0
- package/dist/resources/index.cjs +4 -0
- package/dist/resources/index.d.cts +2 -0
- package/dist/resources/index.d.ts +2 -0
- package/dist/resources/index.js +4 -0
- package/dist/resources-B4ropjfD.cjs +94 -0
- package/dist/resources-B4ropjfD.cjs.map +1 -0
- package/dist/resources-DaEUMw3Y.js +82 -0
- package/dist/resources-DaEUMw3Y.js.map +1 -0
- package/dist/resources.cjs +6 -4
- package/dist/resources.d.cts.map +1 -1
- package/dist/resources.d.ts.map +1 -1
- package/dist/resources.js +4 -2
- package/dist/{schema-DPL_hZXP.cjs → schema-BUBkkdUa.cjs} +14 -6
- package/dist/schema-BUBkkdUa.cjs.map +1 -0
- package/dist/{schema-C0LznFvu.cjs → schema-CbXlt1rW.cjs} +105 -3
- package/dist/schema-CbXlt1rW.cjs.map +1 -0
- package/dist/{schema-CdDcpvrp.d.cts → schema-ChvpDxUk.d.cts} +733 -486
- package/dist/{schema-CdDcpvrp.d.cts.map → schema-ChvpDxUk.d.cts.map} +1 -1
- package/dist/{schema-CcFmBoEf.js → schema-D1CzTJXB.js} +82 -4
- package/dist/schema-D1CzTJXB.js.map +1 -0
- package/dist/{schema-BlkWypl3.d.ts → schema-DOY22v1Q.d.ts} +509 -262
- package/dist/{schema-BlkWypl3.d.ts.map → schema-DOY22v1Q.d.ts.map} +1 -1
- package/dist/{schema-Bv2fvxgy.js → schema-DPJO5nkQ.js} +9 -7
- package/dist/schema-DPJO5nkQ.js.map +1 -0
- package/dist/schema.cjs +4 -2
- package/dist/schema.d.cts +7 -5
- package/dist/schema.d.cts.map +1 -1
- package/dist/schema.d.ts +7 -5
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +4 -3
- package/dist/{search-docs-CjIZDaD1.cjs → search-docs-CH6-1H9_.cjs} +8 -7
- package/dist/search-docs-CH6-1H9_.cjs.map +1 -0
- package/dist/{search-docs-ss09Dt0F.js → search-docs-CpAlMLs8.js} +6 -5
- package/dist/search-docs-CpAlMLs8.js.map +1 -0
- package/dist/{seer-utils-NPHv8KYY.js → seer-DLvrFQPo.js} +2 -2
- package/dist/seer-DLvrFQPo.js.map +1 -0
- package/dist/{seer-utils-C7Kv0gr8.cjs → seer-retC9dFI.cjs} +2 -2
- package/dist/seer-retC9dFI.cjs.map +1 -0
- package/dist/sentry-scrubbing-BrjExjlM.js +94 -0
- package/dist/sentry-scrubbing-BrjExjlM.js.map +1 -0
- package/dist/sentry-scrubbing-CDcE4n-D.cjs +118 -0
- package/dist/sentry-scrubbing-CDcE4n-D.cjs.map +1 -0
- package/dist/{server-D78x_7Vz.js → server-BjizUxVR.js} +76 -129
- package/dist/server-BjizUxVR.js.map +1 -0
- package/dist/{server-DYFiTMLB.cjs → server-RKq8MlNM.cjs} +76 -129
- package/dist/server-RKq8MlNM.cjs.map +1 -0
- package/dist/server.cjs +63 -53
- package/dist/server.d.cts +3 -2
- package/dist/server.d.cts.map +1 -1
- package/dist/server.d.ts +3 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +63 -53
- package/dist/slug-validation-58wajHeL.js +93 -0
- package/dist/slug-validation-58wajHeL.js.map +1 -0
- package/dist/slug-validation-DMk8Dyuh.cjs +111 -0
- package/dist/slug-validation-DMk8Dyuh.cjs.map +1 -0
- package/dist/{stdio-Be01KQkA.cjs → stdio-CJnMOUAU.cjs} +3 -3
- package/dist/{stdio-Be01KQkA.cjs.map → stdio-CJnMOUAU.cjs.map} +1 -1
- package/dist/{stdio-CDb2NHHD.js → stdio-DB9muOi8.js} +3 -3
- package/dist/{stdio-CDb2NHHD.js.map → stdio-DB9muOi8.js.map} +1 -1
- package/dist/test-setup.cjs +33622 -1524
- package/dist/test-setup.cjs.map +1 -1
- package/dist/test-setup.d.cts +33 -1
- package/dist/test-setup.d.cts.map +1 -0
- package/dist/test-setup.d.ts +33 -1
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +33632 -1534
- package/dist/test-setup.js.map +1 -1
- package/dist/test-utils/context.cjs +32 -0
- package/dist/test-utils/context.cjs.map +1 -0
- package/dist/test-utils/context.d.cts +18 -0
- package/dist/test-utils/context.d.cts.map +1 -0
- package/dist/test-utils/context.d.ts +18 -0
- package/dist/test-utils/context.d.ts.map +1 -0
- package/dist/test-utils/context.js +30 -0
- package/dist/test-utils/context.js.map +1 -0
- package/dist/toolDefinitions.cjs +9 -0
- package/dist/toolDefinitions.cjs.map +1 -1
- package/dist/toolDefinitions.js +9 -0
- package/dist/toolDefinitions.js.map +1 -1
- package/dist/tools/analyze-issue-with-seer.cjs +18 -15
- package/dist/tools/analyze-issue-with-seer.d.cts +5 -4
- package/dist/tools/analyze-issue-with-seer.d.cts.map +1 -1
- package/dist/tools/analyze-issue-with-seer.d.ts +5 -4
- package/dist/tools/analyze-issue-with-seer.d.ts.map +1 -1
- package/dist/tools/analyze-issue-with-seer.js +18 -15
- package/dist/tools/create-dsn.cjs +13 -10
- package/dist/tools/create-dsn.d.cts +6 -5
- package/dist/tools/create-dsn.d.cts.map +1 -1
- package/dist/tools/create-dsn.d.ts +6 -5
- package/dist/tools/create-dsn.d.ts.map +1 -1
- package/dist/tools/create-dsn.js +13 -10
- package/dist/tools/create-project.cjs +14 -11
- package/dist/tools/create-project.d.cts +6 -5
- package/dist/tools/create-project.d.cts.map +1 -1
- package/dist/tools/create-project.d.ts +6 -5
- package/dist/tools/create-project.d.ts.map +1 -1
- package/dist/tools/create-project.js +14 -11
- package/dist/tools/create-team.cjs +13 -10
- package/dist/tools/create-team.d.cts +5 -4
- package/dist/tools/create-team.d.cts.map +1 -1
- package/dist/tools/create-team.d.ts +5 -4
- package/dist/tools/create-team.d.ts.map +1 -1
- package/dist/tools/create-team.js +13 -10
- package/dist/tools/find-dsns.cjs +13 -10
- package/dist/tools/find-dsns.d.cts +8 -7
- package/dist/tools/find-dsns.d.cts.map +1 -1
- package/dist/tools/find-dsns.d.ts +8 -7
- package/dist/tools/find-dsns.d.ts.map +1 -1
- package/dist/tools/find-dsns.js +13 -10
- package/dist/tools/find-organizations.cjs +11 -8
- package/dist/tools/find-organizations.d.cts +4 -3
- package/dist/tools/find-organizations.d.ts +4 -3
- package/dist/tools/find-organizations.js +11 -8
- package/dist/tools/find-projects.cjs +13 -10
- package/dist/tools/find-projects.d.cts +7 -6
- package/dist/tools/find-projects.d.cts.map +1 -1
- package/dist/tools/find-projects.d.ts +7 -6
- package/dist/tools/find-projects.d.ts.map +1 -1
- package/dist/tools/find-projects.js +13 -10
- package/dist/tools/find-releases.cjs +13 -10
- package/dist/tools/find-releases.d.cts +6 -5
- package/dist/tools/find-releases.d.cts.map +1 -1
- package/dist/tools/find-releases.d.ts +6 -5
- package/dist/tools/find-releases.d.ts.map +1 -1
- package/dist/tools/find-releases.js +13 -10
- package/dist/tools/find-teams.cjs +13 -10
- package/dist/tools/find-teams.d.cts +7 -6
- package/dist/tools/find-teams.d.cts.map +1 -1
- package/dist/tools/find-teams.d.ts +7 -6
- package/dist/tools/find-teams.d.ts.map +1 -1
- package/dist/tools/find-teams.js +13 -10
- package/dist/tools/get-doc.cjs +9 -9
- package/dist/tools/get-doc.d.cts +4 -3
- package/dist/tools/get-doc.d.cts.map +1 -1
- package/dist/tools/get-doc.d.ts +4 -3
- package/dist/tools/get-doc.d.ts.map +1 -1
- package/dist/tools/get-doc.js +9 -9
- package/dist/tools/get-event-attachment.cjs +13 -10
- package/dist/tools/get-event-attachment.d.cts +10 -9
- package/dist/tools/get-event-attachment.d.cts.map +1 -1
- package/dist/tools/get-event-attachment.d.ts +10 -9
- package/dist/tools/get-event-attachment.d.ts.map +1 -1
- package/dist/tools/get-event-attachment.js +13 -10
- package/dist/tools/get-issue-details.cjs +18 -14
- package/dist/tools/get-issue-details.d.cts +5 -4
- package/dist/tools/get-issue-details.d.cts.map +1 -1
- package/dist/tools/get-issue-details.d.ts +5 -4
- package/dist/tools/get-issue-details.d.ts.map +1 -1
- package/dist/tools/get-issue-details.js +18 -14
- package/dist/tools/get-trace-details.cjs +16 -0
- package/dist/tools/get-trace-details.d.cts +15 -0
- package/dist/tools/get-trace-details.d.cts.map +1 -0
- package/dist/tools/get-trace-details.d.ts +15 -0
- package/dist/tools/get-trace-details.d.ts.map +1 -0
- package/dist/tools/get-trace-details.js +16 -0
- package/dist/tools/index.cjs +54 -48
- package/dist/tools/index.d.cts +77 -71
- package/dist/tools/index.d.cts.map +1 -1
- package/dist/tools/index.d.ts +77 -71
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +54 -48
- package/dist/tools/search-docs.cjs +12 -11
- package/dist/tools/search-docs.d.cts +4 -3
- package/dist/tools/search-docs.d.cts.map +1 -1
- package/dist/tools/search-docs.d.ts +4 -3
- package/dist/tools/search-docs.d.ts.map +1 -1
- package/dist/tools/search-docs.js +12 -11
- package/dist/tools/search-events/agent.cjs +15 -6
- package/dist/tools/search-events/agent.d.cts +7 -43
- package/dist/tools/search-events/agent.d.ts +7 -43
- package/dist/tools/search-events/agent.js +15 -6
- package/dist/tools/search-events/config.cjs +3 -2
- package/dist/tools/search-events/config.d.cts +2 -1
- package/dist/tools/search-events/config.d.cts.map +1 -1
- package/dist/tools/search-events/config.d.ts +2 -1
- package/dist/tools/search-events/config.d.ts.map +1 -1
- package/dist/tools/search-events/config.js +2 -2
- package/dist/tools/search-events/formatters.cjs +11 -3
- package/dist/tools/search-events/formatters.d.cts +28 -17
- package/dist/tools/search-events/formatters.d.cts.map +1 -1
- package/dist/tools/search-events/formatters.d.ts +28 -17
- package/dist/tools/search-events/formatters.d.ts.map +1 -1
- package/dist/tools/search-events/formatters.js +11 -4
- package/dist/tools/search-events/handler.cjs +22 -17
- package/dist/tools/search-events/handler.d.cts +5 -4
- package/dist/tools/search-events/handler.d.ts +5 -4
- package/dist/tools/search-events/handler.js +22 -17
- package/dist/tools/search-events/index.cjs +26 -19
- package/dist/tools/search-events/index.d.cts +12 -5
- package/dist/tools/search-events/index.d.ts +12 -5
- package/dist/tools/search-events/index.js +24 -19
- package/dist/tools/search-events/utils.cjs +14 -7
- package/dist/tools/search-events/utils.d.cts +7 -5
- package/dist/tools/search-events/utils.d.ts +7 -5
- package/dist/tools/search-events/utils.js +9 -2
- package/dist/tools/search-issues/agent.cjs +14 -5
- package/dist/tools/search-issues/agent.d.cts +7 -33
- package/dist/tools/search-issues/agent.d.ts +7 -33
- package/dist/tools/search-issues/agent.js +14 -5
- package/dist/tools/search-issues/config.cjs +1 -1
- package/dist/tools/search-issues/config.d.cts +1 -1
- package/dist/tools/search-issues/config.d.ts +1 -1
- package/dist/tools/search-issues/config.js +1 -1
- package/dist/tools/search-issues/formatters.cjs +3 -2
- package/dist/tools/search-issues/formatters.d.cts +20 -7
- package/dist/tools/search-issues/formatters.d.cts.map +1 -1
- package/dist/tools/search-issues/formatters.d.ts +20 -7
- package/dist/tools/search-issues/formatters.d.ts.map +1 -1
- package/dist/tools/search-issues/formatters.js +3 -3
- package/dist/tools/search-issues/handler.cjs +21 -15
- package/dist/tools/search-issues/handler.d.cts +5 -4
- package/dist/tools/search-issues/handler.d.ts +5 -4
- package/dist/tools/search-issues/handler.js +21 -15
- package/dist/tools/search-issues/index.cjs +25 -17
- package/dist/tools/search-issues/index.d.cts +12 -5
- package/dist/tools/search-issues/index.d.ts +12 -5
- package/dist/tools/search-issues/index.js +23 -17
- package/dist/tools/types.d.cts +4 -3
- package/dist/tools/types.d.ts +4 -3
- package/dist/tools/update-issue.cjs +18 -15
- package/dist/tools/update-issue.d.cts +11 -10
- package/dist/tools/update-issue.d.cts.map +1 -1
- package/dist/tools/update-issue.d.ts +11 -10
- package/dist/tools/update-issue.d.ts.map +1 -1
- package/dist/tools/update-issue.js +18 -15
- package/dist/tools/update-project.cjs +14 -11
- package/dist/tools/update-project.d.cts +7 -6
- package/dist/tools/update-project.d.cts.map +1 -1
- package/dist/tools/update-project.d.ts +7 -6
- package/dist/tools/update-project.d.ts.map +1 -1
- package/dist/tools/update-project.js +14 -11
- package/dist/tools/whoami.cjs +11 -8
- package/dist/tools/whoami.d.cts +4 -3
- package/dist/tools/whoami.d.ts +4 -3
- package/dist/tools/whoami.js +11 -8
- package/dist/tools-BiCRxQiY.js +46 -0
- package/dist/tools-BiCRxQiY.js.map +1 -0
- package/dist/{tools-sQ2wM3Pi.cjs → tools-UZ_biJKC.cjs} +21 -19
- package/dist/tools-UZ_biJKC.cjs.map +1 -0
- package/dist/transports/stdio.cjs +64 -54
- package/dist/transports/stdio.d.cts +3 -2
- package/dist/transports/stdio.d.cts.map +1 -1
- package/dist/transports/stdio.d.ts +3 -2
- package/dist/transports/stdio.d.ts.map +1 -1
- package/dist/transports/stdio.js +64 -54
- package/dist/{types-B-8S69No.d.ts → types-B4nOfch5.d.cts} +7 -3
- package/dist/{types-BYtO24VE.d.cts.map → types-B4nOfch5.d.cts.map} +1 -1
- package/dist/types-CKPddlfS.cjs +0 -0
- package/dist/types-Cy4S5lN-.js +0 -0
- package/dist/types-DLRWzl3K.d.cts +55 -0
- package/dist/types-DLRWzl3K.d.cts.map +1 -0
- package/dist/types-DTp1ajTT.d.ts +55 -0
- package/dist/types-DTp1ajTT.d.ts.map +1 -0
- package/dist/{types-BV-G5sBp.d.cts → types-Dj36Sq2V.d.cts} +14 -4
- package/dist/types-Dj36Sq2V.d.cts.map +1 -0
- package/dist/{types-C1Fih0eQ.d.ts → types-m-t7jx2f.d.ts} +14 -4
- package/dist/{types-BV-G5sBp.d.cts.map → types-m-t7jx2f.d.ts.map} +1 -1
- package/dist/{types-aOEJ0KgQ.d.cts → types-o23QqDgk.d.cts} +4 -2
- package/dist/types-o23QqDgk.d.cts.map +1 -0
- package/dist/{types-BYtO24VE.d.cts → types-ryM3umix.d.ts} +7 -3
- package/dist/{types-B-8S69No.d.ts.map → types-ryM3umix.d.ts.map} +1 -1
- package/dist/{types-BOcoP3Na.d.ts → types-s3ChfOM9.d.ts} +4 -2
- package/dist/types-s3ChfOM9.d.ts.map +1 -0
- package/dist/types.d.cts +4 -3
- package/dist/types.d.ts +4 -3
- package/dist/{update-issue-D77PudUi.cjs → update-issue-CD-kp2dt.cjs} +13 -18
- package/dist/update-issue-CD-kp2dt.cjs.map +1 -0
- package/dist/{update-issue-ndy2PF5G.js → update-issue-nq8D_YUe.js} +9 -14
- package/dist/update-issue-nq8D_YUe.js.map +1 -0
- package/dist/{update-project-DqECtbDA.cjs → update-project-B_OLM4Ky.cjs} +8 -7
- package/dist/{update-project-DqECtbDA.cjs.map → update-project-B_OLM4Ky.cjs.map} +1 -1
- package/dist/{update-project-Bxsi-BG_.js → update-project-DvJfmSmX.js} +6 -5
- package/dist/{update-project-Bxsi-BG_.js.map → update-project-DvJfmSmX.js.map} +1 -1
- package/dist/{url-utils-vJo2ER5v.cjs → url-utils-0OheI87i.cjs} +13 -9
- package/dist/url-utils-0OheI87i.cjs.map +1 -0
- package/dist/{url-utils-IqgSmI-B.js → url-utils-DF8NBCyH.js} +13 -9
- package/dist/url-utils-DF8NBCyH.js.map +1 -0
- package/dist/usage-Do2a2NJi.cjs +44 -0
- package/dist/usage-Do2a2NJi.cjs.map +1 -0
- package/dist/usage-OGOjVeAz.js +38 -0
- package/dist/usage-OGOjVeAz.js.map +1 -0
- package/dist/utils/slug-validation.cjs +5 -0
- package/dist/utils/slug-validation.d.cts +51 -0
- package/dist/utils/slug-validation.d.cts.map +1 -0
- package/dist/utils/slug-validation.d.ts +51 -0
- package/dist/utils/slug-validation.d.ts.map +1 -0
- package/dist/utils/slug-validation.js +3 -0
- package/dist/utils/url-utils.cjs +1 -1
- package/dist/utils/url-utils.d.cts +5 -5
- package/dist/utils/url-utils.d.cts.map +1 -1
- package/dist/utils/url-utils.d.ts +5 -5
- package/dist/utils/url-utils.d.ts.map +1 -1
- package/dist/utils/url-utils.js +1 -1
- package/dist/utils-BOPpU4-H.cjs +87 -0
- package/dist/utils-BOPpU4-H.cjs.map +1 -0
- package/dist/utils-CP4vAzfv.js +94 -0
- package/dist/utils-CP4vAzfv.js.map +1 -0
- package/dist/utils-Cw6O1ztc.d.ts +43 -0
- package/dist/utils-Cw6O1ztc.d.ts.map +1 -0
- package/dist/{utils-CtBGHj_N.d.cts → utils-DA-V9B-n.d.ts} +16 -12
- package/dist/utils-DA-V9B-n.d.ts.map +1 -0
- package/dist/{utils-CqbeJfE1.cjs → utils-DQ69VZrK.cjs} +39 -53
- package/dist/utils-DQ69VZrK.cjs.map +1 -0
- package/dist/{utils-BwXbSgEI.d.ts → utils-Ddvt3CBZ.d.cts} +16 -12
- package/dist/utils-Ddvt3CBZ.d.cts.map +1 -0
- package/dist/utils-K1XhlGf4.js +81 -0
- package/dist/utils-K1XhlGf4.js.map +1 -0
- package/dist/utils-OyJ8CB2S.d.cts +43 -0
- package/dist/utils-OyJ8CB2S.d.cts.map +1 -0
- package/dist/validate-region-url-BhxxcBgE.cjs +42 -0
- package/dist/validate-region-url-BhxxcBgE.cjs.map +1 -0
- package/dist/validate-region-url-DTUtqFky.js +37 -0
- package/dist/validate-region-url-DTUtqFky.js.map +1 -0
- package/dist/version-CaDh5TML.js +6 -0
- package/dist/{version-Bj68uyCt.js.map → version-CaDh5TML.js.map} +1 -1
- package/dist/{version-CMS1IOUV.cjs → version-DB2IM9qM.cjs} +2 -2
- package/dist/{version-CMS1IOUV.cjs.map → version-DB2IM9qM.cjs.map} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/whoami-BdiVu0Wr.cjs +38 -0
- package/dist/whoami-BdiVu0Wr.cjs.map +1 -0
- package/dist/{whoami-CoZJKpys.cjs → whoami-DCgOyVnW.cjs} +7 -5
- package/dist/whoami-DCgOyVnW.cjs.map +1 -0
- package/dist/{whoami-xBAWvzG4.js → whoami-bRIfclYF.js} +7 -5
- package/dist/whoami-bRIfclYF.js.map +1 -0
- package/dist/whoami-qCGsRPRm.js +33 -0
- package/dist/whoami-qCGsRPRm.js.map +1 -0
- package/package.json +34 -9
- package/dist/agent-COgY789I.js +0 -225
- package/dist/agent-COgY789I.js.map +0 -1
- package/dist/agent-Cody_f0d.cjs +0 -59
- package/dist/agent-Cody_f0d.cjs.map +0 -1
- package/dist/agent-DZRRChrO.js +0 -53
- package/dist/agent-DZRRChrO.js.map +0 -1
- package/dist/agent-DpCCnhh5.cjs +0 -231
- package/dist/agent-DpCCnhh5.cjs.map +0 -1
- package/dist/agent-tools/discover-dataset-fields.cjs +0 -6
- package/dist/agent-tools/discover-dataset-fields.d.cts.map +0 -1
- package/dist/agent-tools/discover-dataset-fields.d.ts.map +0 -1
- package/dist/agent-tools/discover-dataset-fields.js +0 -3
- package/dist/agent-tools/lookup-otel-semantics.cjs +0 -5
- package/dist/agent-tools/lookup-otel-semantics.d.cts +0 -38
- package/dist/agent-tools/lookup-otel-semantics.d.cts.map +0 -1
- package/dist/agent-tools/lookup-otel-semantics.d.ts +0 -38
- package/dist/agent-tools/lookup-otel-semantics.d.ts.map +0 -1
- package/dist/agent-tools/lookup-otel-semantics.js +0 -4
- package/dist/agent-tools/whoami.cjs +0 -4
- package/dist/agent-tools/whoami.d.cts +0 -28
- package/dist/agent-tools/whoami.d.cts.map +0 -1
- package/dist/agent-tools/whoami.d.ts +0 -28
- package/dist/agent-tools/whoami.d.ts.map +0 -1
- package/dist/agent-tools/whoami.js +0 -3
- package/dist/analyze-issue-with-seer-DcSwrWrs.js.map +0 -1
- package/dist/analyze-issue-with-seer-Dw9iqvSk.cjs.map +0 -1
- package/dist/api-utils-BlUSO8xh.js.map +0 -1
- package/dist/api-utils-DFWUfQ83.cjs.map +0 -1
- package/dist/client-CPrEfAwa.cjs.map +0 -1
- package/dist/client-C_dDreKj.d.ts.map +0 -1
- package/dist/client-CgS3tjJG.d.cts.map +0 -1
- package/dist/client-MaVV1gVC.js.map +0 -1
- package/dist/config-BUmDxVLS.js +0 -52
- package/dist/config-BUmDxVLS.js.map +0 -1
- package/dist/config-BvtWiL3I.js.map +0 -1
- package/dist/config-CD-5FpOO.cjs.map +0 -1
- package/dist/config-FWsgDbm7.cjs +0 -58
- package/dist/config-FWsgDbm7.cjs.map +0 -1
- package/dist/constants-ClkMK29-.cjs.map +0 -1
- package/dist/constants-S7AU45oQ.js.map +0 -1
- package/dist/create-project-Cax3fWey.js.map +0 -1
- package/dist/create-project-DdSF58TR.cjs.map +0 -1
- package/dist/create-team-CXaLcylp.cjs.map +0 -1
- package/dist/create-team-nm06goO5.js.map +0 -1
- package/dist/defineTool-77H4nSna.js +0 -8
- package/dist/defineTool-77H4nSna.js.map +0 -1
- package/dist/defineTool-lWNTzWl_.cjs.map +0 -1
- package/dist/discover-dataset-fields-BEnyqPSq.js.map +0 -1
- package/dist/discover-dataset-fields-Cl7HpVkm.cjs.map +0 -1
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/fetch-utils-CTLoW1R8.d.cts +0 -33
- package/dist/fetch-utils-CTLoW1R8.d.cts.map +0 -1
- package/dist/fetch-utils-JDZw4XaU.d.ts +0 -33
- package/dist/fetch-utils-JDZw4XaU.d.ts.map +0 -1
- package/dist/find-dsns-C3G5aBm1.js.map +0 -1
- package/dist/find-dsns-vQolGM7e.cjs.map +0 -1
- package/dist/find-organizations-BDtHkcFV.cjs.map +0 -1
- package/dist/find-organizations-Cs1GvZtJ.js.map +0 -1
- package/dist/find-projects-B0NdOjBO.js.map +0 -1
- package/dist/find-projects-xM2L0U1W.cjs.map +0 -1
- package/dist/find-releases-BBTYr5Bx.cjs.map +0 -1
- package/dist/find-releases-BO2OF_uR.js.map +0 -1
- package/dist/find-teams-B237Aq8U.cjs.map +0 -1
- package/dist/find-teams-CqUwp0EI.js.map +0 -1
- package/dist/formatters-B3ONbRhI.js.map +0 -1
- package/dist/formatters-CfeBjhXZ.cjs.map +0 -1
- package/dist/formatters-DSYXBiQx.js.map +0 -1
- package/dist/formatters-DbqofIoy.cjs.map +0 -1
- package/dist/formatting-BxyhA4G3.d.cts.map +0 -1
- package/dist/formatting-C180PVwd.cjs.map +0 -1
- package/dist/formatting-C80LN9iK.d.ts.map +0 -1
- package/dist/formatting-DIvCVunN.js.map +0 -1
- package/dist/formatting-utils-C3sej5ER.js.map +0 -1
- package/dist/formatting-utils-DDz14xeB.cjs.map +0 -1
- package/dist/get-doc-BfMg0GIa.cjs.map +0 -1
- package/dist/get-doc-DyqJe6TP.js.map +0 -1
- package/dist/get-event-attachment-B-ElqztF.js.map +0 -1
- package/dist/get-event-attachment-o0oH43Tv.cjs.map +0 -1
- package/dist/get-issue-details-CP_RyCpt.cjs.map +0 -1
- package/dist/get-issue-details-CzroF7HR.js.map +0 -1
- package/dist/handler-BGhr9FJM.d.cts.map +0 -1
- package/dist/handler-BH_OLIbD.cjs.map +0 -1
- package/dist/handler-BPPTAi7I.d.ts.map +0 -1
- package/dist/handler-BZ3hKPb8.d.cts.map +0 -1
- package/dist/handler-O9fYgC9a.cjs.map +0 -1
- package/dist/handler-aE_8mEm7.js.map +0 -1
- package/dist/handler-cUB6XcUV.d.ts.map +0 -1
- package/dist/handler-ykkULTZ-.js.map +0 -1
- package/dist/lookup-otel-semantics-BbriXZAx.cjs.map +0 -1
- package/dist/lookup-otel-semantics-Dt667kdR.js.map +0 -1
- package/dist/promptDefinitions-CVHtYaj8.d.cts.map +0 -1
- package/dist/promptDefinitions-DehpwJfn.d.ts.map +0 -1
- package/dist/resources-CSxBC9gs.js +0 -60
- package/dist/resources-CSxBC9gs.js.map +0 -1
- package/dist/resources-TCvijqOA.cjs +0 -72
- package/dist/resources-TCvijqOA.cjs.map +0 -1
- package/dist/schema-Bv2fvxgy.js.map +0 -1
- package/dist/schema-C0LznFvu.cjs.map +0 -1
- package/dist/schema-CcFmBoEf.js.map +0 -1
- package/dist/schema-DPL_hZXP.cjs.map +0 -1
- package/dist/search-docs-CjIZDaD1.cjs.map +0 -1
- package/dist/search-docs-ss09Dt0F.js.map +0 -1
- package/dist/seer-utils-C7Kv0gr8.cjs.map +0 -1
- package/dist/seer-utils-NPHv8KYY.js.map +0 -1
- package/dist/server-D78x_7Vz.js.map +0 -1
- package/dist/server-DYFiTMLB.cjs.map +0 -1
- package/dist/tools/search-events/agent.d.cts.map +0 -1
- package/dist/tools/search-events/agent.d.ts.map +0 -1
- package/dist/tools/search-issues/agent.d.cts.map +0 -1
- package/dist/tools/search-issues/agent.d.ts.map +0 -1
- package/dist/tools/utils/api-utils.cjs +0 -11
- package/dist/tools/utils/api-utils.d.cts.map +0 -1
- package/dist/tools/utils/api-utils.d.ts.map +0 -1
- package/dist/tools/utils/api-utils.js +0 -9
- package/dist/tools/utils/defineTool.cjs +0 -3
- package/dist/tools/utils/defineTool.d.cts +0 -12
- package/dist/tools/utils/defineTool.d.cts.map +0 -1
- package/dist/tools/utils/defineTool.d.ts +0 -12
- package/dist/tools/utils/defineTool.d.ts.map +0 -1
- package/dist/tools/utils/defineTool.js +0 -3
- package/dist/tools/utils/fetch-utils.cjs +0 -5
- package/dist/tools/utils/fetch-utils.d.cts +0 -2
- package/dist/tools/utils/fetch-utils.d.ts +0 -2
- package/dist/tools/utils/fetch-utils.js +0 -4
- package/dist/tools/utils/formatting-utils.cjs +0 -3
- package/dist/tools/utils/formatting-utils.d.cts +0 -15
- package/dist/tools/utils/formatting-utils.d.cts.map +0 -1
- package/dist/tools/utils/formatting-utils.d.ts +0 -15
- package/dist/tools/utils/formatting-utils.d.ts.map +0 -1
- package/dist/tools/utils/formatting-utils.js +0 -3
- package/dist/tools/utils/issue-utils.cjs +0 -8
- package/dist/tools/utils/issue-utils.d.cts +0 -7
- package/dist/tools/utils/issue-utils.d.ts +0 -7
- package/dist/tools/utils/issue-utils.js +0 -7
- package/dist/tools/utils/seer-utils.cjs +0 -11
- package/dist/tools/utils/seer-utils.d.cts.map +0 -1
- package/dist/tools/utils/seer-utils.d.ts.map +0 -1
- package/dist/tools-DvKm5uMs.js +0 -44
- package/dist/tools-DvKm5uMs.js.map +0 -1
- package/dist/tools-sQ2wM3Pi.cjs.map +0 -1
- package/dist/types-BOcoP3Na.d.ts.map +0 -1
- package/dist/types-C1Fih0eQ.d.ts.map +0 -1
- package/dist/types-aOEJ0KgQ.d.cts.map +0 -1
- package/dist/update-issue-D77PudUi.cjs.map +0 -1
- package/dist/update-issue-ndy2PF5G.js.map +0 -1
- package/dist/url-utils-IqgSmI-B.js.map +0 -1
- package/dist/url-utils-vJo2ER5v.cjs.map +0 -1
- package/dist/utils-BwXbSgEI.d.ts.map +0 -1
- package/dist/utils-CqbeJfE1.cjs.map +0 -1
- package/dist/utils-CtBGHj_N.d.cts.map +0 -1
- package/dist/utils-OgYE-imr.js +0 -108
- package/dist/utils-OgYE-imr.js.map +0 -1
- package/dist/version-Bj68uyCt.js +0 -6
- package/dist/whoami-BOJHfdih.cjs +0 -28
- package/dist/whoami-BOJHfdih.cjs.map +0 -1
- package/dist/whoami-Bswhb72a.js +0 -23
- package/dist/whoami-Bswhb72a.js.map +0 -1
- package/dist/whoami-CoZJKpys.cjs.map +0 -1
- package/dist/whoami-xBAWvzG4.js.map +0 -1
- /package/dist/{api-client-BWt6M7ij.cjs → api-client-T99a5Vta.js} +0 -0
- /package/dist/{api-client-CNv_hbPO.js → api-client-_2QFWf0d.cjs} +0 -0
- /package/dist/{fetch-utils-BqMx2KQr.js → cli/types.cjs} +0 -0
- /package/dist/{fetch-utils-DeZcERfe.cjs → cli/types.js} +0 -0
- /package/dist/{index-BPSCxsMC.d.cts → index-CmCelmEL.d.cts} +0 -0
- /package/dist/{index-DE1muTvw.d.ts → index-DCwqskfg.d.ts} +0 -0
- /package/dist/{issue-utils-BVAB6I-Z.js → issue-DKr8zNay.js} +0 -0
- /package/dist/{issue-utils-pdbo-5LW.cjs → issue-DrgpqPbF.cjs} +0 -0
- /package/dist/{search-events-BBFPuvRq.cjs → resources-BlsH_EDg.cjs} +0 -0
- /package/dist/{search-events-bV3-kK78.js → resources-U-u5ze91.js} +0 -0
- /package/dist/{search-issues-BFgCvRYe.js → search-events-CUvQ_Jch.js} +0 -0
- /package/dist/{search-issues-Biu64RkQ.cjs → search-events-DSY2Z_Eh.cjs} +0 -0
- /package/dist/{types-6zHoEWAx.js → search-issues-BOmdyuUf.js} +0 -0
- /package/dist/{types-DdloOYgD.cjs → search-issues-BxO2JE3D.cjs} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters-DSYXBiQx.js","names":["eventData: FlexibleEventData[]","params: { naturalLanguageQuery: string; includeExplanation?: boolean }","apiService: SentryApiService","organizationSlug: string","explorerUrl: string","sentryQuery: string","fields: string[]","severityEmojis: Record<string, string>"],"sources":["../src/tools/search-events/formatters.ts"],"sourcesContent":["import type { SentryApiService } from \"../../api-client\";\nimport {\n type FlexibleEventData,\n getStringValue,\n getNumberValue,\n isAggregateQuery,\n} from \"./utils\";\nimport * as Sentry from \"@sentry/node\";\n\n/**\n * Format error event results for display\n */\nexport function formatErrorResults(\n eventData: FlexibleEventData[],\n params: { naturalLanguageQuery: string; includeExplanation?: boolean },\n apiService: SentryApiService,\n organizationSlug: string,\n explorerUrl: string,\n sentryQuery: string,\n fields: string[],\n): string {\n let output = `# Search Results for \"${params.naturalLanguageQuery}\"\\n\\n`;\n\n // Check if this is an aggregate query and adjust display instructions\n if (isAggregateQuery(fields)) {\n output += `⚠️ **IMPORTANT**: Display these aggregate results as a data table with proper column alignment and formatting.\\n\\n`;\n } else {\n output += `⚠️ **IMPORTANT**: Display these errors as highlighted alert cards with color-coded severity levels and clickable Event IDs.\\n\\n`;\n }\n\n if (params.includeExplanation) {\n output += `## Query Translation\\n`;\n output += `Natural language: \"${params.naturalLanguageQuery}\"\\n`;\n output += `Sentry query: \\`${sentryQuery}\\`\\n\\n`;\n }\n\n output += `**📊 View these results in Sentry**: ${explorerUrl}\\n`;\n output += `_Please share this link with the user to view the search results in their Sentry dashboard._\\n\\n`;\n\n if (eventData.length === 0) {\n Sentry.logger.info(\n Sentry.logger\n .fmt`No error events found for query: ${params.naturalLanguageQuery}`,\n {\n query: sentryQuery,\n fields: fields,\n organizationSlug: organizationSlug,\n dataset: \"errors\",\n },\n );\n output += `No results found.\\n\\n`;\n output += `Try being more specific or using different terms in your search.\\n`;\n return output;\n }\n\n output += `Found ${eventData.length} ${isAggregateQuery(fields) ? \"aggregate result\" : \"error\"}${eventData.length === 1 ? \"\" : \"s\"}:\\n\\n`;\n\n // For aggregate queries, just output the raw data - the agent will format it as a table\n if (isAggregateQuery(fields)) {\n output += \"```json\\n\";\n output += JSON.stringify(eventData, null, 2);\n output += \"\\n```\\n\\n\";\n } else {\n // For individual errors, format with details\n // Define priority fields that should appear first if present\n const priorityFields = [\n \"title\",\n \"issue\",\n \"project\",\n \"level\",\n \"error.type\",\n \"message\",\n \"culprit\",\n \"timestamp\",\n \"last_seen()\", // Aggregate field - when the issue was last seen\n \"count()\", // Aggregate field - total occurrences of this issue\n ];\n\n for (const event of eventData) {\n // Try to get a title from various possible fields\n const title =\n getStringValue(event, \"title\") ||\n getStringValue(event, \"message\") ||\n getStringValue(event, \"error.value\") ||\n \"Error Event\";\n\n output += `## ${title}\\n\\n`;\n\n // Display priority fields first if they exist\n for (const field of priorityFields) {\n if (\n field in event &&\n event[field] !== null &&\n event[field] !== undefined\n ) {\n const value = event[field];\n\n if (field === \"issue\" && typeof value === \"string\") {\n output += `**Issue ID**: ${value}\\n`;\n output += `**Issue URL**: ${apiService.getIssueUrl(organizationSlug, value)}\\n`;\n } else {\n output += `**${field}**: ${value}\\n`;\n }\n }\n }\n\n // Display any additional fields that weren't in the priority list\n const displayedFields = new Set([...priorityFields, \"id\"]);\n for (const [key, value] of Object.entries(event)) {\n if (\n !displayedFields.has(key) &&\n value !== null &&\n value !== undefined\n ) {\n output += `**${key}**: ${value}\\n`;\n }\n }\n\n output += \"\\n\";\n }\n }\n\n output += \"## Next Steps\\n\\n\";\n output += \"- Get more details about a specific error: Use the Issue ID\\n\";\n output += \"- View error groups: Navigate to the Issues page in Sentry\\n\";\n output += \"- Set up alerts: Configure alert rules for these error patterns\\n\";\n\n return output;\n}\n\n/**\n * Format log event results for display\n */\nexport function formatLogResults(\n eventData: FlexibleEventData[],\n params: { naturalLanguageQuery: string; includeExplanation?: boolean },\n apiService: SentryApiService,\n organizationSlug: string,\n explorerUrl: string,\n sentryQuery: string,\n fields: string[],\n): string {\n let output = `# Search Results for \"${params.naturalLanguageQuery}\"\\n\\n`;\n\n // Check if this is an aggregate query and adjust display instructions\n if (isAggregateQuery(fields)) {\n output += `⚠️ **IMPORTANT**: Display these aggregate results as a data table with proper column alignment and formatting.\\n\\n`;\n } else {\n output += `⚠️ **IMPORTANT**: Display these logs in console format with monospace font, color-coded severity (🔴 ERROR, 🟡 WARN, 🔵 INFO), and preserve timestamps.\\n\\n`;\n }\n\n if (params.includeExplanation) {\n output += `## Query Translation\\n`;\n output += `Natural language: \"${params.naturalLanguageQuery}\"\\n`;\n output += `Sentry query: \\`${sentryQuery}\\`\\n\\n`;\n }\n\n output += `**📊 View these results in Sentry**: ${explorerUrl}\\n`;\n output += `_Please share this link with the user to view the search results in their Sentry dashboard._\\n\\n`;\n\n if (eventData.length === 0) {\n Sentry.logger.info(\n Sentry.logger\n .fmt`No log events found for query: ${params.naturalLanguageQuery}`,\n {\n query: sentryQuery,\n fields: fields,\n organizationSlug: organizationSlug,\n dataset: \"logs\",\n },\n );\n output += `No results found.\\n\\n`;\n output += `Try being more specific or using different terms in your search.\\n`;\n return output;\n }\n\n output += `Found ${eventData.length} ${isAggregateQuery(fields) ? \"aggregate result\" : \"log\"}${eventData.length === 1 ? \"\" : \"s\"}:\\n\\n`;\n\n // For aggregate queries, just output the raw data - the agent will format it as a table\n if (isAggregateQuery(fields)) {\n output += \"```json\\n\";\n output += JSON.stringify(eventData, null, 2);\n output += \"\\n```\\n\\n\";\n } else {\n // For individual logs, format as console output\n output += \"```console\\n\";\n\n for (const event of eventData) {\n const timestamp = getStringValue(event, \"timestamp\", \"N/A\");\n const severity = getStringValue(event, \"severity\", \"info\");\n const message = getStringValue(event, \"message\", \"No message\");\n\n // Safely uppercase the severity\n const severityUpper = severity.toUpperCase();\n\n // Get severity emoji with proper typing\n const severityEmojis: Record<string, string> = {\n ERROR: \"🔴\",\n FATAL: \"🔴\",\n WARN: \"🟡\",\n WARNING: \"🟡\",\n INFO: \"🔵\",\n DEBUG: \"⚫\",\n TRACE: \"⚫\",\n };\n const severityEmoji = severityEmojis[severityUpper] || \"🔵\";\n\n // Standard log format with emoji and proper spacing\n output += `${timestamp} ${severityEmoji} [${severityUpper.padEnd(5)}] ${message}\\n`;\n }\n\n output += \"```\\n\\n\";\n\n // Add detailed metadata for each log entry\n output += \"## Log Details\\n\\n\";\n\n // Define priority fields that should appear first if present\n const priorityFields = [\n \"message\",\n \"severity\",\n \"severity_number\",\n \"timestamp\",\n \"project\",\n \"trace\",\n \"sentry.item_id\",\n ];\n\n for (let i = 0; i < eventData.length; i++) {\n const event = eventData[i];\n\n output += `### Log ${i + 1}\\n`;\n\n // Display priority fields first\n for (const field of priorityFields) {\n if (\n field in event &&\n event[field] !== null &&\n event[field] !== undefined\n ) {\n const value = event[field];\n\n if (field === \"trace\" && typeof value === \"string\") {\n output += `- **Trace ID**: ${value}\\n`;\n output += `- **Trace URL**: ${apiService.getTraceUrl(organizationSlug, value)}\\n`;\n } else {\n output += `- **${field}**: ${value}\\n`;\n }\n }\n }\n\n // Display any additional fields\n const displayedFields = new Set([...priorityFields, \"id\"]);\n for (const [key, value] of Object.entries(event)) {\n if (\n !displayedFields.has(key) &&\n value !== null &&\n value !== undefined\n ) {\n output += `- **${key}**: ${value}\\n`;\n }\n }\n\n output += \"\\n\";\n }\n }\n\n output += \"## Next Steps\\n\\n\";\n output += \"- View related traces: Click on the Trace URL if available\\n\";\n output +=\n \"- Filter by severity: Adjust your query to focus on specific log levels\\n\";\n output += \"- Export logs: Use the Sentry web interface for bulk export\\n\";\n\n return output;\n}\n\n/**\n * Format span/trace event results for display\n */\nexport function formatSpanResults(\n eventData: FlexibleEventData[],\n params: { naturalLanguageQuery: string; includeExplanation?: boolean },\n apiService: SentryApiService,\n organizationSlug: string,\n explorerUrl: string,\n sentryQuery: string,\n fields: string[],\n): string {\n let output = `# Search Results for \"${params.naturalLanguageQuery}\"\\n\\n`;\n\n // Check if this is an aggregate query and adjust display instructions\n if (isAggregateQuery(fields)) {\n output += `⚠️ **IMPORTANT**: Display these aggregate results as a data table with proper column alignment and formatting.\\n\\n`;\n } else {\n output += `⚠️ **IMPORTANT**: Display these traces as a performance timeline with duration bars and hierarchical span relationships.\\n\\n`;\n }\n\n if (params.includeExplanation) {\n output += `## Query Translation\\n`;\n output += `Natural language: \"${params.naturalLanguageQuery}\"\\n`;\n output += `Sentry query: \\`${sentryQuery}\\`\\n\\n`;\n }\n\n output += `**📊 View these results in Sentry**: ${explorerUrl}\\n`;\n output += `_Please share this link with the user to view the search results in their Sentry dashboard._\\n\\n`;\n\n if (eventData.length === 0) {\n Sentry.logger.info(\n Sentry.logger\n .fmt`No span events found for query: ${params.naturalLanguageQuery}`,\n {\n query: sentryQuery,\n fields: fields,\n organizationSlug: organizationSlug,\n dataset: \"spans\",\n },\n );\n output += `No results found.\\n\\n`;\n output += `Try being more specific or using different terms in your search.\\n`;\n return output;\n }\n\n output += `Found ${eventData.length} ${isAggregateQuery(fields) ? `aggregate result${eventData.length === 1 ? \"\" : \"s\"}` : `trace${eventData.length === 1 ? \"\" : \"s\"}/span${eventData.length === 1 ? \"\" : \"s\"}`}:\\n\\n`;\n\n // For aggregate queries, just output the raw data - the agent will format it as a table\n if (isAggregateQuery(fields)) {\n output += \"```json\\n\";\n output += JSON.stringify(eventData, null, 2);\n output += \"\\n```\\n\\n\";\n } else {\n // For individual spans, format with details\n // Define priority fields that should appear first if present\n const priorityFields = [\n \"id\",\n \"span.op\",\n \"span.description\",\n \"transaction\",\n \"span.duration\",\n \"span.status\",\n \"trace\",\n \"project\",\n \"timestamp\",\n ];\n\n for (const event of eventData) {\n // Try to get a title from various possible fields\n const title =\n getStringValue(event, \"span.description\") ||\n getStringValue(event, \"transaction\") ||\n getStringValue(event, \"span.op\") ||\n \"Span\";\n\n output += `## ${title}\\n\\n`;\n\n // Display priority fields first\n for (const field of priorityFields) {\n if (\n field in event &&\n event[field] !== null &&\n event[field] !== undefined\n ) {\n const value = event[field];\n\n if (field === \"trace\" && typeof value === \"string\") {\n output += `**Trace ID**: ${value}\\n`;\n output += `**Trace URL**: ${apiService.getTraceUrl(organizationSlug, value)}\\n`;\n } else if (field === \"span.duration\" && typeof value === \"number\") {\n output += `**${field}**: ${value}ms\\n`;\n } else {\n output += `**${field}**: ${value}\\n`;\n }\n }\n }\n\n // Display any additional fields\n const displayedFields = new Set([...priorityFields, \"id\"]);\n for (const [key, value] of Object.entries(event)) {\n if (\n !displayedFields.has(key) &&\n value !== null &&\n value !== undefined\n ) {\n output += `**${key}**: ${value}\\n`;\n }\n }\n\n output += \"\\n\";\n }\n }\n\n output += \"## Next Steps\\n\\n\";\n output += \"- View the full trace: Click on the Trace URL above\\n\";\n output +=\n \"- Search for related spans: Modify your query to be more specific\\n\";\n output +=\n \"- Export data: Use the Sentry web interface for advanced analysis\\n\";\n\n return output;\n}\n"],"mappings":";;;;;;;AAYA,SAAgB,mBACdA,WACAC,QACAC,YACAC,kBACAC,aACAC,aACAC,QACQ;CACR,IAAI,UAAU,wBAAwB,OAAO,qBAAqB;AAGlE,KAAI,iBAAiB,OAAO,CAC1B,YAAW;KAEX,YAAW;AAGb,KAAI,OAAO,oBAAoB;AAC7B,aAAW;AACX,aAAW,qBAAqB,OAAO,qBAAqB;AAC5D,aAAW,kBAAkB,YAAY;CAC1C;AAED,YAAW,uCAAuC,YAAY;AAC9D,YAAW;AAEX,KAAI,UAAU,WAAW,GAAG;AAC1B,SAAO,OAAO,KACZ,OAAO,OACJ,IAAI,mCAAmC,OAAO,wBACjD;GACE,OAAO;GAC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M;EAGL,MAAM,iBAAiB;GACrB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD;AAED,OAAK,MAAM,SAAS,WAAW;GAE7B,MAAM,QACJ,eAAe,OAAO,mBAAmB,IACzC,eAAe,OAAO,cAAc,IACpC,eAAe,OAAO,UAAU,IAChC;AAEF,cAAW,KAAK,MAAM;AAGtB,QAAK,MAAM,SAAS,eAClB,KACE,SAAS,SACT,MAAM,WAAW,QACjB,MAAM,mBACN;IACA,MAAM,QAAQ,MAAM;AAEpB,QAAI,UAAU,kBAAkB,UAAU,UAAU;AAClD,gBAAW,gBAAgB,MAAM;AACjC,gBAAW,iBAAiB,WAAW,YAAY,kBAAkB,MAAM,CAAC;IAC7E,WAAU,UAAU,0BAA0B,UAAU,SACvD,YAAW,IAAI,MAAM,MAAM,MAAM;QAEjC,YAAW,IAAI,MAAM,MAAM,MAAM;GAEpC;GAIH,MAAM,kBAAkB,IAAI,IAAI,CAAC,GAAG,gBAAgB,IAAK;AACzD,QAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,MAAM,CAC9C,MACG,gBAAgB,IAAI,IAAI,IACzB,UAAU,QACV,iBAEA,YAAW,IAAI,IAAI,MAAM,MAAM;AAInC,aAAU;EACX;CACF;AAED,WAAU;AACV,WAAU;AACV,WACE;AACF,WACE;AAEF,QAAO;AACR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters-DbqofIoy.cjs","names":["issues: Issue[]","organizationSlug: string","projectSlugOrId: string | undefined","query: string","regionUrl?: string","naturalLanguageQuery?: string","dateString?: string | null"],"sources":["../src/tools/search-issues/formatters.ts"],"sourcesContent":["import type { Issue } from \"../../api-client\";\nimport { getIssueUrl, getIssuesSearchUrl } from \"../../utils/url-utils\";\nimport * as Sentry from \"@sentry/node\";\n\n/**\n * Format issue search results for display\n */\nexport function formatIssueResults(\n issues: Issue[],\n organizationSlug: string,\n projectSlugOrId: string | undefined,\n query: string,\n regionUrl?: string,\n naturalLanguageQuery?: string,\n skipHeader = false,\n): string {\n const host = regionUrl ? new URL(regionUrl).host : \"sentry.io\";\n\n let output = \"\";\n\n // Skip header section if requested (when called from handler with includeExplanation)\n if (!skipHeader) {\n // Use natural language query in title if provided, otherwise fall back to org/project\n if (naturalLanguageQuery) {\n output = `# Search Results for \"${naturalLanguageQuery}\"\\n\\n`;\n } else {\n output = `# Issues in **${organizationSlug}`;\n if (projectSlugOrId) {\n output += `/${projectSlugOrId}`;\n }\n output += \"**\\n\\n\";\n }\n\n // Add display instructions for UI\n output += `⚠️ **IMPORTANT**: Display these issues as highlighted cards with status indicators, assignee info, and clickable Issue IDs.\\n\\n`;\n }\n\n if (issues.length === 0) {\n Sentry.logger.info(\n Sentry.logger\n .fmt`No issues found for query: ${naturalLanguageQuery || query}`,\n {\n query: query,\n organizationSlug: organizationSlug,\n projectSlug: projectSlugOrId,\n naturalLanguageQuery: naturalLanguageQuery,\n },\n );\n output += \"No issues found matching your search criteria.\\n\\n\";\n output += \"Try adjusting your search criteria or time range.\";\n return output;\n }\n\n // Generate search URL for viewing results\n const searchUrl = getIssuesSearchUrl(\n host,\n organizationSlug,\n query,\n projectSlugOrId,\n );\n\n // Add view link with emoji and guidance text (like search_events)\n output += `**📊 View these results in Sentry**: ${searchUrl}\\n`;\n output += `_Please share this link with the user to view the search results in their Sentry dashboard._\\n\\n`;\n\n output += `Found **${issues.length}** issue${issues.length === 1 ? \"\" : \"s\"}:\\n\\n`;\n\n // Format each issue\n issues.forEach((issue, index) => {\n // Generate issue URL using the utility function\n const issueUrl = getIssueUrl(host, organizationSlug, issue.shortId);\n\n output += `## ${index + 1}. [${issue.shortId}](${issueUrl})\\n\\n`;\n output += `**${issue.title}**\\n\\n`;\n\n // Issue metadata\n // Issues don't have a level field in the API response\n output += `- **Status**: ${issue.status}\\n`;\n output += `- **Users**: ${issue.userCount || 0}\\n`;\n output += `- **Events**: ${issue.count || 0}\\n`;\n\n if (issue.assignedTo) {\n const assignee = issue.assignedTo;\n if (typeof assignee === \"string\") {\n output += `- **Assigned to**: ${assignee}\\n`;\n } else if (\n assignee &&\n typeof assignee === \"object\" &&\n \"name\" in assignee\n ) {\n output += `- **Assigned to**: ${assignee.name}\\n`;\n }\n }\n\n output += `- **First seen**: ${formatDate(issue.firstSeen)}\\n`;\n output += `- **Last seen**: ${formatDate(issue.lastSeen)}\\n`;\n\n if (issue.culprit) {\n output += `- **Culprit**: \\`${issue.culprit}\\`\\n`;\n }\n\n output += \"\\n\";\n });\n\n // Add next steps section (like search_events)\n output += \"## Next Steps\\n\\n\";\n output +=\n \"- Get more details about a specific issue: Use the Issue ID with get_issue_details\\n\";\n output +=\n \"- Update issue status: Use update_issue to resolve or assign issues\\n\";\n output +=\n \"- View event counts: Use search_events for aggregated statistics\\n\";\n\n return output;\n}\n\n/**\n * Format date for display\n */\nfunction formatDate(dateString?: string | null): string {\n if (!dateString) return \"N/A\";\n\n const date = new Date(dateString);\n const now = new Date();\n const diffMs = now.getTime() - date.getTime();\n const diffHours = Math.floor(diffMs / (1000 * 60 * 60));\n\n if (diffHours < 1) {\n const diffMinutes = Math.floor(diffMs / (1000 * 60));\n return `${diffMinutes} minute${diffMinutes === 1 ? \"\" : \"s\"} ago`;\n }\n if (diffHours < 24) {\n return `${diffHours} hour${diffHours === 1 ? \"\" : \"s\"} ago`;\n }\n const diffDays = Math.floor(diffHours / 24);\n if (diffDays < 30) {\n return `${diffDays} day${diffDays === 1 ? \"\" : \"s\"} ago`;\n }\n return date.toLocaleDateString();\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,mBACdA,QACAC,kBACAC,iBACAC,OACAC,WACAC,sBACA,aAAa,OACL;CACR,MAAM,OAAO,YAAY,IAAI,IAAI,WAAW,OAAO;CAEnD,IAAI,SAAS;AAGb,MAAK,YAAY;AAEf,MAAI,qBACF,WAAU,wBAAwB,qBAAqB;OAClD;AACL,aAAU,gBAAgB;AAC1B,OAAI,gBACF,YAAW,GAAG;AAEhB,aAA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O,KAAK,IAAI;AAEvD,KAAI,YAAY,GAAG;EACjB,MAAM,cAAc,KAAK,MAAM,UAAU,MAAO,IAAI;AACpD,YAAU,YAAY,SAAS,gBAAgB,IAAI,KAAK,IAAI;CAC7D;AACD,KAAI,YAAY,GACd,WAAU,UAAU,OAAO,cAAc,IAAI,KAAK,IAAI;CAExD,MAAM,WAAW,KAAK,MAAM,YAAY,GAAG;AAC3C,KAAI,WAAW,GACb,WAAU,SAAS,MAAM,aAAa,IAAI,KAAK,IAAI;AAErD,QAAO,KAAK,oBAAoB;AACjC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatting-BxyhA4G3.d.cts","names":[],"sources":["../src/internal/formatting.ts"],"sourcesContent":[],"mappings":";;;;;;;AAoFgB;AAoEhB;AA+gBA;;;;;;;AAQS,iBA5lBO,iBAAA,CA4lBP,KAAA,EA3lBA,CAAA,CAAE,KA2lBF,CAAA,OA3lBe,cA2lBf,CAAA,EAAA,UAAA,CAAA,EAAA,MAAA,EAAA,QAAA,CAAA,EAAA,MAAA,GAAA,IAAA,CAAA,EAAA,MAAA;;;;AAGuB;;;;iBA1hBhB,iBAAA,QAAyB;;;;;;;;iBA+gBzB,iBAAA;;;;;;;;SAQP;SACA;cACK;iBACG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatting-C180PVwd.cjs","names":["LANGUAGE_EXTENSIONS: Record<string, string>","LANGUAGE_MODULE_PATTERNS: Array<[RegExp, string]>","frame: z.infer<typeof FrameInterface>","platform?: string | null","frameIndex?: number","event: Event","parts: string[]","data: z.infer<typeof ErrorEntrySchema>","platform: string | null","index: number","totalExceptions: number","data: z.infer<typeof RequestEntrySchema>","data: z.infer<typeof MessageEntrySchema>","data: z.infer<typeof ThreadsEntrySchema>","lines: string[]","value: unknown","vars: Record<string, unknown>","frames: z.infer<typeof FrameInterface>[]","contexts: z.infer<typeof EventSchema>[\"contexts\"]","autofixState: AutofixRunState"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["/**\n * LLM response formatting utilities for Sentry data.\n *\n * Converts Sentry API responses into structured markdown format optimized\n * for LLM consumption. Handles stacktraces, event details, issue summaries,\n * and contextual information with consistent formatting patterns.\n */\nimport type { z } from \"zod\";\nimport type { Event, Issue, AutofixRunState } from \"../api-client/types\";\nimport type {\n ErrorEntrySchema,\n ErrorEventSchema,\n EventSchema,\n FrameInterface,\n RequestEntrySchema,\n MessageEntrySchema,\n ThreadsEntrySchema,\n SentryApiService,\n} from \"../api-client\";\nimport {\n getOutputForAutofixStep,\n getStatusDisplayName,\n isTerminalStatus,\n} from \"../tools/utils/seer-utils\";\n\n// Language detection mappings\nconst LANGUAGE_EXTENSIONS: Record<string, string> = {\n \".java\": \"java\",\n \".py\": \"python\",\n \".js\": \"javascript\",\n \".jsx\": \"javascript\",\n \".ts\": \"javascript\",\n \".tsx\": \"javascript\",\n \".rb\": \"ruby\",\n \".php\": \"php\",\n};\n\nconst LANGUAGE_MODULE_PATTERNS: Array<[RegExp, string]> = [\n [/^(java\\.|com\\.|org\\.)/, \"java\"],\n];\n\n/**\n * Detects the programming language of a stack frame based on the file extension.\n * Falls back to the platform parameter if no filename is available or extension is unrecognized.\n *\n * @param frame - The stack frame containing file and location information\n * @param platform - Optional platform hint to use as fallback\n * @returns The detected language or platform fallback or \"unknown\"\n */\nfunction detectLanguage(\n frame: z.infer<typeof FrameInterface>,\n platform?: string | null,\n): string {\n // Check filename extensions\n if (frame.filename) {\n const ext = frame.filename.toLowerCase().match(/\\.[^.]+$/)?.[0];\n if (ext && LANGUAGE_EXTENSIONS[ext]) {\n return LANGUAGE_EXTENSIONS[ext];\n }\n }\n\n // Check module patterns\n if (frame.module) {\n for (const [pattern, language] of LANGUAGE_MODULE_PATTERNS) {\n if (pattern.test(frame.module)) {\n return language;\n }\n }\n }\n\n // Fallback to platform or unknown\n return platform || \"unknown\";\n}\n\n/**\n * Formats a stack frame into a language-specific string representation.\n * Different languages have different conventions for displaying stack traces.\n *\n * @param frame - The stack frame to format\n * @param frameIndex - Optional frame index for languages that display frame numbers\n * @param platform - Optional platform hint for language detection fallback\n * @returns Formatted stack frame string\n */\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n frameIndex?: number,\n platform?: string | null,\n) {\n const language = detectLanguage(frame, platform);\n\n switch (language) {\n case \"java\": {\n // at com.example.ClassName.methodName(FileName.java:123)\n const className = frame.module || \"UnknownClass\";\n const method = frame.function || \"<unknown>\";\n const source = frame.filename || \"Unknown Source\";\n const location = frame.lineNo ? `:${frame.lineNo}` : \"\";\n return `at ${className}.${method}(${source}${location})`;\n }\n\n case \"python\": {\n // File \"/path/to/file.py\", line 42, in function_name\n const file =\n frame.filename || frame.absPath || frame.module || \"<unknown>\";\n const func = frame.function || \"<module>\";\n const line = frame.lineNo ? `, line ${frame.lineNo}` : \"\";\n return ` File \"${file}\"${line}, in ${func}`;\n }\n\n case \"javascript\": {\n // Original compact format: filename:line:col (function)\n // This preserves backward compatibility\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n\n case \"ruby\": {\n // from /path/to/file.rb:42:in `method_name'\n const file = frame.filename || frame.module || \"<unknown>\";\n const func = frame.function ? ` \\`${frame.function}\\`` : \"\";\n const line = frame.lineNo ? `:${frame.lineNo}:in` : \"\";\n return ` from ${file}${line}${func}`;\n }\n\n case \"php\": {\n // #0 /path/to/file.php(42): functionName()\n const file = frame.filename || \"<unknown>\";\n const line = frame.lineNo ? `(${frame.lineNo})` : \"\";\n const func = frame.function || \"<unknown>\";\n const prefix = frameIndex !== undefined ? `#${frameIndex} ` : \"\";\n return `${prefix}${file}${line}: ${func}()`;\n }\n\n default: {\n // Generic format for unknown languages\n const func = frame.function || \"<unknown>\";\n const location = frame.filename || frame.module || \"<unknown>\";\n const line = frame.lineNo ? `:${frame.lineNo}` : \"\";\n const col = frame.colNo != null ? `:${frame.colNo}` : \"\";\n return ` at ${func} (${location}${line}${col})`;\n }\n }\n}\n\n/**\n * Formats a Sentry event into a structured markdown output.\n * Includes error messages, stack traces, request info, and contextual data.\n *\n * @param event - The Sentry event to format\n * @returns Formatted markdown string\n */\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n\n // Look for the primary error information\n const messageEntry = event.entries.find((e) => e.type === \"message\");\n const exceptionEntry = event.entries.find((e) => e.type === \"exception\");\n const threadsEntry = event.entries.find((e) => e.type === \"threads\");\n const requestEntry = event.entries.find((e) => e.type === \"request\");\n\n // Error message (if present)\n if (messageEntry) {\n output += formatMessageInterfaceOutput(\n event,\n messageEntry.data as z.infer<typeof MessageEntrySchema>,\n );\n }\n\n // Stack trace (from exception or threads)\n if (exceptionEntry) {\n output += formatExceptionInterfaceOutput(\n event,\n exceptionEntry.data as z.infer<typeof ErrorEntrySchema>,\n );\n } else if (threadsEntry) {\n output += formatThreadsInterfaceOutput(\n event,\n threadsEntry.data as z.infer<typeof ThreadsEntrySchema>,\n );\n }\n\n // Request info (if HTTP error)\n if (requestEntry) {\n output += formatRequestInterfaceOutput(\n event,\n requestEntry.data as z.infer<typeof RequestEntrySchema>,\n );\n }\n\n output += formatContexts(event.contexts);\n return output;\n}\n\n/**\n * Extracts the context line matching the frame's line number for inline display.\n * This is used in the full stacktrace view to show the actual line of code\n * that caused the error inline with the stack frame.\n *\n * @param frame - The stack frame containing context lines\n * @returns The line of code at the frame's line number, or empty string if not available\n */\nfunction renderInlineContext(frame: z.infer<typeof FrameInterface>): string {\n if (!frame.context?.length || !frame.lineNo) {\n return \"\";\n }\n\n const contextLine = frame.context.find(([lineNo]) => lineNo === frame.lineNo);\n return contextLine ? `\\n${contextLine[1]}` : \"\";\n}\n\n/**\n * Renders an enhanced view of a stack frame with context lines and variables.\n * Used for the \"Most Relevant Frame\" section to provide detailed information\n * about the most relevant application frame where the error occurred.\n *\n * @param frame - The stack frame to render with enhanced information\n * @param event - The Sentry event containing platform information for language detection\n * @returns Formatted string with frame header, context lines, and variables table\n */\nfunction renderEnhancedFrame(\n frame: z.infer<typeof FrameInterface>,\n event: Event,\n): string {\n const parts: string[] = [];\n\n parts.push(\"**Most Relevant Frame:**\");\n parts.push(\"─────────────────────\");\n parts.push(formatFrameHeader(frame, undefined, event.platform));\n\n // Add context lines if available\n if (frame.context?.length) {\n const contextLines = renderContextLines(frame);\n if (contextLines) {\n parts.push(\"\");\n parts.push(contextLines);\n }\n }\n\n // Add variables table if available\n if (frame.vars && Object.keys(frame.vars).length > 0) {\n parts.push(\"\");\n parts.push(renderVariablesTable(frame.vars));\n }\n\n return parts.join(\"\\n\");\n}\n\nfunction formatExceptionInterfaceOutput(\n event: Event,\n data: z.infer<typeof ErrorEntrySchema>,\n) {\n const parts: string[] = [];\n\n // Handle both single exception (value) and chained exceptions (values)\n const exceptions = data.values || (data.value ? [data.value] : []);\n\n if (exceptions.length === 0) {\n return \"\";\n }\n\n // For chained exceptions, they are typically ordered from innermost to outermost\n // We'll render them in reverse order (outermost first) to match how they occurred\n const isChained = exceptions.length > 1;\n\n // Create a copy before reversing to avoid mutating the original array\n [...exceptions].reverse().forEach((exception, index) => {\n if (!exception) return;\n\n // Add language-specific chain indicator for multiple exceptions\n if (isChained && index > 0) {\n parts.push(\"\");\n parts.push(\n getExceptionChainMessage(\n event.platform || null,\n index,\n exceptions.length,\n ),\n );\n parts.push(\"\");\n }\n\n // Use the actual exception type and value as the heading\n const exceptionTitle = `${exception.type}${exception.value ? `: ${exception.value}` : \"\"}`;\n\n parts.push(index === 0 ? \"### Error\" : `### ${exceptionTitle}`);\n parts.push(\"\");\n\n // Add the error details in a code block for the first exception\n // to maintain backward compatibility\n if (index === 0) {\n parts.push(\"```\");\n parts.push(exceptionTitle);\n parts.push(\"```\");\n parts.push(\"\");\n }\n\n if (!exception.stacktrace || !exception.stacktrace.frames) {\n parts.push(\"**Stacktrace:**\");\n parts.push(\"```\");\n parts.push(\"No stacktrace available\");\n parts.push(\"```\");\n return;\n }\n\n const frames = exception.stacktrace.frames;\n\n // Only show enhanced frame for the first (outermost) exception to avoid overwhelming output\n if (index === 0) {\n const firstInAppFrame = findFirstInAppFrame(frames);\n if (\n firstInAppFrame &&\n (firstInAppFrame.context?.length || firstInAppFrame.vars)\n ) {\n parts.push(renderEnhancedFrame(firstInAppFrame, event));\n parts.push(\"\");\n parts.push(\"**Full Stacktrace:**\");\n parts.push(\"────────────────\");\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n\n parts.push(\"```\");\n parts.push(\n frames\n .map((frame) => {\n const header = formatFrameHeader(frame, undefined, event.platform);\n const context = renderInlineContext(frame);\n return `${header}${context}`;\n })\n .join(\"\\n\"),\n );\n parts.push(\"```\");\n });\n\n parts.push(\"\");\n parts.push(\"\");\n\n return parts.join(\"\\n\");\n}\n\n/**\n * Get the appropriate exception chain message based on the platform\n */\nfunction getExceptionChainMessage(\n platform: string | null,\n index: number,\n totalExceptions: number,\n): string {\n // Default message for unknown platforms\n const defaultMessage =\n \"**During handling of the above exception, another exception occurred:**\";\n\n if (!platform) {\n return defaultMessage;\n }\n\n switch (platform.toLowerCase()) {\n case \"python\":\n // Python has two distinct messages, but without additional metadata\n // we default to the implicit chaining message\n return \"**During handling of the above exception, another exception occurred:**\";\n\n case \"java\":\n return \"**Caused by:**\";\n\n case \"csharp\":\n case \"dotnet\":\n return \"**---> Inner Exception:**\";\n\n case \"ruby\":\n return \"**Caused by:**\";\n\n case \"go\":\n return \"**Wrapped error:**\";\n\n case \"rust\":\n return `**Caused by (${index}):**`;\n\n default:\n return defaultMessage;\n }\n}\n\nfunction formatRequestInterfaceOutput(\n event: Event,\n data: z.infer<typeof RequestEntrySchema>,\n) {\n if (!data.method || !data.url) {\n return \"\";\n }\n return `### HTTP Request\\n\\n**Method:** ${data.method}\\n**URL:** ${data.url}\\n\\n`;\n}\n\nfunction formatMessageInterfaceOutput(\n event: Event,\n data: z.infer<typeof MessageEntrySchema>,\n) {\n if (!data.formatted && !data.message) {\n return \"\";\n }\n const message = data.formatted || data.message || \"\";\n return `### Error\\n\\n${\"```\"}\\n${message}\\n${\"```\"}\\n\\n`;\n}\n\nfunction formatThreadsInterfaceOutput(\n event: Event,\n data: z.infer<typeof ThreadsEntrySchema>,\n) {\n if (!data.values || data.values.length === 0) {\n return \"\";\n }\n\n // Find the crashed thread only\n const crashedThread = data.values.find((t) => t.crashed);\n\n if (!crashedThread?.stacktrace?.frames) {\n return \"\";\n }\n\n const parts: string[] = [];\n\n // Include thread name if available\n if (crashedThread.name) {\n parts.push(`**Thread** (${crashedThread.name})`);\n parts.push(\"\");\n }\n\n const frames = crashedThread.stacktrace.frames;\n\n // Find and format the first in-app frame with enhanced view\n const firstInAppFrame = findFirstInAppFrame(frames);\n if (\n firstInAppFrame &&\n (firstInAppFrame.context?.length || firstInAppFrame.vars)\n ) {\n parts.push(renderEnhancedFrame(firstInAppFrame, event));\n parts.push(\"\");\n parts.push(\"**Full Stacktrace:**\");\n parts.push(\"────────────────\");\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n\n parts.push(\"```\");\n parts.push(\n frames\n .map((frame) => {\n const header = formatFrameHeader(frame, undefined, event.platform);\n const context = renderInlineContext(frame);\n return `${header}${context}`;\n })\n .join(\"\\n\"),\n );\n parts.push(\"```\");\n parts.push(\"\");\n\n return parts.join(\"\\n\");\n}\n\n/**\n * Renders surrounding source code context for a stack frame.\n * Shows a window of code lines around the error line with visual indicators.\n *\n * @param frame - The stack frame containing context lines\n * @param contextSize - Number of lines to show before and after the error line (default: 3)\n * @returns Formatted context lines with line numbers and arrow indicator for the error line\n */\nfunction renderContextLines(\n frame: z.infer<typeof FrameInterface>,\n contextSize = 3,\n): string {\n if (!frame.context || frame.context.length === 0 || !frame.lineNo) {\n return \"\";\n }\n\n const lines: string[] = [];\n const errorLine = frame.lineNo;\n const maxLineNoWidth = Math.max(\n ...frame.context.map(([lineNo]) => lineNo.toString().length),\n );\n\n for (const [lineNo, code] of frame.context) {\n const isErrorLine = lineNo === errorLine;\n const lineNoStr = lineNo.toString().padStart(maxLineNoWidth, \" \");\n\n if (Math.abs(lineNo - errorLine) <= contextSize) {\n if (isErrorLine) {\n lines.push(` → ${lineNoStr} │ ${code}`);\n } else {\n lines.push(` ${lineNoStr} │ ${code}`);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Formats a variable value for display in the variables table.\n * Handles different types appropriately and safely, converting complex objects\n * to readable representations and handling edge cases like circular references.\n *\n * @param value - The variable value to format (can be any type)\n * @param maxLength - Maximum length for stringified objects/arrays (default: 80)\n * @returns Human-readable string representation of the value\n */\nfunction formatVariableValue(value: unknown, maxLength = 80): string {\n try {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n if (value === null) {\n return \"null\";\n }\n if (value === undefined) {\n return \"undefined\";\n }\n if (typeof value === \"object\") {\n const stringified = JSON.stringify(value);\n if (stringified.length > maxLength) {\n // Leave room for \", ...]\" or \", ...}\"\n const truncateAt = maxLength - 6;\n let truncated = stringified.substring(0, truncateAt);\n\n // Find the last complete element by looking for the last comma\n const lastComma = truncated.lastIndexOf(\",\");\n if (lastComma > 0) {\n truncated = truncated.substring(0, lastComma);\n }\n\n // Add the appropriate ending\n if (Array.isArray(value)) {\n return `${truncated}, ...]`;\n }\n return `${truncated}, ...}`;\n }\n return stringified;\n }\n return String(value);\n } catch {\n // Handle circular references or other stringify errors\n return `<${typeof value}>`;\n }\n}\n\n/**\n * Renders a table of local variables in a tree-like format.\n * Uses box-drawing characters to create a visual hierarchy of variables\n * and their values at the point where the error occurred.\n *\n * @param vars - Object containing variable names as keys and their values\n * @returns Formatted variables table with tree-style prefix characters\n */\nfunction renderVariablesTable(vars: Record<string, unknown>): string {\n const entries = Object.entries(vars);\n if (entries.length === 0) {\n return \"\";\n }\n\n const lines: string[] = [\"Local Variables:\"];\n const lastIndex = entries.length - 1;\n\n entries.forEach(([key, value], index) => {\n const prefix = index === lastIndex ? \"└─\" : \"├─\";\n const valueStr = formatVariableValue(value);\n lines.push(`${prefix} ${key}: ${valueStr}`);\n });\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Finds the first application frame (in_app) in a stack trace.\n * Searches from the bottom of the stack (oldest frame) to find the first\n * frame that belongs to the user's application code rather than libraries.\n *\n * @param frames - Array of stack frames, typically in reverse chronological order\n * @returns The first in-app frame found, or undefined if none exist\n */\nfunction findFirstInAppFrame(\n frames: z.infer<typeof FrameInterface>[],\n): z.infer<typeof FrameInterface> | undefined {\n // Frames are usually in reverse order (most recent first)\n // We want the first in-app frame from the bottom\n for (let i = frames.length - 1; i >= 0; i--) {\n if (frames[i].inApp === true) {\n return frames[i];\n }\n }\n return undefined;\n}\n\nfunction formatContexts(contexts: z.infer<typeof EventSchema>[\"contexts\"]) {\n if (!contexts || Object.keys(contexts).length === 0) {\n return \"\";\n }\n return `### Additional Context\\n\\nThese are additional context provided by the user when they're instrumenting their application.\\n\\n${Object.entries(\n contexts,\n )\n .map(\n ([name, data]) =>\n `**${name}**\\n${Object.entries(data)\n .filter(([key, _]) => key !== \"type\")\n .map(([key, value]) => {\n return `${key}: ${JSON.stringify(value, undefined, 2)}`;\n })\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\")}\\n\\n`;\n}\n\n/**\n * Formats Seer AI analysis context for inclusion in issue details.\n * Provides a minimal summary showing just the key solution when available.\n *\n * @param autofixState - The autofix state containing Seer analysis data\n * @returns Formatted markdown string with Seer context, or empty string if no analysis exists\n */\nfunction formatSeerContext(autofixState: AutofixRunState): string {\n if (!autofixState.autofix) {\n return \"\";\n }\n\n const { autofix } = autofixState;\n const parts: string[] = [];\n\n parts.push(\"## Seer AI Analysis\");\n parts.push(\"\");\n\n // For completed analyses, show just the key solution\n if (isTerminalStatus(autofix.status) && autofix.steps.length > 0) {\n const completedSteps = autofix.steps.filter(\n (step) => step.status === \"COMPLETED\",\n );\n\n // Find the solution step and show its description directly\n const solutionStep = completedSteps.find(\n (step) => step.type === \"solution\",\n );\n\n if (solutionStep) {\n // For solution steps, use the description directly\n const solutionDescription = solutionStep.description;\n if (\n solutionDescription &&\n typeof solutionDescription === \"string\" &&\n solutionDescription.trim()\n ) {\n parts.push(solutionDescription.trim());\n } else {\n // Fallback to extracting from output if no description\n const solutionOutput = getOutputForAutofixStep(solutionStep);\n const lines = solutionOutput.split(\"\\n\");\n const firstParagraph = lines.find(\n (line) =>\n line.trim().length > 50 &&\n !line.startsWith(\"#\") &&\n !line.startsWith(\"*\"),\n );\n if (firstParagraph) {\n parts.push(firstParagraph.trim());\n }\n }\n }\n }\n return `${parts.join(\"\\n\")}\\n\\n`;\n}\n\n/**\n * Formats a Sentry issue with its latest event into comprehensive markdown output.\n * Includes issue metadata, event details, and usage instructions.\n *\n * @param params - Object containing organization slug, issue, event, and API service\n * @returns Formatted markdown string with complete issue information\n */\nexport function formatIssueOutput({\n organizationSlug,\n issue,\n event,\n apiService,\n autofixState,\n}: {\n organizationSlug: string;\n issue: Issue;\n event: Event;\n apiService: SentryApiService;\n autofixState?: AutofixRunState;\n}) {\n let output = `# Issue ${issue.shortId} in **${organizationSlug}**\\n\\n`;\n output += `**Description**: ${issue.title}\\n`;\n output += `**Culprit**: ${issue.culprit}\\n`;\n output += `**First Seen**: ${new Date(issue.firstSeen).toISOString()}\\n`;\n output += `**Last Seen**: ${new Date(issue.lastSeen).toISOString()}\\n`;\n output += `**Occurrences**: ${issue.count}\\n`;\n output += `**Users Impacted**: ${issue.userCount}\\n`;\n output += `**Status**: ${issue.status}\\n`;\n output += `**Platform**: ${issue.platform}\\n`;\n output += `**Project**: ${issue.project.name}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, issue.shortId)}\\n`;\n output += \"\\n\";\n output += \"## Event Details\\n\\n\";\n output += `**Event ID**: ${event.id}\\n`;\n if (event.type === \"error\") {\n output += `**Occurred At**: ${new Date((event as z.infer<typeof ErrorEventSchema>).dateCreated).toISOString()}\\n`;\n }\n if (event.message) {\n output += `**Message**:\\n${event.message}\\n`;\n }\n output += \"\\n\";\n output += formatEventOutput(event);\n\n // Add Seer context if available\n if (autofixState) {\n output += formatSeerContext(autofixState);\n }\n\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the IssueID in commit messages (e.g. \\`Fixes ${issue.shortId}\\`) to automatically close the issue when the commit is merged.\\n`;\n output +=\n \"- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\\n\";\n return output;\n}\n"],"mappings":";;;AA0BA,MAAMA,sBAA8C;CAClD,SAAS;CACT,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;AACT;AAED,MAAMC,2BAAoD,CACxD,CAAC,yBAAyB,MAAO,CAClC;;;;;;;;;AAUD,SAAS,eACPC,OACAC,UACQ;AAER,KAAI,MAAM,UAAU;EAClB,MAAM,MAAM,MAAM,SAAS,aAAa,CAAC,MAAM,WAAW,GAAG;AAC7D,MAAI,OAAO,oBAAoB,KAC7B,QAAO,oBAAoB;CAE9B;AAGD,KAAI,MAAM,QACR;OAAK,MAAM,CAAC,SAAS,SAAS,IAAI,yBAChC,KAAI,QAAQ,KAAK,MAAM,OAAO,CAC5B,QAAO;CAEV;AAIH,QAAO,YAAY;AACpB;;;;;;;;;;AAWD,SAAgB,kBACdD,OACAE,YACAD,UACA;CACA,MAAM,WAAW,eAAe,OAAO,SAAS;AAEhD,SAAQ,UAAR;EACE,KAAK,QAAQ;GAEX,MAAM,YAAY,MAAM,UAAU;GAClC,MAAM,SAAS,MAAM,YAAY;GACjC,MAAM,SAAS,MAAM,YAAY;GACjC,MAAM,WAAW,MAAM,UAAU,GAAG,MAAM,WAAW;AACrD,WAAQ,KAAK,UAAU,GAAG,OAAO,GAAG,SAAS,SAAS;EACvD;EAED,KAAK,UAAU;GAEb,MAAM,OACJ,MAAM,YAAY,MAAM,WAAW,MAAM,UAAU;GACrD,MAAM,OAAO,MAAM,YAAY;GAC/B,MAAM,OAAO,MAAM,UAAU,SAAS,MA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AS,QACjB,YAAW,mBAAmB,IAAI,KAAM,MAA2C,aAAa,aAAa,CAAC;AAEhH,KAAI,MAAM,QACR,YAAW,gBAAgB,MAAM,QAAQ;AAE3C,WAAU;AACV,WAAU,kBAAkB,MAAM;AAGlC,KAAI,aACF,WAAU,kBAAkB,aAAa;AAG3C,WAAU;AACV,YAAW,mEAAmE,MAAM,QAAQ;AAC5F,WACE;AACF,QAAO;AACR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatting-C80LN9iK.d.ts","names":[],"sources":["../src/internal/formatting.ts"],"sourcesContent":[],"mappings":";;;;;;;AAoFgB;AAoEhB;AA+gBA;;;;;;;AAQS,iBA5lBO,iBAAA,CA4lBP,KAAA,EA3lBA,CAAA,CAAE,KA2lBF,CAAA,OA3lBe,cA2lBf,CAAA,EAAA,UAAA,CAAA,EAAA,MAAA,EAAA,QAAA,CAAA,EAAA,MAAA,GAAA,IAAA,CAAA,EAAA,MAAA;;;;AAGuB;;;;iBA1hBhB,iBAAA,QAAyB;;;;;;;;iBA+gBzB,iBAAA;;;;;;;;SAQP;SACA;cACK;iBACG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatting-DIvCVunN.js","names":["LANGUAGE_EXTENSIONS: Record<string, string>","LANGUAGE_MODULE_PATTERNS: Array<[RegExp, string]>","frame: z.infer<typeof FrameInterface>","platform?: string | null","frameIndex?: number","event: Event","parts: string[]","data: z.infer<typeof ErrorEntrySchema>","platform: string | null","index: number","totalExceptions: number","data: z.infer<typeof RequestEntrySchema>","data: z.infer<typeof MessageEntrySchema>","data: z.infer<typeof ThreadsEntrySchema>","lines: string[]","value: unknown","vars: Record<string, unknown>","frames: z.infer<typeof FrameInterface>[]","contexts: z.infer<typeof EventSchema>[\"contexts\"]","autofixState: AutofixRunState"],"sources":["../src/internal/formatting.ts"],"sourcesContent":["/**\n * LLM response formatting utilities for Sentry data.\n *\n * Converts Sentry API responses into structured markdown format optimized\n * for LLM consumption. Handles stacktraces, event details, issue summaries,\n * and contextual information with consistent formatting patterns.\n */\nimport type { z } from \"zod\";\nimport type { Event, Issue, AutofixRunState } from \"../api-client/types\";\nimport type {\n ErrorEntrySchema,\n ErrorEventSchema,\n EventSchema,\n FrameInterface,\n RequestEntrySchema,\n MessageEntrySchema,\n ThreadsEntrySchema,\n SentryApiService,\n} from \"../api-client\";\nimport {\n getOutputForAutofixStep,\n getStatusDisplayName,\n isTerminalStatus,\n} from \"../tools/utils/seer-utils\";\n\n// Language detection mappings\nconst LANGUAGE_EXTENSIONS: Record<string, string> = {\n \".java\": \"java\",\n \".py\": \"python\",\n \".js\": \"javascript\",\n \".jsx\": \"javascript\",\n \".ts\": \"javascript\",\n \".tsx\": \"javascript\",\n \".rb\": \"ruby\",\n \".php\": \"php\",\n};\n\nconst LANGUAGE_MODULE_PATTERNS: Array<[RegExp, string]> = [\n [/^(java\\.|com\\.|org\\.)/, \"java\"],\n];\n\n/**\n * Detects the programming language of a stack frame based on the file extension.\n * Falls back to the platform parameter if no filename is available or extension is unrecognized.\n *\n * @param frame - The stack frame containing file and location information\n * @param platform - Optional platform hint to use as fallback\n * @returns The detected language or platform fallback or \"unknown\"\n */\nfunction detectLanguage(\n frame: z.infer<typeof FrameInterface>,\n platform?: string | null,\n): string {\n // Check filename extensions\n if (frame.filename) {\n const ext = frame.filename.toLowerCase().match(/\\.[^.]+$/)?.[0];\n if (ext && LANGUAGE_EXTENSIONS[ext]) {\n return LANGUAGE_EXTENSIONS[ext];\n }\n }\n\n // Check module patterns\n if (frame.module) {\n for (const [pattern, language] of LANGUAGE_MODULE_PATTERNS) {\n if (pattern.test(frame.module)) {\n return language;\n }\n }\n }\n\n // Fallback to platform or unknown\n return platform || \"unknown\";\n}\n\n/**\n * Formats a stack frame into a language-specific string representation.\n * Different languages have different conventions for displaying stack traces.\n *\n * @param frame - The stack frame to format\n * @param frameIndex - Optional frame index for languages that display frame numbers\n * @param platform - Optional platform hint for language detection fallback\n * @returns Formatted stack frame string\n */\nexport function formatFrameHeader(\n frame: z.infer<typeof FrameInterface>,\n frameIndex?: number,\n platform?: string | null,\n) {\n const language = detectLanguage(frame, platform);\n\n switch (language) {\n case \"java\": {\n // at com.example.ClassName.methodName(FileName.java:123)\n const className = frame.module || \"UnknownClass\";\n const method = frame.function || \"<unknown>\";\n const source = frame.filename || \"Unknown Source\";\n const location = frame.lineNo ? `:${frame.lineNo}` : \"\";\n return `at ${className}.${method}(${source}${location})`;\n }\n\n case \"python\": {\n // File \"/path/to/file.py\", line 42, in function_name\n const file =\n frame.filename || frame.absPath || frame.module || \"<unknown>\";\n const func = frame.function || \"<module>\";\n const line = frame.lineNo ? `, line ${frame.lineNo}` : \"\";\n return ` File \"${file}\"${line}, in ${func}`;\n }\n\n case \"javascript\": {\n // Original compact format: filename:line:col (function)\n // This preserves backward compatibility\n return `${[frame.filename, frame.lineNo, frame.colNo]\n .filter((i) => !!i)\n .join(\":\")}${frame.function ? ` (${frame.function})` : \"\"}`;\n }\n\n case \"ruby\": {\n // from /path/to/file.rb:42:in `method_name'\n const file = frame.filename || frame.module || \"<unknown>\";\n const func = frame.function ? ` \\`${frame.function}\\`` : \"\";\n const line = frame.lineNo ? `:${frame.lineNo}:in` : \"\";\n return ` from ${file}${line}${func}`;\n }\n\n case \"php\": {\n // #0 /path/to/file.php(42): functionName()\n const file = frame.filename || \"<unknown>\";\n const line = frame.lineNo ? `(${frame.lineNo})` : \"\";\n const func = frame.function || \"<unknown>\";\n const prefix = frameIndex !== undefined ? `#${frameIndex} ` : \"\";\n return `${prefix}${file}${line}: ${func}()`;\n }\n\n default: {\n // Generic format for unknown languages\n const func = frame.function || \"<unknown>\";\n const location = frame.filename || frame.module || \"<unknown>\";\n const line = frame.lineNo ? `:${frame.lineNo}` : \"\";\n const col = frame.colNo != null ? `:${frame.colNo}` : \"\";\n return ` at ${func} (${location}${line}${col})`;\n }\n }\n}\n\n/**\n * Formats a Sentry event into a structured markdown output.\n * Includes error messages, stack traces, request info, and contextual data.\n *\n * @param event - The Sentry event to format\n * @returns Formatted markdown string\n */\nexport function formatEventOutput(event: Event) {\n let output = \"\";\n\n // Look for the primary error information\n const messageEntry = event.entries.find((e) => e.type === \"message\");\n const exceptionEntry = event.entries.find((e) => e.type === \"exception\");\n const threadsEntry = event.entries.find((e) => e.type === \"threads\");\n const requestEntry = event.entries.find((e) => e.type === \"request\");\n\n // Error message (if present)\n if (messageEntry) {\n output += formatMessageInterfaceOutput(\n event,\n messageEntry.data as z.infer<typeof MessageEntrySchema>,\n );\n }\n\n // Stack trace (from exception or threads)\n if (exceptionEntry) {\n output += formatExceptionInterfaceOutput(\n event,\n exceptionEntry.data as z.infer<typeof ErrorEntrySchema>,\n );\n } else if (threadsEntry) {\n output += formatThreadsInterfaceOutput(\n event,\n threadsEntry.data as z.infer<typeof ThreadsEntrySchema>,\n );\n }\n\n // Request info (if HTTP error)\n if (requestEntry) {\n output += formatRequestInterfaceOutput(\n event,\n requestEntry.data as z.infer<typeof RequestEntrySchema>,\n );\n }\n\n output += formatContexts(event.contexts);\n return output;\n}\n\n/**\n * Extracts the context line matching the frame's line number for inline display.\n * This is used in the full stacktrace view to show the actual line of code\n * that caused the error inline with the stack frame.\n *\n * @param frame - The stack frame containing context lines\n * @returns The line of code at the frame's line number, or empty string if not available\n */\nfunction renderInlineContext(frame: z.infer<typeof FrameInterface>): string {\n if (!frame.context?.length || !frame.lineNo) {\n return \"\";\n }\n\n const contextLine = frame.context.find(([lineNo]) => lineNo === frame.lineNo);\n return contextLine ? `\\n${contextLine[1]}` : \"\";\n}\n\n/**\n * Renders an enhanced view of a stack frame with context lines and variables.\n * Used for the \"Most Relevant Frame\" section to provide detailed information\n * about the most relevant application frame where the error occurred.\n *\n * @param frame - The stack frame to render with enhanced information\n * @param event - The Sentry event containing platform information for language detection\n * @returns Formatted string with frame header, context lines, and variables table\n */\nfunction renderEnhancedFrame(\n frame: z.infer<typeof FrameInterface>,\n event: Event,\n): string {\n const parts: string[] = [];\n\n parts.push(\"**Most Relevant Frame:**\");\n parts.push(\"─────────────────────\");\n parts.push(formatFrameHeader(frame, undefined, event.platform));\n\n // Add context lines if available\n if (frame.context?.length) {\n const contextLines = renderContextLines(frame);\n if (contextLines) {\n parts.push(\"\");\n parts.push(contextLines);\n }\n }\n\n // Add variables table if available\n if (frame.vars && Object.keys(frame.vars).length > 0) {\n parts.push(\"\");\n parts.push(renderVariablesTable(frame.vars));\n }\n\n return parts.join(\"\\n\");\n}\n\nfunction formatExceptionInterfaceOutput(\n event: Event,\n data: z.infer<typeof ErrorEntrySchema>,\n) {\n const parts: string[] = [];\n\n // Handle both single exception (value) and chained exceptions (values)\n const exceptions = data.values || (data.value ? [data.value] : []);\n\n if (exceptions.length === 0) {\n return \"\";\n }\n\n // For chained exceptions, they are typically ordered from innermost to outermost\n // We'll render them in reverse order (outermost first) to match how they occurred\n const isChained = exceptions.length > 1;\n\n // Create a copy before reversing to avoid mutating the original array\n [...exceptions].reverse().forEach((exception, index) => {\n if (!exception) return;\n\n // Add language-specific chain indicator for multiple exceptions\n if (isChained && index > 0) {\n parts.push(\"\");\n parts.push(\n getExceptionChainMessage(\n event.platform || null,\n index,\n exceptions.length,\n ),\n );\n parts.push(\"\");\n }\n\n // Use the actual exception type and value as the heading\n const exceptionTitle = `${exception.type}${exception.value ? `: ${exception.value}` : \"\"}`;\n\n parts.push(index === 0 ? \"### Error\" : `### ${exceptionTitle}`);\n parts.push(\"\");\n\n // Add the error details in a code block for the first exception\n // to maintain backward compatibility\n if (index === 0) {\n parts.push(\"```\");\n parts.push(exceptionTitle);\n parts.push(\"```\");\n parts.push(\"\");\n }\n\n if (!exception.stacktrace || !exception.stacktrace.frames) {\n parts.push(\"**Stacktrace:**\");\n parts.push(\"```\");\n parts.push(\"No stacktrace available\");\n parts.push(\"```\");\n return;\n }\n\n const frames = exception.stacktrace.frames;\n\n // Only show enhanced frame for the first (outermost) exception to avoid overwhelming output\n if (index === 0) {\n const firstInAppFrame = findFirstInAppFrame(frames);\n if (\n firstInAppFrame &&\n (firstInAppFrame.context?.length || firstInAppFrame.vars)\n ) {\n parts.push(renderEnhancedFrame(firstInAppFrame, event));\n parts.push(\"\");\n parts.push(\"**Full Stacktrace:**\");\n parts.push(\"────────────────\");\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n\n parts.push(\"```\");\n parts.push(\n frames\n .map((frame) => {\n const header = formatFrameHeader(frame, undefined, event.platform);\n const context = renderInlineContext(frame);\n return `${header}${context}`;\n })\n .join(\"\\n\"),\n );\n parts.push(\"```\");\n });\n\n parts.push(\"\");\n parts.push(\"\");\n\n return parts.join(\"\\n\");\n}\n\n/**\n * Get the appropriate exception chain message based on the platform\n */\nfunction getExceptionChainMessage(\n platform: string | null,\n index: number,\n totalExceptions: number,\n): string {\n // Default message for unknown platforms\n const defaultMessage =\n \"**During handling of the above exception, another exception occurred:**\";\n\n if (!platform) {\n return defaultMessage;\n }\n\n switch (platform.toLowerCase()) {\n case \"python\":\n // Python has two distinct messages, but without additional metadata\n // we default to the implicit chaining message\n return \"**During handling of the above exception, another exception occurred:**\";\n\n case \"java\":\n return \"**Caused by:**\";\n\n case \"csharp\":\n case \"dotnet\":\n return \"**---> Inner Exception:**\";\n\n case \"ruby\":\n return \"**Caused by:**\";\n\n case \"go\":\n return \"**Wrapped error:**\";\n\n case \"rust\":\n return `**Caused by (${index}):**`;\n\n default:\n return defaultMessage;\n }\n}\n\nfunction formatRequestInterfaceOutput(\n event: Event,\n data: z.infer<typeof RequestEntrySchema>,\n) {\n if (!data.method || !data.url) {\n return \"\";\n }\n return `### HTTP Request\\n\\n**Method:** ${data.method}\\n**URL:** ${data.url}\\n\\n`;\n}\n\nfunction formatMessageInterfaceOutput(\n event: Event,\n data: z.infer<typeof MessageEntrySchema>,\n) {\n if (!data.formatted && !data.message) {\n return \"\";\n }\n const message = data.formatted || data.message || \"\";\n return `### Error\\n\\n${\"```\"}\\n${message}\\n${\"```\"}\\n\\n`;\n}\n\nfunction formatThreadsInterfaceOutput(\n event: Event,\n data: z.infer<typeof ThreadsEntrySchema>,\n) {\n if (!data.values || data.values.length === 0) {\n return \"\";\n }\n\n // Find the crashed thread only\n const crashedThread = data.values.find((t) => t.crashed);\n\n if (!crashedThread?.stacktrace?.frames) {\n return \"\";\n }\n\n const parts: string[] = [];\n\n // Include thread name if available\n if (crashedThread.name) {\n parts.push(`**Thread** (${crashedThread.name})`);\n parts.push(\"\");\n }\n\n const frames = crashedThread.stacktrace.frames;\n\n // Find and format the first in-app frame with enhanced view\n const firstInAppFrame = findFirstInAppFrame(frames);\n if (\n firstInAppFrame &&\n (firstInAppFrame.context?.length || firstInAppFrame.vars)\n ) {\n parts.push(renderEnhancedFrame(firstInAppFrame, event));\n parts.push(\"\");\n parts.push(\"**Full Stacktrace:**\");\n parts.push(\"────────────────\");\n } else {\n parts.push(\"**Stacktrace:**\");\n }\n\n parts.push(\"```\");\n parts.push(\n frames\n .map((frame) => {\n const header = formatFrameHeader(frame, undefined, event.platform);\n const context = renderInlineContext(frame);\n return `${header}${context}`;\n })\n .join(\"\\n\"),\n );\n parts.push(\"```\");\n parts.push(\"\");\n\n return parts.join(\"\\n\");\n}\n\n/**\n * Renders surrounding source code context for a stack frame.\n * Shows a window of code lines around the error line with visual indicators.\n *\n * @param frame - The stack frame containing context lines\n * @param contextSize - Number of lines to show before and after the error line (default: 3)\n * @returns Formatted context lines with line numbers and arrow indicator for the error line\n */\nfunction renderContextLines(\n frame: z.infer<typeof FrameInterface>,\n contextSize = 3,\n): string {\n if (!frame.context || frame.context.length === 0 || !frame.lineNo) {\n return \"\";\n }\n\n const lines: string[] = [];\n const errorLine = frame.lineNo;\n const maxLineNoWidth = Math.max(\n ...frame.context.map(([lineNo]) => lineNo.toString().length),\n );\n\n for (const [lineNo, code] of frame.context) {\n const isErrorLine = lineNo === errorLine;\n const lineNoStr = lineNo.toString().padStart(maxLineNoWidth, \" \");\n\n if (Math.abs(lineNo - errorLine) <= contextSize) {\n if (isErrorLine) {\n lines.push(` → ${lineNoStr} │ ${code}`);\n } else {\n lines.push(` ${lineNoStr} │ ${code}`);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Formats a variable value for display in the variables table.\n * Handles different types appropriately and safely, converting complex objects\n * to readable representations and handling edge cases like circular references.\n *\n * @param value - The variable value to format (can be any type)\n * @param maxLength - Maximum length for stringified objects/arrays (default: 80)\n * @returns Human-readable string representation of the value\n */\nfunction formatVariableValue(value: unknown, maxLength = 80): string {\n try {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n if (value === null) {\n return \"null\";\n }\n if (value === undefined) {\n return \"undefined\";\n }\n if (typeof value === \"object\") {\n const stringified = JSON.stringify(value);\n if (stringified.length > maxLength) {\n // Leave room for \", ...]\" or \", ...}\"\n const truncateAt = maxLength - 6;\n let truncated = stringified.substring(0, truncateAt);\n\n // Find the last complete element by looking for the last comma\n const lastComma = truncated.lastIndexOf(\",\");\n if (lastComma > 0) {\n truncated = truncated.substring(0, lastComma);\n }\n\n // Add the appropriate ending\n if (Array.isArray(value)) {\n return `${truncated}, ...]`;\n }\n return `${truncated}, ...}`;\n }\n return stringified;\n }\n return String(value);\n } catch {\n // Handle circular references or other stringify errors\n return `<${typeof value}>`;\n }\n}\n\n/**\n * Renders a table of local variables in a tree-like format.\n * Uses box-drawing characters to create a visual hierarchy of variables\n * and their values at the point where the error occurred.\n *\n * @param vars - Object containing variable names as keys and their values\n * @returns Formatted variables table with tree-style prefix characters\n */\nfunction renderVariablesTable(vars: Record<string, unknown>): string {\n const entries = Object.entries(vars);\n if (entries.length === 0) {\n return \"\";\n }\n\n const lines: string[] = [\"Local Variables:\"];\n const lastIndex = entries.length - 1;\n\n entries.forEach(([key, value], index) => {\n const prefix = index === lastIndex ? \"└─\" : \"├─\";\n const valueStr = formatVariableValue(value);\n lines.push(`${prefix} ${key}: ${valueStr}`);\n });\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Finds the first application frame (in_app) in a stack trace.\n * Searches from the bottom of the stack (oldest frame) to find the first\n * frame that belongs to the user's application code rather than libraries.\n *\n * @param frames - Array of stack frames, typically in reverse chronological order\n * @returns The first in-app frame found, or undefined if none exist\n */\nfunction findFirstInAppFrame(\n frames: z.infer<typeof FrameInterface>[],\n): z.infer<typeof FrameInterface> | undefined {\n // Frames are usually in reverse order (most recent first)\n // We want the first in-app frame from the bottom\n for (let i = frames.length - 1; i >= 0; i--) {\n if (frames[i].inApp === true) {\n return frames[i];\n }\n }\n return undefined;\n}\n\nfunction formatContexts(contexts: z.infer<typeof EventSchema>[\"contexts\"]) {\n if (!contexts || Object.keys(contexts).length === 0) {\n return \"\";\n }\n return `### Additional Context\\n\\nThese are additional context provided by the user when they're instrumenting their application.\\n\\n${Object.entries(\n contexts,\n )\n .map(\n ([name, data]) =>\n `**${name}**\\n${Object.entries(data)\n .filter(([key, _]) => key !== \"type\")\n .map(([key, value]) => {\n return `${key}: ${JSON.stringify(value, undefined, 2)}`;\n })\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\")}\\n\\n`;\n}\n\n/**\n * Formats Seer AI analysis context for inclusion in issue details.\n * Provides a minimal summary showing just the key solution when available.\n *\n * @param autofixState - The autofix state containing Seer analysis data\n * @returns Formatted markdown string with Seer context, or empty string if no analysis exists\n */\nfunction formatSeerContext(autofixState: AutofixRunState): string {\n if (!autofixState.autofix) {\n return \"\";\n }\n\n const { autofix } = autofixState;\n const parts: string[] = [];\n\n parts.push(\"## Seer AI Analysis\");\n parts.push(\"\");\n\n // For completed analyses, show just the key solution\n if (isTerminalStatus(autofix.status) && autofix.steps.length > 0) {\n const completedSteps = autofix.steps.filter(\n (step) => step.status === \"COMPLETED\",\n );\n\n // Find the solution step and show its description directly\n const solutionStep = completedSteps.find(\n (step) => step.type === \"solution\",\n );\n\n if (solutionStep) {\n // For solution steps, use the description directly\n const solutionDescription = solutionStep.description;\n if (\n solutionDescription &&\n typeof solutionDescription === \"string\" &&\n solutionDescription.trim()\n ) {\n parts.push(solutionDescription.trim());\n } else {\n // Fallback to extracting from output if no description\n const solutionOutput = getOutputForAutofixStep(solutionStep);\n const lines = solutionOutput.split(\"\\n\");\n const firstParagraph = lines.find(\n (line) =>\n line.trim().length > 50 &&\n !line.startsWith(\"#\") &&\n !line.startsWith(\"*\"),\n );\n if (firstParagraph) {\n parts.push(firstParagraph.trim());\n }\n }\n }\n }\n return `${parts.join(\"\\n\")}\\n\\n`;\n}\n\n/**\n * Formats a Sentry issue with its latest event into comprehensive markdown output.\n * Includes issue metadata, event details, and usage instructions.\n *\n * @param params - Object containing organization slug, issue, event, and API service\n * @returns Formatted markdown string with complete issue information\n */\nexport function formatIssueOutput({\n organizationSlug,\n issue,\n event,\n apiService,\n autofixState,\n}: {\n organizationSlug: string;\n issue: Issue;\n event: Event;\n apiService: SentryApiService;\n autofixState?: AutofixRunState;\n}) {\n let output = `# Issue ${issue.shortId} in **${organizationSlug}**\\n\\n`;\n output += `**Description**: ${issue.title}\\n`;\n output += `**Culprit**: ${issue.culprit}\\n`;\n output += `**First Seen**: ${new Date(issue.firstSeen).toISOString()}\\n`;\n output += `**Last Seen**: ${new Date(issue.lastSeen).toISOString()}\\n`;\n output += `**Occurrences**: ${issue.count}\\n`;\n output += `**Users Impacted**: ${issue.userCount}\\n`;\n output += `**Status**: ${issue.status}\\n`;\n output += `**Platform**: ${issue.platform}\\n`;\n output += `**Project**: ${issue.project.name}\\n`;\n output += `**URL**: ${apiService.getIssueUrl(organizationSlug, issue.shortId)}\\n`;\n output += \"\\n\";\n output += \"## Event Details\\n\\n\";\n output += `**Event ID**: ${event.id}\\n`;\n if (event.type === \"error\") {\n output += `**Occurred At**: ${new Date((event as z.infer<typeof ErrorEventSchema>).dateCreated).toISOString()}\\n`;\n }\n if (event.message) {\n output += `**Message**:\\n${event.message}\\n`;\n }\n output += \"\\n\";\n output += formatEventOutput(event);\n\n // Add Seer context if available\n if (autofixState) {\n output += formatSeerContext(autofixState);\n }\n\n output += \"# Using this information\\n\\n\";\n output += `- You can reference the IssueID in commit messages (e.g. \\`Fixes ${issue.shortId}\\`) to automatically close the issue when the commit is merged.\\n`;\n output +=\n \"- The stacktrace includes both first-party application code as well as third-party code, its important to triage to first-party code.\\n\";\n return output;\n}\n"],"mappings":";;;AA0BA,MAAMA,sBAA8C;CAClD,SAAS;CACT,OAAO;CACP,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;AACT;AAED,MAAMC,2BAAoD,CACxD,CAAC,yBAAyB,MAAO,CAClC;;;;;;;;;AAUD,SAAS,eACPC,OACAC,UACQ;AAER,KAAI,MAAM,UAAU;EAClB,MAAM,MAAM,MAAM,SAAS,aAAa,CAAC,MAAM,WAAW,GAAG;AAC7D,MAAI,OAAO,oBAAoB,KAC7B,QAAO,oBAAoB;CAE9B;AAGD,KAAI,MAAM,QACR;OAAK,MAAM,CAAC,SAAS,SAAS,IAAI,yBAChC,KAAI,QAAQ,KAAK,MAAM,OAAO,CAC5B,QAAO;CAEV;AAIH,QAAO,YAAY;AACpB;;;;;;;;;;AAWD,SAAgB,kBACdD,OACAE,YACAD,UACA;CACA,MAAM,WAAW,eAAe,OAAO,SAAS;AAEhD,SAAQ,UAAR;EACE,KAAK,QAAQ;GAEX,MAAM,YAAY,MAAM,UAAU;GAClC,MAAM,SAAS,MAAM,YAAY;GACjC,MAAM,SAAS,MAAM,YAAY;GACjC,MAAM,WAAW,MAAM,UAAU,GAAG,MAAM,WAAW;AACrD,WAAQ,KAAK,UAAU,GAAG,OAAO,GAAG,SAAS,SAAS;EACvD;EAED,KAAK,UAAU;GAEb,MAAM,OACJ,MAAM,YAAY,MAAM,WAAW,MAAM,UAAU;GACrD,MAAM,OAAO,MAAM,YAAY;GAC/B,MAAM,OAAO,MAAM,UAAU,SAAS,MAAM,WAAW;AACvD,WAAQ,UAAU,KAAK,GAAG,KAAK,OAAO;EACvC;EAED,KAAK,aAGH,WAAU;GAAC,M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W,gBAAgB,MAAM,QAAQ;AAE3C,WAAU;AACV,WAAU,kBAAkB,MAAM;AAGlC,KAAI,aACF,WAAU,kBAAkB,aAAa;AAG3C,WAAU;AACV,YAAW,mEAAmE,MAAM,QAAQ;AAC5F,WACE;AACF,QAAO;AACR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatting-utils-C3sej5ER.js","names":["assignedTo: AssignedTo"],"sources":["../src/tools/utils/formatting-utils.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { AssignedToSchema } from \"../../api-client/index\";\n\ntype AssignedTo = z.infer<typeof AssignedToSchema>;\n\n/**\n * Helper function to format assignedTo field for display\n */\nexport function formatAssignedTo(assignedTo: AssignedTo): string {\n if (!assignedTo) {\n return \"Unassigned\";\n }\n\n if (typeof assignedTo === \"string\") {\n return assignedTo;\n }\n\n if (typeof assignedTo === \"object\" && assignedTo.name) {\n return assignedTo.name;\n }\n\n return \"Unknown\";\n}\n"],"mappings":";;;;AAQA,SAAgB,iBAAiBA,YAAgC;AAC/D,MAAK,WACH,QAAO;AAGT,YAAW,eAAe,SACxB,QAAO;AAGT,YAAW,eAAe,YAAY,WAAW,KAC/C,QAAO,WAAW;AAGpB,QAAO;AACR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatting-utils-DDz14xeB.cjs","names":["assignedTo: AssignedTo"],"sources":["../src/tools/utils/formatting-utils.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { AssignedToSchema } from \"../../api-client/index\";\n\ntype AssignedTo = z.infer<typeof AssignedToSchema>;\n\n/**\n * Helper function to format assignedTo field for display\n */\nexport function formatAssignedTo(assignedTo: AssignedTo): string {\n if (!assignedTo) {\n return \"Unassigned\";\n }\n\n if (typeof assignedTo === \"string\") {\n return assignedTo;\n }\n\n if (typeof assignedTo === \"object\" && assignedTo.name) {\n return assignedTo.name;\n }\n\n return \"Unknown\";\n}\n"],"mappings":";;;;;AAQA,SAAgB,iBAAiBA,YAAgC;AAC/D,MAAK,WACH,QAAO;AAGT,YAAW,eAAe,SACxB,QAAO;AAGT,YAAW,eAAe,YAAY,WAAW,KAC/C,QAAO,WAAW;AAGpB,QAAO;AACR"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-doc-BfMg0GIa.cjs","names":["context: ServerContext","UserInputError","ApiError"],"sources":["../src/tools/get-doc.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { fetchWithTimeout } from \"./utils/fetch-utils\";\nimport { UserInputError } from \"../errors\";\nimport { ApiError } from \"../api-client/index\";\nimport type { ServerContext } from \"../types\";\n\nexport default defineTool({\n name: \"get_doc\",\n description: [\n \"Fetch the full markdown content of a Sentry documentation page.\",\n \"\",\n \"Use this tool when you need to:\",\n \"- Read the complete documentation for a specific topic\",\n \"- Get detailed implementation examples or code snippets\",\n \"- Access the full context of a documentation page\",\n \"- Extract specific sections from documentation\",\n \"\",\n \"<examples>\",\n \"### Get the Next.js integration guide\",\n \"\",\n \"```\",\n \"get_doc(path='/platforms/javascript/guides/nextjs.md')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- Use the path from search_docs results for accurate fetching\",\n \"- Paths should end with .md extension\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n path: z\n .string()\n .trim()\n .describe(\n \"The documentation path (e.g., '/platforms/javascript/guides/nextjs.md'). Get this from search_docs results.\",\n ),\n },\n async handler(params, context: ServerContext) {\n setTag(\"doc.path\", params.path);\n\n let output = `# Documentation Content\\n\\n`;\n output += `**Path**: ${params.path}\\n\\n`;\n\n // Validate path format\n if (!params.path.endsWith(\".md\")) {\n throw new UserInputError(\n \"Invalid documentation path. Path must end with .md extension.\",\n );\n }\n\n // Use docs.sentry.io for now - will be configurable via flag in the future\n const baseUrl = \"https://docs.sentry.io\";\n\n // Construct the full URL for the markdown file\n const docUrl = new URL(params.path, baseUrl);\n\n // Validate domain whitelist for security\n const allowedDomains = [\"docs.sentry.io\", \"develop.sentry.io\"];\n if (!allowedDomains.includes(docUrl.hostname)) {\n throw new UserInputError(\n `Invalid domain. Documentation can only be fetched from allowed domains: ${allowedDomains.join(\", \")}`,\n );\n }\n\n const response = await fetchWithTimeout(\n docUrl.toString(),\n {\n headers: {\n Accept: \"text/plain, text/markdown\",\n \"User-Agent\": \"Sentry-MCP/1.0\",\n },\n },\n 15000, // 15 second timeout\n );\n\n if (!response.ok) {\n if (response.status === 404) {\n output += `**Error**: Documentation not found at this path.\\n\\n`;\n output += `Please verify the path is correct. Common issues:\\n`;\n output += `- Path should start with / (e.g., /platforms/javascript/guides/nextjs.md)\\n`;\n output += `- Path should match exactly what's shown in search_docs results\\n`;\n output += `- Some pages may have been moved or renamed\\n\\n`;\n output += `Try searching again with \\`search_docs()\\` to find the correct path.\\n`;\n return output;\n }\n\n throw new ApiError(\n `Failed to fetch documentation: ${response.statusText}`,\n response.status,\n );\n }\n\n const content = await response.text();\n\n // Check if we got HTML instead of markdown (wrong path format)\n if (\n content.trim().startsWith(\"<!DOCTYPE\") ||\n content.trim().startsWith(\"<html\")\n ) {\n output += `> **Error**: Received HTML instead of markdown. The path may be incorrect.\\n\\n`;\n output += `Make sure to use the .md extension in the path.\\n`;\n output += `Example: /platforms/javascript/guides/nextjs.md\\n`;\n return output;\n }\n\n // Add the markdown content\n output += \"---\\n\\n\";\n output += content;\n output += \"\\n\\n---\\n\\n\";\n\n output += \"## Using this documentation\\n\\n\";\n output +=\n \"- This is the raw markdown content from Sentry's documentation\\n\";\n output +=\n \"- Code examples and configuration snippets can be copied directly\\n\";\n output +=\n \"- Links in the documentation are relative to https://docs.sentry.io\\n\";\n output +=\n \"- For more related topics, use `search_docs()` to find additional pages\\n\";\n\n return output;\n },\n});\n"],"mappings":";;;;;;;;;AAQA,sBAAe,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa,EACX,MAAM,MACH,QAAQ,CACR,MAAM,CACN,SACC,8GACD,CACJ;CACD,MAAM,QAAQ,QAAQA,SAAwB;AAC5C,4BAAO,YAAY,OAAO,KAAK;EAE/B,IAAI,UAAU;AACd,aAAW,YAAY,OAAO,KAAK;AAGnC,OAAK,OAAO,KAAK,SAAS,MAAM,CAC9B,OAAM,IAAIC,8BACR;EAKJ,MAAM,UAAU;EAGhB,MAAM,SAAS,IAAI,IAAI,OAAO,MAAM;EAGpC,MAAM,iBAAiB,CAAC,kBAAkB,mBAAoB;AAC9D,OAAK,eAAe,SAAS,OAAO,SAAS,CAC3C,OAAM,IAAIA,+BACP,0EAA0E,eAAe,KAAK,KAAK;EAIxG,MAAM,WAAW,MAAM,qCACrB,OAAO,UAAU,EACjB,EACE,SAAS;GACP,QAAQ;GACR,cAAc;EACf,EACF,GACD,KACD;AAED,OAAK,SAAS,IAAI;AAChB,OAAI,SAAS,WAAW,KAAK;AAC3B,eAAW;AACX,eAAW;AACX,eAAW;AACX,eAAW;AACX,eAAW;AACX,eAAW;AACX,WAAO;GACR;AAED,SAAM,IAAIC,yBACP,iCAAiC,SAAS,cAC3C,SAAS;EAEZ;EAED,MAAM,UAAU,MAAM,SAAS,MAAM;AAGrC,MACE,QAAQ,MAAM,CAAC,WAAW,YAAY,IACtC,QAAQ,MAAM,CAAC,WAAW,QAAQ,EAClC;AACA,cAAW;AACX,cAAW;AACX,cAAW;AACX,UAAO;EACR;AAGD,YAAU;AACV,YAAU;AACV,YAAU;AAEV,YAAU;AACV,YACE;AACF,YACE;AACF,YACE;AACF,YACE;AAEF,SAAO;CACR;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-doc-DyqJe6TP.js","names":["context: ServerContext"],"sources":["../src/tools/get-doc.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { fetchWithTimeout } from \"./utils/fetch-utils\";\nimport { UserInputError } from \"../errors\";\nimport { ApiError } from \"../api-client/index\";\nimport type { ServerContext } from \"../types\";\n\nexport default defineTool({\n name: \"get_doc\",\n description: [\n \"Fetch the full markdown content of a Sentry documentation page.\",\n \"\",\n \"Use this tool when you need to:\",\n \"- Read the complete documentation for a specific topic\",\n \"- Get detailed implementation examples or code snippets\",\n \"- Access the full context of a documentation page\",\n \"- Extract specific sections from documentation\",\n \"\",\n \"<examples>\",\n \"### Get the Next.js integration guide\",\n \"\",\n \"```\",\n \"get_doc(path='/platforms/javascript/guides/nextjs.md')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- Use the path from search_docs results for accurate fetching\",\n \"- Paths should end with .md extension\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n path: z\n .string()\n .trim()\n .describe(\n \"The documentation path (e.g., '/platforms/javascript/guides/nextjs.md'). Get this from search_docs results.\",\n ),\n },\n async handler(params, context: ServerContext) {\n setTag(\"doc.path\", params.path);\n\n let output = `# Documentation Content\\n\\n`;\n output += `**Path**: ${params.path}\\n\\n`;\n\n // Validate path format\n if (!params.path.endsWith(\".md\")) {\n throw new UserInputError(\n \"Invalid documentation path. Path must end with .md extension.\",\n );\n }\n\n // Use docs.sentry.io for now - will be configurable via flag in the future\n const baseUrl = \"https://docs.sentry.io\";\n\n // Construct the full URL for the markdown file\n const docUrl = new URL(params.path, baseUrl);\n\n // Validate domain whitelist for security\n const allowedDomains = [\"docs.sentry.io\", \"develop.sentry.io\"];\n if (!allowedDomains.includes(docUrl.hostname)) {\n throw new UserInputError(\n `Invalid domain. Documentation can only be fetched from allowed domains: ${allowedDomains.join(\", \")}`,\n );\n }\n\n const response = await fetchWithTimeout(\n docUrl.toString(),\n {\n headers: {\n Accept: \"text/plain, text/markdown\",\n \"User-Agent\": \"Sentry-MCP/1.0\",\n },\n },\n 15000, // 15 second timeout\n );\n\n if (!response.ok) {\n if (response.status === 404) {\n output += `**Error**: Documentation not found at this path.\\n\\n`;\n output += `Please verify the path is correct. Common issues:\\n`;\n output += `- Path should start with / (e.g., /platforms/javascript/guides/nextjs.md)\\n`;\n output += `- Path should match exactly what's shown in search_docs results\\n`;\n output += `- Some pages may have been moved or renamed\\n\\n`;\n output += `Try searching again with \\`search_docs()\\` to find the correct path.\\n`;\n return output;\n }\n\n throw new ApiError(\n `Failed to fetch documentation: ${response.statusText}`,\n response.status,\n );\n }\n\n const content = await response.text();\n\n // Check if we got HTML instead of markdown (wrong path format)\n if (\n content.trim().startsWith(\"<!DOCTYPE\") ||\n content.trim().startsWith(\"<html\")\n ) {\n output += `> **Error**: Received HTML instead of markdown. The path may be incorrect.\\n\\n`;\n output += `Make sure to use the .md extension in the path.\\n`;\n output += `Example: /platforms/javascript/guides/nextjs.md\\n`;\n return output;\n }\n\n // Add the markdown content\n output += \"---\\n\\n\";\n output += content;\n output += \"\\n\\n---\\n\\n\";\n\n output += \"## Using this documentation\\n\\n\";\n output +=\n \"- This is the raw markdown content from Sentry's documentation\\n\";\n output +=\n \"- Code examples and configuration snippets can be copied directly\\n\";\n output +=\n \"- Links in the documentation are relative to https://docs.sentry.io\\n\";\n output +=\n \"- For more related topics, use `search_docs()` to find additional pages\\n\";\n\n return output;\n },\n});\n"],"mappings":";;;;;;;;AAQA,sBAAe,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa,EACX,MAAM,EACH,QAAQ,CACR,MAAM,CACN,SACC,8GACD,CACJ;CACD,MAAM,QAAQ,QAAQA,SAAwB;AAC5C,SAAO,YAAY,OAAO,KAAK;EAE/B,IAAI,UAAU;AACd,aAAW,YAAY,OAAO,KAAK;AAGnC,OAAK,OAAO,KAAK,SAAS,MAAM,CAC9B,OAAM,IAAI,eACR;EAKJ,MAAM,UAAU;EAGhB,MAAM,SAAS,IAAI,IAAI,OAAO,MAAM;EAGpC,MAAM,iBAAiB,CAAC,kBAAkB,mBAAoB;AAC9D,OAAK,eAAe,SAAS,OAAO,SAAS,CAC3C,OAAM,IAAI,gBACP,0EAA0E,eAAe,KAAK,KAAK;EAIxG,MAAM,WAAW,MAAM,iBACrB,OAAO,UAAU,EACjB,EACE,SAAS;GACP,QAAQ;GACR,cAAc;EACf,EACF,GACD,KACD;AAED,OAAK,SAAS,IAAI;AAChB,OAAI,SAAS,WAAW,KAAK;AAC3B,eAAW;AACX,eAAW;AACX,eAAW;AACX,eAAW;AACX,eAAW;AACX,eAAW;AACX,WAAO;GACR;AAED,SAAM,IAAI,UACP,iCAAiC,SAAS,cAC3C,SAAS;EAEZ;EAED,MAAM,UAAU,MAAM,SAAS,MAAM;AAGrC,MACE,QAAQ,MAAM,CAAC,WAAW,YAAY,IACtC,QAAQ,MAAM,CAAC,WAAW,QAAQ,EAClC;AACA,cAAW;AACX,cAAW;AACX,cAAW;AACX,UAAO;EACR;AAGD,YAAU;AACV,YAAU;AACV,YAAU;AAEV,YAAU;AACV,YACE;AACF,YACE;AACF,YACE;AACF,YACE;AAEF,SAAO;CACR;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-event-attachment-B-ElqztF.js","names":["context: ServerContext","contentParts: (TextContent | ImageContent | EmbeddedResource)[]","image: ImageContent","resource: EmbeddedResource","output","text: TextContent"],"sources":["../src/tools/get-event-attachment.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext } from \"./utils/api-utils\";\nimport type { ServerContext } from \"../types\";\nimport type {\n TextContent,\n ImageContent,\n EmbeddedResource,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport {\n ParamOrganizationSlug,\n ParamProjectSlug,\n ParamEventId,\n ParamAttachmentId,\n ParamRegionUrl,\n} from \"../schema\";\nimport { setTag } from \"@sentry/core\";\n\nexport default defineTool({\n name: \"get_event_attachment\",\n description: [\n \"Download attachments from a Sentry event.\",\n \"\",\n \"Use this tool when you need to:\",\n \"- Download files attached to a specific event\",\n \"- Access screenshots, log files, or other attachments uploaded with an error report\",\n \"- Retrieve attachment metadata and download URLs\",\n \"\",\n \"<examples>\",\n \"### Download a specific attachment by ID\",\n \"\",\n \"```\",\n \"get_event_attachment(organizationSlug='my-organization', projectSlug='my-project', eventId='c49541c747cb4d8aa3efb70ca5aba243', attachmentId='12345')\",\n \"```\",\n \"\",\n \"### List all attachments for an event\",\n \"\",\n \"```\",\n \"get_event_attachment(organizationSlug='my-organization', projectSlug='my-project', eventId='c49541c747cb4d8aa3efb70ca5aba243')\",\n \"```\",\n \"\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If `attachmentId` is provided, the specific attachment will be downloaded as an embedded resource\",\n \"- If `attachmentId` is omitted, all attachments for the event will be listed with download information\",\n \"- The `projectSlug` is required to identify which project the event belongs to\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug,\n projectSlug: ParamProjectSlug,\n eventId: ParamEventId,\n attachmentId: ParamAttachmentId.optional(),\n regionUrl: ParamRegionUrl.optional(),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n\n setTag(\"organization.slug\", params.organizationSlug);\n\n // If attachmentId is provided, download the specific attachment\n if (params.attachmentId) {\n const attachment = await apiService.getEventAttachment({\n organizationSlug: params.organizationSlug,\n projectSlug: params.projectSlug,\n eventId: params.eventId,\n attachmentId: params.attachmentId,\n });\n\n const contentParts: (TextContent | ImageContent | EmbeddedResource)[] =\n [];\n const isBinary = !attachment.attachment.mimetype?.startsWith(\"text/\");\n\n if (isBinary) {\n const isImage = attachment.attachment.mimetype?.startsWith(\"image/\");\n // Base64 encode the binary attachment content\n // and add to the content as an embedded resource\n const uint8Array = new Uint8Array(await attachment.blob.arrayBuffer());\n let binary = \"\";\n for (let i = 0; i < uint8Array.byteLength; i++) {\n binary += String.fromCharCode(uint8Array[i]);\n }\n if (isImage) {\n const image: ImageContent = {\n type: \"image\",\n mimeType: attachment.attachment.mimetype,\n data: btoa(binary),\n };\n contentParts.push(image);\n } else {\n const resource: EmbeddedResource = {\n id: params.attachmentId,\n type: \"resource\",\n resource: {\n uri: `file://${attachment.filename}`,\n mimeType: attachment.attachment.mimetype,\n blob: btoa(binary),\n },\n };\n contentParts.push(resource);\n }\n }\n\n let output = `# Event Attachment Download\\n\\n`;\n output += `**Event ID:** ${params.eventId}\\n`;\n output += `**Attachment ID:** ${params.attachmentId}\\n`;\n output += `**Filename:** ${attachment.filename}\\n`;\n output += `**Type:** ${attachment.attachment.type}\\n`;\n output += `**Size:** ${attachment.attachment.size} bytes\\n`;\n output += `**MIME Type:** ${attachment.attachment.mimetype}\\n`;\n output += `**Created:** ${attachment.attachment.dateCreated}\\n`;\n output += `**SHA1:** ${attachment.attachment.sha1}\\n\\n`;\n output += `**Download URL:** ${attachment.downloadUrl}\\n\\n`;\n\n if (isBinary) {\n output += `## Binary Content\\n\\n`;\n output += `The attachment is included as a resource and accessible through your client.\\n`;\n } else {\n // If it's a text file and we have blob content, decode and display it instead\n // of embedding it as an image or resource\n const textContent = await attachment.blob.text();\n output += `## File Content\\n\\n`;\n output += `\\`\\`\\`\\n${textContent}\\n\\`\\`\\`\\n\\n`;\n }\n\n const text: TextContent = {\n type: \"text\",\n text: output,\n };\n contentParts.push(text);\n\n return contentParts;\n }\n\n // List all attachments for the event\n const attachments = await apiService.listEventAttachments({\n organizationSlug: params.organizationSlug,\n projectSlug: params.projectSlug,\n eventId: params.eventId,\n });\n\n let output = `# Event Attachments\\n\\n`;\n output += `**Event ID:** ${params.eventId}\\n`;\n output += `**Project:** ${params.projectSlug}\\n\\n`;\n\n if (attachments.length === 0) {\n output += \"No attachments found for this event.\\n\";\n return output;\n }\n\n output += `Found ${attachments.length} attachment(s):\\n\\n`;\n\n attachments.forEach((attachment, index) => {\n output += `## Attachment ${index + 1}\\n\\n`;\n output += `**ID:** ${attachment.id}\\n`;\n output += `**Name:** ${attachment.name}\\n`;\n output += `**Type:** ${attachment.type}\\n`;\n output += `**Size:** ${attachment.size} bytes\\n`;\n output += `**MIME Type:** ${attachment.mimetype}\\n`;\n output += `**Created:** ${attachment.dateCreated}\\n`;\n output += `**SHA1:** ${attachment.sha1}\\n\\n`;\n output += `To download this attachment, use the \"get_event_attachment\" tool with the attachmentId provided:\\n`;\n output += `\\`get_event_attachment(organizationSlug=\"${params.organizationSlug}\", projectSlug=\"${params.projectSlug}\", eventId=\"${params.eventId}\", attachmentId=\"${attachment.id}\")\\`\\n\\n`;\n });\n\n return output;\n },\n});\n"],"mappings":";;;;;;AAkBA,mCAAe,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkB;EAClB,aAAa;EACb,SAAS;EACT,cAAc,kBAAkB,UAAU;EAC1C,WAAW,eAAe,UAAU;CACrC;CACD,MAAM,QAAQ,QAAQA,SAAwB;EAC5C,MAAM,aAAa,sBAAsB,SAAS,EAChD,WAAW,OAAO,UACnB,EAAC;AAEF,SAAO,qBAAqB,OAAO,iBAAiB;AAGpD,MAAI,OAAO,cAAc;GACvB,MAAM,aAAa,MAAM,WAAW,mBAAmB;IACrD,kBAAkB,OAAO;IACzB,aAAa,OAAO;IACpB,SAAS,OAAO;IAChB,cAAc,OAAO;GACtB,EAAC;GAEF,MAAMC,eACJ,CAAE;GACJ,MAAM,YAAY,WAAW,WAAW,UAAU,WAAW,QAAQ;AAErE,OAAI,UAAU;IACZ,MAAM,UAAU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AO,QAAQ;AAC1C,aAAW,eAAe,OAAO,YAAY;AAE7C,MAAI,YAAY,WAAW,GAAG;AAC5B,aAAU;AACV,UAAO;EACR;AAED,aAAW,QAAQ,YAAY,OAAO;AAEtC,cAAY,QAAQ,CAAC,YAAY,UAAU;AACzC,cAAW,gBAAgB,QAAQ,EAAE;AACrC,cAAW,UAAU,WAAW,GAAG;AACnC,cAAW,YAAY,WAAW,KAAK;AACvC,cAAW,YAAY,WAAW,KAAK;AACvC,cAAW,YAAY,WAAW,KAAK;AACvC,cAAW,iBAAiB,WAAW,SAAS;AAChD,cAAW,eAAe,WAAW,YAAY;AACjD,cAAW,YAAY,WAAW,KAAK;AACvC,cAAW;AACX,cAAW,2CAA2C,OAAO,iBAAiB,kBAAkB,OAAO,YAAY,cAAc,OAAO,QAAQ,mBAAmB,WAAW,GAAG;EAClL,EAAC;AAEF,SAAO;CACR;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-event-attachment-o0oH43Tv.cjs","names":["ParamOrganizationSlug","ParamProjectSlug","ParamEventId","context: ServerContext","contentParts: (TextContent | ImageContent | EmbeddedResource)[]","image: ImageContent","resource: EmbeddedResource","output","text: TextContent"],"sources":["../src/tools/get-event-attachment.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext } from \"./utils/api-utils\";\nimport type { ServerContext } from \"../types\";\nimport type {\n TextContent,\n ImageContent,\n EmbeddedResource,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport {\n ParamOrganizationSlug,\n ParamProjectSlug,\n ParamEventId,\n ParamAttachmentId,\n ParamRegionUrl,\n} from \"../schema\";\nimport { setTag } from \"@sentry/core\";\n\nexport default defineTool({\n name: \"get_event_attachment\",\n description: [\n \"Download attachments from a Sentry event.\",\n \"\",\n \"Use this tool when you need to:\",\n \"- Download files attached to a specific event\",\n \"- Access screenshots, log files, or other attachments uploaded with an error report\",\n \"- Retrieve attachment metadata and download URLs\",\n \"\",\n \"<examples>\",\n \"### Download a specific attachment by ID\",\n \"\",\n \"```\",\n \"get_event_attachment(organizationSlug='my-organization', projectSlug='my-project', eventId='c49541c747cb4d8aa3efb70ca5aba243', attachmentId='12345')\",\n \"```\",\n \"\",\n \"### List all attachments for an event\",\n \"\",\n \"```\",\n \"get_event_attachment(organizationSlug='my-organization', projectSlug='my-project', eventId='c49541c747cb4d8aa3efb70ca5aba243')\",\n \"```\",\n \"\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If `attachmentId` is provided, the specific attachment will be downloaded as an embedded resource\",\n \"- If `attachmentId` is omitted, all attachments for the event will be listed with download information\",\n \"- The `projectSlug` is required to identify which project the event belongs to\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug,\n projectSlug: ParamProjectSlug,\n eventId: ParamEventId,\n attachmentId: ParamAttachmentId.optional(),\n regionUrl: ParamRegionUrl.optional(),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n\n setTag(\"organization.slug\", params.organizationSlug);\n\n // If attachmentId is provided, download the specific attachment\n if (params.attachmentId) {\n const attachment = await apiService.getEventAttachment({\n organizationSlug: params.organizationSlug,\n projectSlug: params.projectSlug,\n eventId: params.eventId,\n attachmentId: params.attachmentId,\n });\n\n const contentParts: (TextContent | ImageContent | EmbeddedResource)[] =\n [];\n const isBinary = !attachment.attachment.mimetype?.startsWith(\"text/\");\n\n if (isBinary) {\n const isImage = attachment.attachment.mimetype?.startsWith(\"image/\");\n // Base64 encode the binary attachment content\n // and add to the content as an embedded resource\n const uint8Array = new Uint8Array(await attachment.blob.arrayBuffer());\n let binary = \"\";\n for (let i = 0; i < uint8Array.byteLength; i++) {\n binary += String.fromCharCode(uint8Array[i]);\n }\n if (isImage) {\n const image: ImageContent = {\n type: \"image\",\n mimeType: attachment.attachment.mimetype,\n data: btoa(binary),\n };\n contentParts.push(image);\n } else {\n const resource: EmbeddedResource = {\n id: params.attachmentId,\n type: \"resource\",\n resource: {\n uri: `file://${attachment.filename}`,\n mimeType: attachment.attachment.mimetype,\n blob: btoa(binary),\n },\n };\n contentParts.push(resource);\n }\n }\n\n let output = `# Event Attachment Download\\n\\n`;\n output += `**Event ID:** ${params.eventId}\\n`;\n output += `**Attachment ID:** ${params.attachmentId}\\n`;\n output += `**Filename:** ${attachment.filename}\\n`;\n output += `**Type:** ${attachment.attachment.type}\\n`;\n output += `**Size:** ${attachment.attachment.size} bytes\\n`;\n output += `**MIME Type:** ${attachment.attachment.mimetype}\\n`;\n output += `**Created:** ${attachment.attachment.dateCreated}\\n`;\n output += `**SHA1:** ${attachment.attachment.sha1}\\n\\n`;\n output += `**Download URL:** ${attachment.downloadUrl}\\n\\n`;\n\n if (isBinary) {\n output += `## Binary Content\\n\\n`;\n output += `The attachment is included as a resource and accessible through your client.\\n`;\n } else {\n // If it's a text file and we have blob content, decode and display it instead\n // of embedding it as an image or resource\n const textContent = await attachment.blob.text();\n output += `## File Content\\n\\n`;\n output += `\\`\\`\\`\\n${textContent}\\n\\`\\`\\`\\n\\n`;\n }\n\n const text: TextContent = {\n type: \"text\",\n text: output,\n };\n contentParts.push(text);\n\n return contentParts;\n }\n\n // List all attachments for the event\n const attachments = await apiService.listEventAttachments({\n organizationSlug: params.organizationSlug,\n projectSlug: params.projectSlug,\n eventId: params.eventId,\n });\n\n let output = `# Event Attachments\\n\\n`;\n output += `**Event ID:** ${params.eventId}\\n`;\n output += `**Project:** ${params.projectSlug}\\n\\n`;\n\n if (attachments.length === 0) {\n output += \"No attachments found for this event.\\n\";\n return output;\n }\n\n output += `Found ${attachments.length} attachment(s):\\n\\n`;\n\n attachments.forEach((attachment, index) => {\n output += `## Attachment ${index + 1}\\n\\n`;\n output += `**ID:** ${attachment.id}\\n`;\n output += `**Name:** ${attachment.name}\\n`;\n output += `**Type:** ${attachment.type}\\n`;\n output += `**Size:** ${attachment.size} bytes\\n`;\n output += `**MIME Type:** ${attachment.mimetype}\\n`;\n output += `**Created:** ${attachment.dateCreated}\\n`;\n output += `**SHA1:** ${attachment.sha1}\\n\\n`;\n output += `To download this attachment, use the \"get_event_attachment\" tool with the attachmentId provided:\\n`;\n output += `\\`get_event_attachment(organizationSlug=\"${params.organizationSlug}\", projectSlug=\"${params.projectSlug}\", eventId=\"${params.eventId}\", attachmentId=\"${attachment.id}\")\\`\\n\\n`;\n });\n\n return output;\n },\n});\n"],"mappings":";;;;;;;AAkBA,mCAAe,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkBA;EAClB,aAAaC;EACb,SAASC;EACT,cAAc,iCAAkB,UAAU;EAC1C,WAAW,8BAAe,UAAU;CACrC;CACD,MAAM,QAAQ,QAAQC,SAAwB;EAC5C,MAAM,aAAa,wCAAsB,SAAS,EAChD,WAAW,OAAO,UACnB,EAAC;AAEF,4BAAO,qBAAqB,OAAO,iBAAiB;AAGpD,MAAI,OAAO,cAAc;GACvB,MAAM,aAAa,MAAM,WAAW,mBAAmB;IACrD,kBAAkB,OAAO;IACzB,aAAa,OAAO;IACpB,SAAS,OAAO;IAChB,cAAc,OAAO;GACtB,EAAC;GAEF,MAAMC,eACJ,CAAE;GACJ,MAAM,YAAY,WAAW,WAAW,UAAU,WAAW,QAAQ;AAErE,OAAI,UAAU;IACZ,MAAM,UAAU,WAAW,WAAW,UAAU,WAAW,SAAS;IAGpE,MAAM,aAAa,IAAI,WAAW,MAAM,WAAW,KAAK,aAAa;IACrE,IAAI,SAAS;AACb,SAAK,IAAI,IAAI,GAAG,IAAI,WAAW,YAAY,IACzC,WAAU,OAAO,aAAa,WAAW,GAAG;AAE9C,QAAI,SAAS;KACX,MAAMC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AAU,WAAW,GAAG;AACnC,cAAW,YAAY,WAAW,KAAK;AACvC,cAAW,YAAY,WAAW,KAAK;AACvC,cAAW,YAAY,WAAW,KAAK;AACvC,cAAW,iBAAiB,WAAW,SAAS;AAChD,cAAW,eAAe,WAAW,YAAY;AACjD,cAAW,YAAY,WAAW,KAAK;AACvC,cAAW;AACX,cAAW,2CAA2C,OAAO,iBAAiB,kBAAkB,OAAO,YAAY,cAAc,OAAO,QAAQ,mBAAmB,WAAW,GAAG;EAClL,EAAC;AAEF,SAAO;CACR;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-issue-details-CP_RyCpt.cjs","names":["context: ServerContext","orgSlug","UserInputError","issue","event","autofixState:\n | Awaited<ReturnType<typeof apiService.getAutofixState>>\n | undefined","autofixState:\n | Awaited<ReturnType<typeof apiService.getAutofixState>>\n | undefined"],"sources":["../src/tools/get-issue-details.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext, withApiErrorHandling } from \"./utils/api-utils\";\nimport { parseIssueParams, formatIssueOutput } from \"./utils/issue-utils\";\nimport { UserInputError } from \"../errors\";\nimport type { ServerContext } from \"../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamIssueShortId,\n ParamIssueUrl,\n} from \"../schema\";\n\nexport default defineTool({\n name: \"get_issue_details\",\n description: [\n \"Get detailed information about a specific Sentry issue by ID.\",\n \"\",\n \"🔍 USE THIS TOOL WHEN USERS:\",\n \"- Provide a specific issue ID (e.g., 'CLOUDFLARE-MCP-41', 'PROJECT-123')\",\n \"- Ask to 'explain [ISSUE-ID]', 'tell me about [ISSUE-ID]'\",\n \"- Want details/stacktrace/analysis for a known issue\",\n \"- Provide a Sentry issue URL\",\n \"\",\n \"❌ DO NOT USE for:\",\n \"- General searching or listing issues (use search_issues)\",\n \"- Root cause analysis (use analyze_issue_with_seer)\",\n \"\",\n \"TRIGGER PATTERNS:\",\n \"- 'Explain ISSUE-123' → use get_issue_details\",\n \"- 'Tell me about PROJECT-456' → use get_issue_details\",\n \"- 'What happened in [issue URL]' → use get_issue_details\",\n \"\",\n \"<examples>\",\n \"### Explain specific issue\",\n \"```\",\n \"get_issue_details(organizationSlug='my-organization', issueId='CLOUDFLARE-MCP-41')\",\n \"```\",\n \"\",\n \"### Get details for event ID\",\n \"```\",\n \"get_issue_details(organizationSlug='my-organization', eventId='c49541c747cb4d8aa3efb70ca5aba243')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user provides the `issueUrl`, you can ignore the other parameters.\",\n \"- If the user provides `issueId` or `eventId` (only one is needed), `organizationSlug` is required.\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug.optional(),\n regionUrl: ParamRegionUrl.optional(),\n issueId: ParamIssueShortId.optional(),\n eventId: z.string().trim().describe(\"The ID of the event.\").optional(),\n issueUrl: ParamIssueUrl.optional(),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n\n if (params.eventId) {\n const orgSlug = params.organizationSlug;\n if (!orgSlug) {\n throw new UserInputError(\n \"`organizationSlug` is required when providing `eventId`\",\n );\n }\n\n setTag(\"organization.slug\", orgSlug);\n const [issue] = await apiService.listIssues({\n organizationSlug: orgSlug,\n query: params.eventId,\n });\n if (!issue) {\n return `# Event Not Found\\n\\nNo issue found for Event ID: ${params.eventId}`;\n }\n const event = await apiService.getEventForIssue({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n eventId: params.eventId,\n });\n\n // Try to fetch Seer analysis context (non-blocking)\n let autofixState:\n | Awaited<ReturnType<typeof apiService.getAutofixState>>\n | undefined;\n try {\n autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n });\n } catch (error) {\n // Silently continue if Seer analysis is not available\n // This ensures the tool works even if Seer is not enabled\n }\n\n return formatIssueOutput({\n organizationSlug: orgSlug,\n issue,\n event,\n apiService,\n autofixState,\n });\n }\n\n // Validate that we have the minimum required parameters\n if (!params.issueUrl && !params.issueId) {\n throw new UserInputError(\n \"Either `issueId` or `issueUrl` must be provided\",\n );\n }\n\n if (!params.issueUrl && !params.organizationSlug) {\n throw new UserInputError(\n \"`organizationSlug` is required when providing `issueId`\",\n );\n }\n\n const { organizationSlug: orgSlug, issueId: parsedIssueId } =\n parseIssueParams({\n organizationSlug: params.organizationSlug,\n issueId: params.issueId,\n issueUrl: params.issueUrl,\n });\n\n setTag(\"organization.slug\", orgSlug);\n\n const issue = await withApiErrorHandling(\n () =>\n apiService.getIssue({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n }),\n {\n organizationSlug: orgSlug,\n issueId: parsedIssueId,\n },\n );\n\n const event = await apiService.getLatestEventForIssue({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n });\n\n // Try to fetch Seer analysis context (non-blocking)\n let autofixState:\n | Awaited<ReturnType<typeof apiService.getAutofixState>>\n | undefined;\n try {\n autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n });\n } catch (error) {\n // Silently continue if Seer analysis is not available\n // This ensures the tool works even if Seer is not enabled\n }\n\n return formatIssueOutput({\n organizationSlug: orgSlug,\n issue,\n event,\n apiService,\n autofixState,\n });\n },\n});\n"],"mappings":";;;;;;;;;;;AAcA,gCAAe,8BAAW;CACxB,MAAM;CACN,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkB,qCAAsB,UAAU;EAClD,WAAW,8BAAe,UAAU;EACpC,SAAS,iCAAkB,UAAU;EACrC,SAAS,MAAE,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;AAGJ,MAAI;AACF,kBAAe,MAAM,WAAW,gBAAgB;IAC9C,kBAAkB;IAClB,SAAS,MAAM;GAChB,EAAC;EACH,SAAQ,OAAO,CAGf;AAED,SAAO,qCAAkB;GACvB,kBAAkB;GAClB;GACA;GACA;GACA;EACD,EAAC;CACH;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-issue-details-CzroF7HR.js","names":["context: ServerContext","orgSlug","issue","event","autofixState:\n | Awaited<ReturnType<typeof apiService.getAutofixState>>\n | undefined","autofixState:\n | Awaited<ReturnType<typeof apiService.getAutofixState>>\n | undefined"],"sources":["../src/tools/get-issue-details.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"./utils/defineTool\";\nimport { apiServiceFromContext, withApiErrorHandling } from \"./utils/api-utils\";\nimport { parseIssueParams, formatIssueOutput } from \"./utils/issue-utils\";\nimport { UserInputError } from \"../errors\";\nimport type { ServerContext } from \"../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamIssueShortId,\n ParamIssueUrl,\n} from \"../schema\";\n\nexport default defineTool({\n name: \"get_issue_details\",\n description: [\n \"Get detailed information about a specific Sentry issue by ID.\",\n \"\",\n \"🔍 USE THIS TOOL WHEN USERS:\",\n \"- Provide a specific issue ID (e.g., 'CLOUDFLARE-MCP-41', 'PROJECT-123')\",\n \"- Ask to 'explain [ISSUE-ID]', 'tell me about [ISSUE-ID]'\",\n \"- Want details/stacktrace/analysis for a known issue\",\n \"- Provide a Sentry issue URL\",\n \"\",\n \"❌ DO NOT USE for:\",\n \"- General searching or listing issues (use search_issues)\",\n \"- Root cause analysis (use analyze_issue_with_seer)\",\n \"\",\n \"TRIGGER PATTERNS:\",\n \"- 'Explain ISSUE-123' → use get_issue_details\",\n \"- 'Tell me about PROJECT-456' → use get_issue_details\",\n \"- 'What happened in [issue URL]' → use get_issue_details\",\n \"\",\n \"<examples>\",\n \"### Explain specific issue\",\n \"```\",\n \"get_issue_details(organizationSlug='my-organization', issueId='CLOUDFLARE-MCP-41')\",\n \"```\",\n \"\",\n \"### Get details for event ID\",\n \"```\",\n \"get_issue_details(organizationSlug='my-organization', eventId='c49541c747cb4d8aa3efb70ca5aba243')\",\n \"```\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user provides the `issueUrl`, you can ignore the other parameters.\",\n \"- If the user provides `issueId` or `eventId` (only one is needed), `organizationSlug` is required.\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug.optional(),\n regionUrl: ParamRegionUrl.optional(),\n issueId: ParamIssueShortId.optional(),\n eventId: z.string().trim().describe(\"The ID of the event.\").optional(),\n issueUrl: ParamIssueUrl.optional(),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n\n if (params.eventId) {\n const orgSlug = params.organizationSlug;\n if (!orgSlug) {\n throw new UserInputError(\n \"`organizationSlug` is required when providing `eventId`\",\n );\n }\n\n setTag(\"organization.slug\", orgSlug);\n const [issue] = await apiService.listIssues({\n organizationSlug: orgSlug,\n query: params.eventId,\n });\n if (!issue) {\n return `# Event Not Found\\n\\nNo issue found for Event ID: ${params.eventId}`;\n }\n const event = await apiService.getEventForIssue({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n eventId: params.eventId,\n });\n\n // Try to fetch Seer analysis context (non-blocking)\n let autofixState:\n | Awaited<ReturnType<typeof apiService.getAutofixState>>\n | undefined;\n try {\n autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n });\n } catch (error) {\n // Silently continue if Seer analysis is not available\n // This ensures the tool works even if Seer is not enabled\n }\n\n return formatIssueOutput({\n organizationSlug: orgSlug,\n issue,\n event,\n apiService,\n autofixState,\n });\n }\n\n // Validate that we have the minimum required parameters\n if (!params.issueUrl && !params.issueId) {\n throw new UserInputError(\n \"Either `issueId` or `issueUrl` must be provided\",\n );\n }\n\n if (!params.issueUrl && !params.organizationSlug) {\n throw new UserInputError(\n \"`organizationSlug` is required when providing `issueId`\",\n );\n }\n\n const { organizationSlug: orgSlug, issueId: parsedIssueId } =\n parseIssueParams({\n organizationSlug: params.organizationSlug,\n issueId: params.issueId,\n issueUrl: params.issueUrl,\n });\n\n setTag(\"organization.slug\", orgSlug);\n\n const issue = await withApiErrorHandling(\n () =>\n apiService.getIssue({\n organizationSlug: orgSlug,\n issueId: parsedIssueId!,\n }),\n {\n organizationSlug: orgSlug,\n issueId: parsedIssueId,\n },\n );\n\n const event = await apiService.getLatestEventForIssue({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n });\n\n // Try to fetch Seer analysis context (non-blocking)\n let autofixState:\n | Awaited<ReturnType<typeof apiService.getAutofixState>>\n | undefined;\n try {\n autofixState = await apiService.getAutofixState({\n organizationSlug: orgSlug,\n issueId: issue.shortId,\n });\n } catch (error) {\n // Silently continue if Seer analysis is not available\n // This ensures the tool works even if Seer is not enabled\n }\n\n return formatIssueOutput({\n organizationSlug: orgSlug,\n issue,\n event,\n apiService,\n autofixState,\n });\n },\n});\n"],"mappings":";;;;;;;;;;AAcA,gCAAe,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkB,sBAAsB,UAAU;EAClD,WAAW,eAAe,UAAU;EACpC,SAAS,kBAAkB,UAAU;EACrC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,uBAAuB,CAAC,UAAU;EACtE,UAAU,cAAc,UAAU;CACnC;CACD,MAAM,QAAQ,QAAQA,SAAwB;EAC5C,MAAM,aAAa,sBAAsB,SAAS,EAChD,WAAW,OA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,EAAC;CACH;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler-BGhr9FJM.d.cts","names":[],"sources":["../src/tools/search-events/handler.ts"],"sourcesContent":[],"mappings":";;;;cAAwB;;;EAAA,WAAA,eAAA,YAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler-BH_OLIbD.cjs","names":["ParamOrganizationSlug","context: ServerContext","projectId: string | undefined","UserInputError","RECOMMENDED_FIELDS","fields: string[]","timeParams: { statsPeriod?: string; start?: string; end?: string }","eventsResponse: unknown","ApiError","response: unknown","data: unknown"],"sources":["../src/tools/search-events/handler.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"../utils/defineTool\";\nimport {\n apiServiceFromContext,\n withApiErrorHandling,\n} from \"../utils/api-utils\";\nimport type { ServerContext } from \"../../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamProjectSlug,\n} from \"../../schema\";\nimport { translateQuery } from \"./agent\";\nimport {\n formatErrorResults,\n formatLogResults,\n formatSpanResults,\n} from \"./formatters\";\nimport { RECOMMENDED_FIELDS } from \"./config\";\nimport { UserInputError } from \"../../errors\";\nimport type { SentryApiService } from \"../../api-client\";\nimport { ApiError } from \"../../api-client\";\n\nexport default defineTool({\n name: \"search_events\",\n description: [\n \"Search for events AND perform counts/aggregations - the ONLY tool for statistics and counts.\",\n \"\",\n \"Supports TWO query types:\",\n \"1. AGGREGATIONS (counts, sums, averages): 'how many errors', 'count of issues', 'total tokens'\",\n \"2. Individual events with timestamps: 'show me error logs from last hour'\",\n \"\",\n \"🔢 USE THIS FOR ALL COUNTS/STATISTICS:\",\n \"- 'how many errors today' → returns count\",\n \"- 'count of database failures' → returns count\",\n \"- 'total number of issues' → returns count\",\n \"- 'average response time' → returns avg()\",\n \"- 'sum of tokens used' → returns sum()\",\n \"\",\n \"📋 ALSO USE FOR INDIVIDUAL EVENTS:\",\n \"- 'error logs from last hour' → returns event list\",\n \"- 'database errors with timestamps' → returns event list\",\n \"- 'trace spans for slow API calls' → returns span list\",\n \"\",\n \"Dataset Selection (AI automatically chooses):\",\n \"- errors: Exception/crash events\",\n \"- logs: Log entries\",\n \"- spans: Performance data, AI/LLM calls, token usage\",\n \"\",\n \"❌ DO NOT USE for grouped issue lists → use search_issues\",\n \"\",\n \"<examples>\",\n \"search_events(organizationSlug='my-org', naturalLanguageQuery='how many errors today')\",\n \"search_events(organizationSlug='my-org', naturalLanguageQuery='count of database failures this week')\",\n \"search_events(organizationSlug='my-org', naturalLanguageQuery='total tokens used by model')\",\n \"search_events(organizationSlug='my-org', naturalLanguageQuery='error logs from the last hour')\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user passes a parameter in the form of name/otherName, it's likely in the format of <organizationSlug>/<projectSlug>.\",\n \"- Parse org/project notation directly without calling find_organizations or find_projects.\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug,\n naturalLanguageQuery: z\n .string()\n .trim()\n .min(1)\n .describe(\"Natural language description of what you want to search for\"),\n projectSlug: ParamProjectSlug.optional(),\n regionUrl: ParamRegionUrl.optional(),\n limit: z\n .number()\n .min(1)\n .max(100)\n .optional()\n .default(10)\n .describe(\"Maximum number of results to return\"),\n includeExplanation: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Include explanation of how the query was translated\"),\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 // The agent will determine the dataset based on the query content\n\n // Convert project slug to ID if needed - we need this for attribute fetching\n let projectId: string | undefined;\n if (params.projectSlug) {\n const project = await withApiErrorHandling(\n () =>\n apiService.getProject({\n organizationSlug,\n projectSlugOrId: params.projectSlug!,\n }),\n {\n organizationSlug,\n projectSlugOrId: params.projectSlug,\n },\n );\n projectId = String(project.id);\n }\n\n // Translate the natural language query using Search Events Agent\n // The agent will determine the dataset and fetch the appropriate attributes\n const parsed = await translateQuery(\n {\n naturalLanguageQuery: params.naturalLanguageQuery,\n organizationSlug,\n projectId,\n },\n apiService,\n organizationSlug,\n projectId,\n );\n\n // Handle Search Events Agent errors first\n if (parsed.error) {\n throw new UserInputError(\n `Search Events Agent could not translate query \"${params.naturalLanguageQuery}\". Error: ${parsed.error}`,\n );\n }\n\n // Get the dataset chosen by the agent (should be defined when no error)\n const dataset = parsed.dataset!;\n\n // Get recommended fields for this dataset (for fallback when no fields are provided)\n const recommendedFields = RECOMMENDED_FIELDS[dataset];\n\n // Validate that sort parameter was provided\n if (!parsed.sort) {\n throw new UserInputError(\n `Search Events Agent response missing required 'sort' parameter. Received: ${JSON.stringify(parsed, null, 2)}. The agent must specify how to sort results (e.g., '-timestamp' for newest first, '-count()' for highest count).`,\n );\n }\n\n // Use empty string as default if no query is provided\n // This allows fetching all recent events when no specific filter is needed\n const sentryQuery = parsed.query || \"\";\n const requestedFields = parsed.fields || [];\n\n // Determine if this is an aggregate query by checking if any field contains a function\n const isAggregateQuery = requestedFields.some(\n (field) => field.includes(\"(\") && field.includes(\")\"),\n );\n\n // For aggregate queries, we should only use the fields provided by the AI\n // For non-aggregate queries, we can use recommended fields as fallback\n let fields: string[];\n\n if (isAggregateQuery) {\n // For aggregate queries, fields must be provided and should only include\n // aggregate functions and groupBy fields\n if (!requestedFields || requestedFields.length === 0) {\n throw new UserInputError(\n `AI response missing required 'fields' for aggregate query. The AI must specify which fields to return. For aggregate queries, include only the aggregate functions (like count(), avg()) and groupBy fields.`,\n );\n }\n fields = requestedFields;\n } else {\n // For non-aggregate queries, use AI-provided fields or fall back to recommended fields\n fields =\n requestedFields && requestedFields.length > 0\n ? requestedFields\n : recommendedFields.basic;\n }\n\n // Use the AI-provided sort parameter\n const sortParam = parsed.sort;\n\n // Validate that the sort field is included in the fields array\n // Extract the field name from the sort parameter (e.g., \"-timestamp\" -> \"timestamp\", \"-count()\" -> \"count()\")\n const sortField = sortParam.startsWith(\"-\")\n ? sortParam.substring(1)\n : sortParam;\n\n // Check if the sort field is included in the fields array\n if (!fields.includes(sortField)) {\n // Always throw an error to help the agent learn the correct pattern\n throw new UserInputError(\n `Sort field \"${sortField}\" (from sort parameter \"${sortParam}\") must be included in the fields array. Sentry requires that any field used for sorting must also be explicitly selected. Current fields: [${fields.join(\", \")}]. Please add \"${sortField}\" to the fields array or choose a different sort field that's already in the fields array.`,\n );\n }\n\n // Extract time range parameters from parsed response\n const timeParams: { statsPeriod?: string; start?: string; end?: string } =\n {};\n if (parsed.timeRange) {\n if (\"statsPeriod\" in parsed.timeRange) {\n timeParams.statsPeriod = parsed.timeRange.statsPeriod;\n } else if (\"start\" in parsed.timeRange && \"end\" in parsed.timeRange) {\n timeParams.start = parsed.timeRange.start;\n timeParams.end = parsed.timeRange.end;\n }\n } else {\n // Default time window if not specified\n timeParams.statsPeriod = \"14d\";\n }\n\n let eventsResponse: unknown;\n try {\n eventsResponse = await withApiErrorHandling(\n () =>\n apiService.searchEvents({\n organizationSlug,\n query: sentryQuery,\n fields,\n limit: params.limit,\n projectSlug: projectId, // API requires numeric project ID, not slug\n dataset: dataset === \"logs\" ? \"ourlogs\" : dataset,\n sort: sortParam,\n ...timeParams, // Spread the time parameters\n }),\n {\n organizationSlug,\n projectSlug: params.projectSlug,\n },\n );\n } catch (error) {\n // Convert API validation errors to UserInputError for agent self-correction\n if (\n error instanceof ApiError &&\n (error.status === 400 || error.status === 422)\n ) {\n // 400 Bad Request and 422 Unprocessable Entity typically indicate input validation issues\n throw new UserInputError(error.message);\n }\n\n // Re-throw other errors (5xx, network errors, etc.) as-is\n throw error;\n }\n\n // Generate the Sentry explorer URL with structured aggregate information\n // Derive aggregate functions and groupBy fields from the fields array\n const aggregateFunctions = fields.filter(\n (field) => field.includes(\"(\") && field.includes(\")\"),\n );\n const groupByFields = fields.filter(\n (field) => !field.includes(\"(\") && !field.includes(\")\"),\n );\n\n const explorerUrl = apiService.getEventsExplorerUrl(\n organizationSlug,\n sentryQuery,\n projectId, // Pass the numeric project ID for URL generation\n dataset, // dataset is already correct for URL generation (logs, spans, errors)\n fields, // Pass fields to detect if it's an aggregate query\n sortParam, // Pass sort parameter for URL generation\n aggregateFunctions,\n groupByFields,\n );\n\n // Type-safe access to event data with proper validation\n function isValidResponse(\n response: unknown,\n ): response is { data?: unknown[] } {\n return typeof response === \"object\" && response !== null;\n }\n\n function isValidEventArray(\n data: unknown,\n ): data is Record<string, unknown>[] {\n return (\n Array.isArray(data) &&\n data.every((item) => typeof item === \"object\" && item !== null)\n );\n }\n\n if (!isValidResponse(eventsResponse)) {\n throw new Error(\"Invalid response format from Sentry API\");\n }\n\n const eventData = eventsResponse.data;\n if (!isValidEventArray(eventData)) {\n throw new Error(\"Invalid event data format from Sentry API\");\n }\n\n // Format results based on dataset\n switch (dataset) {\n case \"errors\":\n return formatErrorResults(\n eventData,\n params,\n apiService,\n organizationSlug,\n explorerUrl,\n sentryQuery,\n fields,\n );\n case \"logs\":\n return formatLogResults(\n eventData,\n params,\n apiService,\n organizationSlug,\n explorerUrl,\n sentryQuery,\n fields,\n );\n case \"spans\":\n return formatSpanResults(\n eventData,\n params,\n apiService,\n organizationSlug,\n explorerUrl,\n sentryQuery,\n fields,\n );\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;AAwBA,sBAAe,8BAAW;CACxB,MAAM;CACN,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkBA;EAClB,sBAAsB,MACnB,QAAQ,CACR,MAAM,CACN,IAAI,EAAE,CACN,S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QAAQ,KAAK,IACnB,KAAK,MAAM,CAAC,gBAAgB,SAAS,YAAY,SAAS,KAAK;EAElE;AAED,OAAK,gBAAgB,eAAe,CAClC,OAAM,IAAI,MAAM;EAGlB,MAAM,YAAY,eAAe;AACjC,OAAK,kBAAkB,UAAU,CAC/B,OAAM,IAAI,MAAM;AAIlB,UAAQ,SAAR;GACE,KAAK,SACH,QAAO,sCACL,WACA,QACA,YACA,kBACA,aACA,aACA,OACD;GACH,KAAK,OACH,QAAO,oCACL,WACA,QACA,YACA,kBACA,aACA,aACA,OACD;GACH,KAAK,QACH,QAAO,qCACL,WACA,QACA,YACA,kBACA,aACA,aACA,OACD;EACJ;CACF;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler-BPPTAi7I.d.ts","names":[],"sources":["../src/tools/search-issues/handler.ts"],"sourcesContent":[],"mappings":";;;;cAAwB;;;EAAA,eAAA,eAAA,YAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler-BZ3hKPb8.d.cts","names":[],"sources":["../src/tools/search-issues/handler.ts"],"sourcesContent":[],"mappings":";;;;cAAwB;;;EAAA,eAAA,eAAA,YAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler-O9fYgC9a.cjs","names":["ParamOrganizationSlug","context: ServerContext","projectId: string | undefined"],"sources":["../src/tools/search-issues/handler.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"../utils/defineTool\";\nimport {\n apiServiceFromContext,\n withApiErrorHandling,\n} from \"../utils/api-utils\";\nimport type { ServerContext } from \"../../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamProjectSlug,\n} from \"../../schema\";\nimport { translateQuery } from \"./agent\";\nimport { formatIssueResults } from \"./formatters\";\nimport { UserInputError } from \"../../errors\";\nimport type { SentryApiService } from \"../../api-client\";\n\nexport default defineTool({\n name: \"search_issues\",\n description: [\n \"Search for grouped issues/problems in Sentry - returns a LIST of issues, NOT counts or aggregations.\",\n \"\",\n \"Uses AI to translate natural language queries into Sentry issue search syntax.\",\n \"Returns grouped issues with metadata like title, status, and user count.\",\n \"\",\n \"🔍 USE THIS TOOL WHEN USERS WANT:\",\n \"- A LIST of issues: 'show me issues', 'what problems do we have'\",\n \"- Filtered issue lists: 'unresolved issues', 'critical bugs'\",\n \"- Issues by impact: 'errors affecting more than 100 users'\",\n \"- Issues by assignment: 'issues assigned to me'\",\n \"\",\n \"❌ DO NOT USE FOR COUNTS/AGGREGATIONS:\",\n \"- 'how many errors' → use search_events\",\n \"- 'count of issues' → use search_events\",\n \"- 'total number of errors today' → use search_events\",\n \"- 'sum/average/statistics' → use search_events\",\n \"\",\n \"❌ ALSO DO NOT USE FOR:\",\n \"- Individual error events with timestamps → use search_events\",\n \"- Details about a specific issue ID → use get_issue_details\",\n \"\",\n \"REMEMBER: This tool returns a LIST of issues, not counts or statistics!\",\n \"\",\n \"<examples>\",\n \"search_issues(organizationSlug='my-org', naturalLanguageQuery='critical bugs from last week')\",\n \"search_issues(organizationSlug='my-org', naturalLanguageQuery='unhandled errors affecting 100+ users')\",\n \"search_issues(organizationSlug='my-org', naturalLanguageQuery='issues assigned to me')\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user passes a parameter in the form of name/otherName, it's likely in the format of <organizationSlug>/<projectSlugOrId>.\",\n \"- Parse org/project notation directly without calling find_organizations or find_projects.\",\n \"- The projectSlugOrId parameter accepts both project slugs (e.g., 'my-project') and numeric IDs (e.g., '123456').\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug,\n naturalLanguageQuery: z\n .string()\n .trim()\n .min(1)\n .describe(\"Natural language description of issues to search for\"),\n projectSlugOrId: z\n .string()\n .optional()\n .describe(\"The project's slug or numeric ID (optional)\"),\n regionUrl: ParamRegionUrl.optional(),\n limit: z\n .number()\n .min(1)\n .max(100)\n .optional()\n .default(10)\n .describe(\"Maximum number of issues to return\"),\n includeExplanation: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Include explanation of how the query was translated\"),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n\n setTag(\"organization.slug\", params.organizationSlug);\n if (params.projectSlugOrId) {\n // Check if it's a numeric ID or a slug and tag appropriately\n if (/^\\d+$/.test(params.projectSlugOrId)) {\n setTag(\"project.id\", params.projectSlugOrId);\n } else {\n setTag(\"project.slug\", params.projectSlugOrId);\n }\n }\n\n // Convert project slug to ID if needed - required for the agent's field discovery\n let projectId: string | undefined;\n if (params.projectSlugOrId) {\n // Check if it's already a numeric ID\n if (/^\\d+$/.test(params.projectSlugOrId)) {\n projectId = params.projectSlugOrId;\n } else {\n // It's a slug, convert to ID\n const project = await withApiErrorHandling(\n () =>\n apiService.getProject({\n organizationSlug: params.organizationSlug,\n projectSlugOrId: params.projectSlugOrId!,\n }),\n {\n organizationSlug: params.organizationSlug,\n projectSlugOrId: params.projectSlugOrId,\n },\n );\n projectId = String(project.id);\n }\n }\n\n // Translate natural language to Sentry query\n const translatedQuery = await translateQuery(\n {\n naturalLanguageQuery: params.naturalLanguageQuery,\n organizationSlug: params.organizationSlug,\n projectSlugOrId: params.projectSlugOrId,\n projectId,\n },\n apiService,\n );\n\n // Execute the search - listIssues accepts projectSlug directly\n const issues = await withApiErrorHandling(\n () =>\n apiService.listIssues({\n organizationSlug: params.organizationSlug,\n projectSlug: params.projectSlugOrId,\n query: translatedQuery.query,\n sortBy: translatedQuery.sort || \"date\",\n limit: params.limit,\n }),\n {\n organizationSlug: params.organizationSlug,\n projectSlug: params.projectSlugOrId,\n query: translatedQuery.query,\n },\n );\n\n // Build output with explanation first (if requested), then results\n let output = \"\";\n\n // Add explanation section before results (like search_events)\n if (params.includeExplanation) {\n // Start with title including natural language query\n output += `# Search Results for \"${params.naturalLanguageQuery}\"\\n\\n`;\n output += `⚠️ **IMPORTANT**: Display these issues as highlighted cards with status indicators, assignee info, and clickable Issue IDs.\\n\\n`;\n\n output += `## Query Translation\\n`;\n output += `Natural language: \"${params.naturalLanguageQuery}\"\\n`;\n output += `Sentry query: \\`${translatedQuery.query}\\``;\n if (translatedQuery.sort) {\n output += `\\nSort: ${translatedQuery.sort}`;\n }\n if (translatedQuery.explanation) {\n output += `\\n\\n${translatedQuery.explanation}`;\n }\n output += `\\n\\n`;\n\n // Format results without the header since we already added it\n output += formatIssueResults(\n issues,\n params.organizationSlug,\n params.projectSlugOrId,\n translatedQuery.query,\n params.regionUrl,\n params.naturalLanguageQuery,\n true, // skipHeader = true\n );\n } else {\n // Format results with natural language query for title\n output = formatIssueResults(\n issues,\n params.organizationSlug,\n params.projectSlugOrId,\n translatedQuery.query,\n params.regionUrl,\n params.naturalLanguageQuery,\n false, // skipHeader = false (default)\n );\n }\n\n return output;\n },\n});\n"],"mappings":";;;;;;;;;;AAkBA,sBAAe,8BAAW;CACxB,MAAM;CACN,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkBA;EAClB,sBAAsB,MACnB,QAAQ,CACR,MAAM,CACN,IAAI,EAAE,CACN,SAAS,uDAAuD;EACnE,iBAAiB,MACd,QAAQ,CACR,UAAU,CACV,SAAS,8CAA8C;EAC1D,WAAW,8BAAe,UAAU;EACpC,OAAO,MACJ,QAAQ,CACR,IAAI,EAAE,CACN,IAAI,IAAI,CACR,UAAU,CACV,QAAQ,GAAG,CACX,SAAS,qCAAqC;EACjD,oBAAoB,MACjB,SAAS,CACT,UAAU,CACV,QAAQ,MAAM,CACd,SAAS,sDAAsD;CACnE;CACD,MAAM,QAAQ,QAAQ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AO,WACP,OAAO,sBACP,KACD;EACF,MAEC,UAAS,sCACP,QACA,OAAO,kBACP,OAAO,iBACP,gBAAgB,OAChB,OAAO,WACP,OAAO,sBACP,MACD;AAGH,SAAO;CACR;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler-aE_8mEm7.js","names":["context: ServerContext","projectId: string | undefined","fields: string[]","timeParams: { statsPeriod?: string; start?: string; end?: string }","eventsResponse: unknown","response: unknown","data: unknown"],"sources":["../src/tools/search-events/handler.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"../utils/defineTool\";\nimport {\n apiServiceFromContext,\n withApiErrorHandling,\n} from \"../utils/api-utils\";\nimport type { ServerContext } from \"../../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamProjectSlug,\n} from \"../../schema\";\nimport { translateQuery } from \"./agent\";\nimport {\n formatErrorResults,\n formatLogResults,\n formatSpanResults,\n} from \"./formatters\";\nimport { RECOMMENDED_FIELDS } from \"./config\";\nimport { UserInputError } from \"../../errors\";\nimport type { SentryApiService } from \"../../api-client\";\nimport { ApiError } from \"../../api-client\";\n\nexport default defineTool({\n name: \"search_events\",\n description: [\n \"Search for events AND perform counts/aggregations - the ONLY tool for statistics and counts.\",\n \"\",\n \"Supports TWO query types:\",\n \"1. AGGREGATIONS (counts, sums, averages): 'how many errors', 'count of issues', 'total tokens'\",\n \"2. Individual events with timestamps: 'show me error logs from last hour'\",\n \"\",\n \"🔢 USE THIS FOR ALL COUNTS/STATISTICS:\",\n \"- 'how many errors today' → returns count\",\n \"- 'count of database failures' → returns count\",\n \"- 'total number of issues' → returns count\",\n \"- 'average response time' → returns avg()\",\n \"- 'sum of tokens used' → returns sum()\",\n \"\",\n \"📋 ALSO USE FOR INDIVIDUAL EVENTS:\",\n \"- 'error logs from last hour' → returns event list\",\n \"- 'database errors with timestamps' → returns event list\",\n \"- 'trace spans for slow API calls' → returns span list\",\n \"\",\n \"Dataset Selection (AI automatically chooses):\",\n \"- errors: Exception/crash events\",\n \"- logs: Log entries\",\n \"- spans: Performance data, AI/LLM calls, token usage\",\n \"\",\n \"❌ DO NOT USE for grouped issue lists → use search_issues\",\n \"\",\n \"<examples>\",\n \"search_events(organizationSlug='my-org', naturalLanguageQuery='how many errors today')\",\n \"search_events(organizationSlug='my-org', naturalLanguageQuery='count of database failures this week')\",\n \"search_events(organizationSlug='my-org', naturalLanguageQuery='total tokens used by model')\",\n \"search_events(organizationSlug='my-org', naturalLanguageQuery='error logs from the last hour')\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user passes a parameter in the form of name/otherName, it's likely in the format of <organizationSlug>/<projectSlug>.\",\n \"- Parse org/project notation directly without calling find_organizations or find_projects.\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug,\n naturalLanguageQuery: z\n .string()\n .trim()\n .min(1)\n .describe(\"Natural language description of what you want to search for\"),\n projectSlug: ParamProjectSlug.optional(),\n regionUrl: ParamRegionUrl.optional(),\n limit: z\n .number()\n .min(1)\n .max(100)\n .optional()\n .default(10)\n .describe(\"Maximum number of results to return\"),\n includeExplanation: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Include explanation of how the query was translated\"),\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 // The agent will determine the dataset based on the query content\n\n // Convert project slug to ID if needed - we need this for attribute fetching\n let projectId: string | undefined;\n if (params.projectSlug) {\n const project = await withApiErrorHandling(\n () =>\n apiService.getProject({\n organizationSlug,\n projectSlugOrId: params.projectSlug!,\n }),\n {\n organizationSlug,\n projectSlugOrId: params.projectSlug,\n },\n );\n projectId = String(project.id);\n }\n\n // Translate the natural language query using Search Events Agent\n // The agent will determine the dataset and fetch the appropriate attributes\n const parsed = await translateQuery(\n {\n naturalLanguageQuery: params.naturalLanguageQuery,\n organizationSlug,\n projectId,\n },\n apiService,\n organizationSlug,\n projectId,\n );\n\n // Handle Search Events Agent errors first\n if (parsed.error) {\n throw new UserInputError(\n `Search Events Agent could not translate query \"${params.naturalLanguageQuery}\". Error: ${parsed.error}`,\n );\n }\n\n // Get the dataset chosen by the agent (should be defined when no error)\n const dataset = parsed.dataset!;\n\n // Get recommended fields for this dataset (for fallback when no fields are provided)\n const recommendedFields = RECOMMENDED_FIELDS[dataset];\n\n // Validate that sort parameter was provided\n if (!parsed.sort) {\n throw new UserInputError(\n `Search Events Agent response missing required 'sort' parameter. Received: ${JSON.stringify(parsed, null, 2)}. The agent must specify how to sort results (e.g., '-timestamp' for newest first, '-count()' for highest count).`,\n );\n }\n\n // Use empty string as default if no query is provided\n // This allows fetching all recent events when no specific filter is needed\n const sentryQuery = parsed.query || \"\";\n const requestedFields = parsed.fields || [];\n\n // Determine if this is an aggregate query by checking if any field contains a function\n const isAggregateQuery = requestedFields.some(\n (field) => field.includes(\"(\") && field.includes(\")\"),\n );\n\n // For aggregate queries, we should only use the fields provided by the AI\n // For non-aggregate queries, we can use recommended fields as fallback\n let fields: string[];\n\n if (isAggregateQuery) {\n // For aggregate queries, fields must be provided and should only include\n // aggregate functions and groupBy fields\n if (!requestedFields || requestedFields.length === 0) {\n throw new UserInputError(\n `AI response missing required 'fields' for aggregate query. The AI must specify which fields to return. For aggregate queries, include only the aggregate functions (like count(), avg()) and groupBy fields.`,\n );\n }\n fields = requestedFields;\n } else {\n // For non-aggregate queries, use AI-provided fields or fall back to recommended fields\n fields =\n requestedFields && requestedFields.length > 0\n ? requestedFields\n : recommendedFields.basic;\n }\n\n // Use the AI-provided sort parameter\n const sortParam = parsed.sort;\n\n // Validate that the sort field is included in the fields array\n // Extract the field name from the sort parameter (e.g., \"-timestamp\" -> \"timestamp\", \"-count()\" -> \"count()\")\n const sortField = sortParam.startsWith(\"-\")\n ? sortParam.substring(1)\n : sortParam;\n\n // Check if the sort field is included in the fields array\n if (!fields.includes(sortField)) {\n // Always throw an error to help the agent learn the correct pattern\n throw new UserInputError(\n `Sort field \"${sortField}\" (from sort parameter \"${sortParam}\") must be included in the fields array. Sentry requires that any field used for sorting must also be explicitly selected. Current fields: [${fields.join(\", \")}]. Please add \"${sortField}\" to the fields array or choose a different sort field that's already in the fields array.`,\n );\n }\n\n // Extract time range parameters from parsed response\n const timeParams: { statsPeriod?: string; start?: string; end?: string } =\n {};\n if (parsed.timeRange) {\n if (\"statsPeriod\" in parsed.timeRange) {\n timeParams.statsPeriod = parsed.timeRange.statsPeriod;\n } else if (\"start\" in parsed.timeRange && \"end\" in parsed.timeRange) {\n timeParams.start = parsed.timeRange.start;\n timeParams.end = parsed.timeRange.end;\n }\n } else {\n // Default time window if not specified\n timeParams.statsPeriod = \"14d\";\n }\n\n let eventsResponse: unknown;\n try {\n eventsResponse = await withApiErrorHandling(\n () =>\n apiService.searchEvents({\n organizationSlug,\n query: sentryQuery,\n fields,\n limit: params.limit,\n projectSlug: projectId, // API requires numeric project ID, not slug\n dataset: dataset === \"logs\" ? \"ourlogs\" : dataset,\n sort: sortParam,\n ...timeParams, // Spread the time parameters\n }),\n {\n organizationSlug,\n projectSlug: params.projectSlug,\n },\n );\n } catch (error) {\n // Convert API validation errors to UserInputError for agent self-correction\n if (\n error instanceof ApiError &&\n (error.status === 400 || error.status === 422)\n ) {\n // 400 Bad Request and 422 Unprocessable Entity typically indicate input validation issues\n throw new UserInputError(error.message);\n }\n\n // Re-throw other errors (5xx, network errors, etc.) as-is\n throw error;\n }\n\n // Generate the Sentry explorer URL with structured aggregate information\n // Derive aggregate functions and groupBy fields from the fields array\n const aggregateFunctions = fields.filter(\n (field) => field.includes(\"(\") && field.includes(\")\"),\n );\n const groupByFields = fields.filter(\n (field) => !field.includes(\"(\") && !field.includes(\")\"),\n );\n\n const explorerUrl = apiService.getEventsExplorerUrl(\n organizationSlug,\n sentryQuery,\n projectId, // Pass the numeric project ID for URL generation\n dataset, // dataset is already correct for URL generation (logs, spans, errors)\n fields, // Pass fields to detect if it's an aggregate query\n sortParam, // Pass sort parameter for URL generation\n aggregateFunctions,\n groupByFields,\n );\n\n // Type-safe access to event data with proper validation\n function isValidResponse(\n response: unknown,\n ): response is { data?: unknown[] } {\n return typeof response === \"object\" && response !== null;\n }\n\n function isValidEventArray(\n data: unknown,\n ): data is Record<string, unknown>[] {\n return (\n Array.isArray(data) &&\n data.every((item) => typeof item === \"object\" && item !== null)\n );\n }\n\n if (!isValidResponse(eventsResponse)) {\n throw new Error(\"Invalid response format from Sentry API\");\n }\n\n const eventData = eventsResponse.data;\n if (!isValidEventArray(eventData)) {\n throw new Error(\"Invalid event data format from Sentry API\");\n }\n\n // Format results based on dataset\n switch (dataset) {\n case \"errors\":\n return formatErrorResults(\n eventData,\n params,\n apiService,\n organizationSlug,\n explorerUrl,\n sentryQuery,\n fields,\n );\n case \"logs\":\n return formatLogResults(\n eventData,\n params,\n apiService,\n organizationSlug,\n explorerUrl,\n sentryQuery,\n fields,\n );\n case \"spans\":\n return formatSpanResults(\n eventData,\n params,\n apiService,\n organizationSlug,\n explorerUrl,\n sentryQuery,\n fields,\n );\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;AAwBA,sBAAe,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkB;EAClB,sBAAsB,EACnB,QAAQ,CACR,MAAM,CACN,IAAI,EAAE,CACN,SAAS,8DAA8D;EAC1E,aAAa,iBAAiB,UAAU;EACxC,WAAW,eAAe,UAAU;EACpC,OAAO,EACJ,QAAQ,CAC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OAAM,IAAI,MAAM;EAGlB,MAAM,YAAY,eAAe;AACjC,OAAK,kBAAkB,UAAU,CAC/B,OAAM,IAAI,MAAM;AAIlB,UAAQ,SAAR;GACE,KAAK,SACH,QAAO,mBACL,WACA,QACA,YACA,kBACA,aACA,aACA,OACD;GACH,KAAK,OACH,QAAO,iBACL,WACA,QACA,YACA,kBACA,aACA,aACA,OACD;GACH,KAAK,QACH,QAAO,kBACL,WACA,QACA,YACA,kBACA,aACA,aACA,OACD;EACJ;CACF;AACF,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler-cUB6XcUV.d.ts","names":[],"sources":["../src/tools/search-events/handler.ts"],"sourcesContent":[],"mappings":";;;;cAAwB;;;EAAA,WAAA,eAAA,YAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler-ykkULTZ-.js","names":["context: ServerContext","projectId: string | undefined"],"sources":["../src/tools/search-issues/handler.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { setTag } from \"@sentry/core\";\nimport { defineTool } from \"../utils/defineTool\";\nimport {\n apiServiceFromContext,\n withApiErrorHandling,\n} from \"../utils/api-utils\";\nimport type { ServerContext } from \"../../types\";\nimport {\n ParamOrganizationSlug,\n ParamRegionUrl,\n ParamProjectSlug,\n} from \"../../schema\";\nimport { translateQuery } from \"./agent\";\nimport { formatIssueResults } from \"./formatters\";\nimport { UserInputError } from \"../../errors\";\nimport type { SentryApiService } from \"../../api-client\";\n\nexport default defineTool({\n name: \"search_issues\",\n description: [\n \"Search for grouped issues/problems in Sentry - returns a LIST of issues, NOT counts or aggregations.\",\n \"\",\n \"Uses AI to translate natural language queries into Sentry issue search syntax.\",\n \"Returns grouped issues with metadata like title, status, and user count.\",\n \"\",\n \"🔍 USE THIS TOOL WHEN USERS WANT:\",\n \"- A LIST of issues: 'show me issues', 'what problems do we have'\",\n \"- Filtered issue lists: 'unresolved issues', 'critical bugs'\",\n \"- Issues by impact: 'errors affecting more than 100 users'\",\n \"- Issues by assignment: 'issues assigned to me'\",\n \"\",\n \"❌ DO NOT USE FOR COUNTS/AGGREGATIONS:\",\n \"- 'how many errors' → use search_events\",\n \"- 'count of issues' → use search_events\",\n \"- 'total number of errors today' → use search_events\",\n \"- 'sum/average/statistics' → use search_events\",\n \"\",\n \"❌ ALSO DO NOT USE FOR:\",\n \"- Individual error events with timestamps → use search_events\",\n \"- Details about a specific issue ID → use get_issue_details\",\n \"\",\n \"REMEMBER: This tool returns a LIST of issues, not counts or statistics!\",\n \"\",\n \"<examples>\",\n \"search_issues(organizationSlug='my-org', naturalLanguageQuery='critical bugs from last week')\",\n \"search_issues(organizationSlug='my-org', naturalLanguageQuery='unhandled errors affecting 100+ users')\",\n \"search_issues(organizationSlug='my-org', naturalLanguageQuery='issues assigned to me')\",\n \"</examples>\",\n \"\",\n \"<hints>\",\n \"- If the user passes a parameter in the form of name/otherName, it's likely in the format of <organizationSlug>/<projectSlugOrId>.\",\n \"- Parse org/project notation directly without calling find_organizations or find_projects.\",\n \"- The projectSlugOrId parameter accepts both project slugs (e.g., 'my-project') and numeric IDs (e.g., '123456').\",\n \"</hints>\",\n ].join(\"\\n\"),\n inputSchema: {\n organizationSlug: ParamOrganizationSlug,\n naturalLanguageQuery: z\n .string()\n .trim()\n .min(1)\n .describe(\"Natural language description of issues to search for\"),\n projectSlugOrId: z\n .string()\n .optional()\n .describe(\"The project's slug or numeric ID (optional)\"),\n regionUrl: ParamRegionUrl.optional(),\n limit: z\n .number()\n .min(1)\n .max(100)\n .optional()\n .default(10)\n .describe(\"Maximum number of issues to return\"),\n includeExplanation: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Include explanation of how the query was translated\"),\n },\n async handler(params, context: ServerContext) {\n const apiService = apiServiceFromContext(context, {\n regionUrl: params.regionUrl,\n });\n\n setTag(\"organization.slug\", params.organizationSlug);\n if (params.projectSlugOrId) {\n // Check if it's a numeric ID or a slug and tag appropriately\n if (/^\\d+$/.test(params.projectSlugOrId)) {\n setTag(\"project.id\", params.projectSlugOrId);\n } else {\n setTag(\"project.slug\", params.projectSlugOrId);\n }\n }\n\n // Convert project slug to ID if needed - required for the agent's field discovery\n let projectId: string | undefined;\n if (params.projectSlugOrId) {\n // Check if it's already a numeric ID\n if (/^\\d+$/.test(params.projectSlugOrId)) {\n projectId = params.projectSlugOrId;\n } else {\n // It's a slug, convert to ID\n const project = await withApiErrorHandling(\n () =>\n apiService.getProject({\n organizationSlug: params.organizationSlug,\n projectSlugOrId: params.projectSlugOrId!,\n }),\n {\n organizationSlug: params.organizationSlug,\n projectSlugOrId: params.projectSlugOrId,\n },\n );\n projectId = String(project.id);\n }\n }\n\n // Translate natural language to Sentry query\n const translatedQuery = await translateQuery(\n {\n naturalLanguageQuery: params.naturalLanguageQuery,\n organizationSlug: params.organizationSlug,\n projectSlugOrId: params.projectSlugOrId,\n projectId,\n },\n apiService,\n );\n\n // Execute the search - listIssues accepts projectSlug directly\n const issues = await withApiErrorHandling(\n () =>\n apiService.listIssues({\n organizationSlug: params.organizationSlug,\n projectSlug: params.projectSlugOrId,\n query: translatedQuery.query,\n sortBy: translatedQuery.sort || \"date\",\n limit: params.limit,\n }),\n {\n organizationSlug: params.organizationSlug,\n projectSlug: params.projectSlugOrId,\n query: translatedQuery.query,\n },\n );\n\n // Build output with explanation first (if requested), then results\n let output = \"\";\n\n // Add explanation section before results (like search_events)\n if (params.includeExplanation) {\n // Start with title including natural language query\n output += `# Search Results for \"${params.naturalLanguageQuery}\"\\n\\n`;\n output += `⚠️ **IMPORTANT**: Display these issues as highlighted cards with status indicators, assignee info, and clickable Issue IDs.\\n\\n`;\n\n output += `## Query Translation\\n`;\n output += `Natural language: \"${params.naturalLanguageQuery}\"\\n`;\n output += `Sentry query: \\`${translatedQuery.query}\\``;\n if (translatedQuery.sort) {\n output += `\\nSort: ${translatedQuery.sort}`;\n }\n if (translatedQuery.explanation) {\n output += `\\n\\n${translatedQuery.explanation}`;\n }\n output += `\\n\\n`;\n\n // Format results without the header since we already added it\n output += formatIssueResults(\n issues,\n params.organizationSlug,\n params.projectSlugOrId,\n translatedQuery.query,\n params.regionUrl,\n params.naturalLanguageQuery,\n true, // skipHeader = true\n );\n } else {\n // Format results with natural language query for title\n output = formatIssueResults(\n issues,\n params.organizationSlug,\n params.projectSlugOrId,\n translatedQuery.query,\n params.regionUrl,\n params.naturalLanguageQuery,\n false, // skipHeader = false (default)\n );\n }\n\n return output;\n },\n});\n"],"mappings":";;;;;;;;;AAkBA,sBAAe,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;CACD,EAAC,KAAK,KAAK;CACZ,aAAa;EACX,kBAAkB;EAClB,sBAAsB,EACnB,QAAQ,CACR,MAAM,CACN,IAAI,EAAE,CACN,SAAS,uDAAuD;EACnE,iBAAiB,EACd,QAAQ,CACR,UAAU,CACV,SAAS,8CAA8C;EAC1D,WAAW,eAAe,UAAU;EACpC,OAAO,EACJ,QAAQ,CACR,IAAI,EAAE,CACN,IAAI,IAAI,CACR,UAAU,CACV,QAAQ,GAAG,CACX,SAAS,qCAAqC;EACjD,oBAAoB,EACjB,SAAS,CACT,UAAU,CACV,QAAQ,MAAM,CACd,SAAS,sDAAsD;CACnE;CACD,MAAM,QAAQ,QAAQA,SAAwB;EAC5C,MAAM,aAAa,sBAAsB,SAAS,EAChD,WAAW,OAAO,UACnB,EAAC;AAEF,SAAO,qBAAqB,OAAO,iBAAiB;AACpD,MAAI,OAAO,gBAET,KAAI,QAAQ,KAAK,OAAO,gBAAgB,CACtC,QAAO,cAAc,OAAO,gBAAgB;MAE5C,QAAO,gBAAgB,OAAO,gBAAgB;EAKlD,IAAIC;AACJ,MAAI,OAAO,gBAET,KAAI,QAAQ,KAAK,OAAO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