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
For external APIs, use the CORS proxy provided by the host app:
109
+
Only fetch live external data when the user clearly asks for current, remote, or API-backed data.
110
+
111
+
Never invent API endpoints from memory, and never copy a sibling widget's API URL without re-verifying that it is still valid.
112
+
113
+
If the \`web_search\` tool is available, use it to verify the current official API docs before writing network code.
114
+
115
+
If you cannot verify a stable public endpoint, or the API requires auth, rate-limits aggressively, or looks unofficial, ask the user for the API URL/key or build the widget with mock/sample data instead of guessing.
116
+
117
+
Shared production hosts are often rate-limited by public/demo endpoints, so avoid undocumented or flaky sources unless the user explicitly asked for that exact source and you verified it.
118
+
119
+
When you do need a verified external API, use the CORS proxy provided by the host app:
110
120
\`\`\`tsx
111
121
const res = await fetch("/api/proxy?url=" + encodeURIComponent("https://api.example.com/data"));
112
122
const data = await res.json();
@@ -133,7 +143,7 @@ Use \`useEffect\` with \`setInterval\` for polling. Always handle loading and er
133
143
134
144
## Dashboard Awareness
135
145
136
-
You are building one widget within a larger dashboard. Use \`listDashboardWidgets\` to see what other widgets exist — their titles, descriptions, and whether they have code. Use \`readWidgetCode\` to inspect a sibling widget's source code when you need to match API patterns, data formats, or styling conventions.
146
+
You are building one widget within a larger dashboard. Use \`listDashboardWidgets\` to see what other widgets exist — their titles, descriptions, and whether they have code. Use \`readWidgetCode\` to inspect a sibling widget's source code when you need to match layout, styling, or data shapes, but treat any sibling network code as potentially stale until you verify it.
137
147
138
148
Design your widget to complement the others. Don't duplicate what they already show.
139
149
@@ -247,7 +257,7 @@ export async function POST(request: Request) {
247
257
248
258
constreadWidgetCodeTool=tool({
249
259
description:
250
-
"Read the source code of another widget on the dashboard. Use this to match API patterns, data formats, or styling conventions used by sibling widgets.",
260
+
"Read the source code of another widget on the dashboard. Use this to match styling or data shapes, but do not blindly reuse sibling API endpoints without re-verifying them.",
251
261
inputSchema: z.object({
252
262
targetWidgetId: z.string().describe("The ID of the sibling widget to read"),
0 commit comments