@@ -2137,14 +2137,6 @@ describe("get_issue_details", () => {
21372137describe ( "structuredContent" , ( ) => {
21382138 const experimentalContext = { ...baseContext , experimentalMode : true } ;
21392139
2140- const params = {
2141- organizationSlug : "sentry-mcp-evals" ,
2142- issueId : "CLOUDFLARE-MCP-41" ,
2143- eventId : undefined ,
2144- issueUrl : undefined ,
2145- regionUrl : null ,
2146- } ;
2147-
21482140 function mockLatestEvent ( overrides : Record < string , unknown > = { } ) {
21492141 mswServer . use (
21502142 http . get (
@@ -2154,6 +2146,14 @@ describe("structuredContent", () => {
21542146 ) ;
21552147 }
21562148
2149+ const params = {
2150+ organizationSlug : "sentry-mcp-evals" ,
2151+ issueId : "CLOUDFLARE-MCP-41" ,
2152+ eventId : undefined ,
2153+ issueUrl : undefined ,
2154+ regionUrl : null ,
2155+ } ;
2156+
21572157 it ( "returns a structured payload in experimental mode" , async ( ) => {
21582158 mockLatestEvent ( ) ;
21592159
@@ -2170,6 +2170,17 @@ describe("structuredContent", () => {
21702170 expect ( typeof payload . issue . usersImpacted ) . toBe ( "number" ) ;
21712171 } ) ;
21722172
2173+ it ( "produces a payload that satisfies the schema" , async ( ) => {
2174+ mockLatestEvent ( ) ;
2175+
2176+ const result = await getIssueDetails . handler ( params , experimentalContext ) ;
2177+ const payload = ( result as { structuredContent : unknown } )
2178+ . structuredContent ;
2179+
2180+ // a tool that advertises a schema has to return something that satisfies it
2181+ expect ( ( ) => getIssueDetailsOutputSchema . parse ( payload ) ) . not . toThrow ( ) ;
2182+ } ) ;
2183+
21732184 it ( "returns markdown outside experimental mode" , async ( ) => {
21742185 mockLatestEvent ( ) ;
21752186
@@ -2192,30 +2203,6 @@ describe("structuredContent", () => {
21922203 expect ( payload . event . body ) . toContain ( "### Tags" ) ;
21932204 } ) ;
21942205
2195- it ( "produces a payload that satisfies the schema" , async ( ) => {
2196- mockLatestEvent ( ) ;
2197-
2198- const result = await getIssueDetails . handler ( params , experimentalContext ) ;
2199- const payload = ( result as { structuredContent : Record < string , any > } )
2200- . structuredContent ;
2201-
2202- // a tool that advertises a schema has to return something that satisfies it
2203- expect ( ( ) => getIssueDetailsOutputSchema . parse ( payload ) ) . not . toThrow ( ) ;
2204- } ) ;
2205-
2206- it ( "carries the response notes, which say which tool to call next" , async ( ) => {
2207- mockLatestEvent ( ) ;
2208-
2209- const result = await getIssueDetails . handler ( params , experimentalContext ) ;
2210- const payload = ( result as { structuredContent : Record < string , any > } )
2211- . structuredContent ;
2212-
2213- expect ( payload . responseNotes . length ) . toBeGreaterThan ( 0 ) ;
2214- const notes = payload . responseNotes . join ( "\n" ) ;
2215- expect ( notes ) . toContain ( "Fixes CLOUDFLARE-MCP-41" ) ;
2216- expect ( notes ) . toContain ( "search_issue_events" ) ;
2217- } ) ;
2218-
22192206 it ( "carries the top level message, which the body does not render" , async ( ) => {
22202207 mockLatestEvent ( { message : "TOP-LEVEL-MESSAGE" , entries : [ ] } ) ;
22212208
@@ -2272,14 +2259,21 @@ describe("structuredContent", () => {
22722259
22732260 it ( "keeps the attached replay, which lives on the event not the related list" , async ( ) => {
22742261 // an issue whose only replay is attached would otherwise report no replays at all
2275- mockLatestEvent ( {
2276- contexts : {
2277- replay : {
2278- type : "default" ,
2279- replay_id : "1234567890abcdef1234567890abcdef" ,
2280- } ,
2281- } ,
2282- } ) ;
2262+ mswServer . use (
2263+ http . get (
2264+ "https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/6507376925/events/latest/" ,
2265+ ( ) =>
2266+ HttpResponse . json ( {
2267+ ...createDefaultEvent ( ) ,
2268+ contexts : {
2269+ replay : {
2270+ type : "default" ,
2271+ replay_id : "1234567890abcdef1234567890abcdef" ,
2272+ } ,
2273+ } ,
2274+ } ) ,
2275+ ) ,
2276+ ) ;
22832277
22842278 const result = await getIssueDetails . handler ( params , experimentalContext ) ;
22852279 const payload = ( result as { structuredContent : Record < string , any > } )
@@ -2308,8 +2302,14 @@ describe("structuredContent", () => {
23082302 it ( "maps external issues field by field so upstream extras cannot leak" , async ( ) => {
23092303 // structuredContent is a product contract, not a view of the api response: several
23102304 // upstream schemas are passthrough, so anything not mapped must not appear
2311- mockLatestEvent ( ) ;
23122305 mswServer . use (
2306+ http . get (
2307+ "https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/6507376925/events/latest/" ,
2308+ ( ) =>
2309+ HttpResponse . json ( {
2310+ ...createDefaultEvent ( ) ,
2311+ } ) ,
2312+ ) ,
23132313 http . get (
23142314 "https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/6507376925/external-issues/" ,
23152315 ( ) =>
@@ -2337,7 +2337,16 @@ describe("structuredContent", () => {
23372337 it ( "carries every field the markdown output surfaces" , async ( ) => {
23382338 // greg's bar for this migration is "roughly the same content": anything the markdown
23392339 // renders and the payload drops is a regression for every MCP user
2340- mockLatestEvent ( { dateCreated : "2026-09-03T12:00:00.000Z" } ) ;
2340+ mswServer . use (
2341+ http . get (
2342+ "https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/6507376925/events/latest/" ,
2343+ ( ) =>
2344+ HttpResponse . json ( {
2345+ ...createDefaultEvent ( ) ,
2346+ dateCreated : "2026-09-03T12:00:00.000Z" ,
2347+ } ) ,
2348+ ) ,
2349+ ) ;
23412350
23422351 const result = await getIssueDetails . handler ( params , experimentalContext ) ;
23432352 const payload = ( result as { structuredContent : Record < string , any > } )
@@ -2388,7 +2397,10 @@ describe("structuredContent", () => {
23882397 ) ,
23892398 http . get (
23902399 "https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/7890123456/events/latest/" ,
2391- ( ) => HttpResponse . json ( createDefaultEvent ( ) ) ,
2400+ ( ) =>
2401+ HttpResponse . json ( {
2402+ ...createDefaultEvent ( ) ,
2403+ } ) ,
23922404 ) ,
23932405 ) ;
23942406
@@ -2422,7 +2434,10 @@ describe("structuredContent", () => {
24222434 ) ,
24232435 http . get (
24242436 "https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/7890123456/events/latest/" ,
2425- ( ) => HttpResponse . json ( createDefaultEvent ( ) ) ,
2437+ ( ) =>
2438+ HttpResponse . json ( {
2439+ ...createDefaultEvent ( ) ,
2440+ } ) ,
24262441 ) ,
24272442 ) ;
24282443
@@ -2440,8 +2455,14 @@ describe("structuredContent", () => {
24402455 const many = Array . from ( { length : 51 } , ( _ , i ) =>
24412456 i . toString ( 16 ) . padStart ( 32 , "0" ) ,
24422457 ) ;
2443- mockLatestEvent ( ) ;
24442458 mswServer . use (
2459+ http . get (
2460+ "https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/6507376925/events/latest/" ,
2461+ ( ) =>
2462+ HttpResponse . json ( {
2463+ ...createDefaultEvent ( ) ,
2464+ } ) ,
2465+ ) ,
24452466 // related ids come from replay-count, keyed by numeric issue id. Echo back whichever
24462467 // id was asked for: a preceding test can leave a different issue fixture registered.
24472468 http . get (
0 commit comments