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
Copy file name to clipboardExpand all lines: compiler/packages/react-mcp-server/src/index.ts
+26-7Lines changed: 26 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ const server = new McpServer({
29
29
30
30
server.tool(
31
31
'query-react-dev-docs',
32
-
'Search/look up official docs from react.dev',
32
+
'This tool lets you search for official docs from react.dev. This always has the most up to date information on React. You can look for documentation on APIs such as <ViewTransition>, <Activity>, and hooks like useOptimistic, useSyncExternalStore, useTransition, and more. Whenever you think hard about React, please use this tool to get more information before proceeding.',
33
33
{
34
34
query: z.string(),
35
35
},
@@ -72,7 +72,7 @@ server.tool(
72
72
73
73
server.tool(
74
74
'compile',
75
-
'Compile code with React Compiler. Optionally, for debugging provide a pass name like "HIR" to see more information.',
75
+
'Compile code with React Compiler. This tool will return the compiled output, which is automatically memoized React components and hooks, written in JavaScript or TypeScript. You can run this tool whenever you want to check if some React code will compile successfully. You can also run this tool every time you make a suggestion to code, to see how it affects the compiled output. If the compiler returns a diagnostic message, you should read the diagnostic message and try to fix the code and run the compiler again to verify.',
Classify each metric with the thresholds above. Identify the worst category in the order poor > needs-improvement > good.
376
+
</evaluation>
377
+
378
+
<iterate>
379
+
(repeat until every metric is good or two consecutive cycles show no gain)
380
+
- Apply one focused change based on the failing metric plus React-specific guidance:
381
+
- LCP: lazy-load off-screen images, inline critical CSS, preconnect, use React.lazy + Suspense for below-the-fold modules. if the user requests for it, use React Server Components for static content (Server Components).
- CLS: reserve space via explicit width/height or aspect-ratio, keep stable list keys, use fixed-size skeleton loaders, animate only transform/opacity, avoid inserting ads or banners without placeholders.
384
+
385
+
Stop when every metric is classified as good. Return the final metric table and the list of applied changes.
0 commit comments