You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Fetches the most recent errors from Spotlight debugger. Returns error details, stack traces, and request details for immediate debugging context.",
22
+
async()=>{
23
+
constenvelopes=errorsBuffer.read();
24
+
errorsBuffer.clear();
25
+
26
+
if(envelopes.length===0){
27
+
return{
28
+
content: [
29
+
{
30
+
type: "text",
31
+
text: "No recent errors found in Spotlight. This might be because the application started successfully, but runtime issues only appear when you interact with specific pages or features.\n\nAsk the user to navigate to the page where they're experiencing the issue to reproduce it, that way we can get that in the Spotlight debugger. So if you want to check for errors again, just ask me to do that.",
32
+
},
33
+
],
34
+
};
35
+
}
36
+
37
+
consterrors=envelopes
38
+
.map(([contentType,data])=>processEnvelope({ contentType, data }))
39
+
.sort((a,b)=>{
40
+
consta_sent_at=a.envelope[0].sent_atasstring;
41
+
constb_sent_at=b.envelope[0].sent_atasstring;
42
+
if(a_sent_at<b_sent_at)return1;
43
+
if(a_sent_at>b_sent_at)return-1;
44
+
return0;
45
+
});
46
+
47
+
constcontent: TextContent[]=[];
48
+
for(consterroroferrors){
49
+
const{
50
+
envelope: [,[[{ type },payload]]],
51
+
}=error;
52
+
53
+
if(type==="event"&&isErrorEvent(payload)){
54
+
content.push({
55
+
type: "text",
56
+
text: JSON.stringify({
57
+
exception: payload.exception,
58
+
level: payload.level,
59
+
request: payload.request,
60
+
}),
61
+
});
62
+
}
63
+
}
64
+
65
+
return{
66
+
content,
67
+
};
68
+
},
69
+
);
70
+
71
+
// TODO: Add tool for performance tracing
72
+
// TODO: Add tool for profiling data
73
+
74
+
returnmcp;
75
+
}
76
+
77
+
functionisErrorEvent(payload: unknown): payload is ErrorEvent{
0 commit comments