metro-mcp 0.6.1 → 0.6.2
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/dist/bin/metro-mcp.js +16 -24
- package/dist/index.js +16 -24
- package/dist/plugins/navigation.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bin/metro-mcp.js
CHANGED
|
@@ -3740,7 +3740,7 @@ function extractCDPExceptionMessage(details, fallback = "Evaluation failed") {
|
|
|
3740
3740
|
// package.json
|
|
3741
3741
|
var package_default = {
|
|
3742
3742
|
name: "metro-mcp",
|
|
3743
|
-
version: "0.6.
|
|
3743
|
+
version: "0.6.2",
|
|
3744
3744
|
description: "Plugin-based MCP server for React Native/Expo runtime debugging, inspection, and automation via Metro/CDP",
|
|
3745
3745
|
homepage: "https://metromcp.dev",
|
|
3746
3746
|
repository: {
|
|
@@ -6174,33 +6174,25 @@ var navigationPlugin = definePlugin({
|
|
|
6174
6174
|
return state;
|
|
6175
6175
|
}
|
|
6176
6176
|
});
|
|
6177
|
+
function getFocusedRoute(s) {
|
|
6178
|
+
const routes = s.routes;
|
|
6179
|
+
if (!routes)
|
|
6180
|
+
return null;
|
|
6181
|
+
const idx = s.index !== undefined ? s.index : routes.length - 1;
|
|
6182
|
+
const route = routes[idx];
|
|
6183
|
+
if (route.state && typeof route.state === "object") {
|
|
6184
|
+
return getFocusedRoute(route.state);
|
|
6185
|
+
}
|
|
6186
|
+
return { name: route.name, params: route.params || {}, key: route.key };
|
|
6187
|
+
}
|
|
6177
6188
|
ctx.registerTool("get_current_route", {
|
|
6178
6189
|
description: "Get the currently focused route name and params.",
|
|
6179
6190
|
parameters: z13.object({}),
|
|
6180
6191
|
handler: async () => {
|
|
6181
|
-
const
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
return getState()`)};
|
|
6186
|
-
|
|
6187
|
-
if (!state) return null;
|
|
6188
|
-
|
|
6189
|
-
// Walk to the deepest focused route
|
|
6190
|
-
function getFocusedRoute(s) {
|
|
6191
|
-
if (!s || !s.routes) return null;
|
|
6192
|
-
var idx = s.index !== undefined ? s.index : s.routes.length - 1;
|
|
6193
|
-
var route = s.routes[idx];
|
|
6194
|
-
if (route.state && route.state.routes) {
|
|
6195
|
-
return getFocusedRoute(route.state);
|
|
6196
|
-
}
|
|
6197
|
-
return { name: route.name, params: route.params || {}, key: route.key };
|
|
6198
|
-
}
|
|
6199
|
-
|
|
6200
|
-
return getFocusedRoute(state);
|
|
6201
|
-
})()
|
|
6202
|
-
`;
|
|
6203
|
-
const result = await ctx.evalInApp(expr, { awaitPromise: true });
|
|
6192
|
+
const state = await ctx.evalInApp(GET_NAV_STATE_EXPR, { awaitPromise: true });
|
|
6193
|
+
if (!state || typeof state !== "object")
|
|
6194
|
+
return "No focused route found.";
|
|
6195
|
+
const result = getFocusedRoute(state);
|
|
6204
6196
|
if (!result)
|
|
6205
6197
|
return "No focused route found.";
|
|
6206
6198
|
return result;
|
package/dist/index.js
CHANGED
|
@@ -3748,7 +3748,7 @@ function extractCDPExceptionMessage(details, fallback = "Evaluation failed") {
|
|
|
3748
3748
|
// package.json
|
|
3749
3749
|
var package_default = {
|
|
3750
3750
|
name: "metro-mcp",
|
|
3751
|
-
version: "0.6.
|
|
3751
|
+
version: "0.6.2",
|
|
3752
3752
|
description: "Plugin-based MCP server for React Native/Expo runtime debugging, inspection, and automation via Metro/CDP",
|
|
3753
3753
|
homepage: "https://metromcp.dev",
|
|
3754
3754
|
repository: {
|
|
@@ -6177,33 +6177,25 @@ var navigationPlugin = definePlugin({
|
|
|
6177
6177
|
return state;
|
|
6178
6178
|
}
|
|
6179
6179
|
});
|
|
6180
|
+
function getFocusedRoute(s) {
|
|
6181
|
+
const routes = s.routes;
|
|
6182
|
+
if (!routes)
|
|
6183
|
+
return null;
|
|
6184
|
+
const idx = s.index !== undefined ? s.index : routes.length - 1;
|
|
6185
|
+
const route = routes[idx];
|
|
6186
|
+
if (route.state && typeof route.state === "object") {
|
|
6187
|
+
return getFocusedRoute(route.state);
|
|
6188
|
+
}
|
|
6189
|
+
return { name: route.name, params: route.params || {}, key: route.key };
|
|
6190
|
+
}
|
|
6180
6191
|
ctx.registerTool("get_current_route", {
|
|
6181
6192
|
description: "Get the currently focused route name and params.",
|
|
6182
6193
|
parameters: z13.object({}),
|
|
6183
6194
|
handler: async () => {
|
|
6184
|
-
const
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
return getState()`)};
|
|
6189
|
-
|
|
6190
|
-
if (!state) return null;
|
|
6191
|
-
|
|
6192
|
-
// Walk to the deepest focused route
|
|
6193
|
-
function getFocusedRoute(s) {
|
|
6194
|
-
if (!s || !s.routes) return null;
|
|
6195
|
-
var idx = s.index !== undefined ? s.index : s.routes.length - 1;
|
|
6196
|
-
var route = s.routes[idx];
|
|
6197
|
-
if (route.state && route.state.routes) {
|
|
6198
|
-
return getFocusedRoute(route.state);
|
|
6199
|
-
}
|
|
6200
|
-
return { name: route.name, params: route.params || {}, key: route.key };
|
|
6201
|
-
}
|
|
6202
|
-
|
|
6203
|
-
return getFocusedRoute(state);
|
|
6204
|
-
})()
|
|
6205
|
-
`;
|
|
6206
|
-
const result = await ctx.evalInApp(expr, { awaitPromise: true });
|
|
6195
|
+
const state = await ctx.evalInApp(GET_NAV_STATE_EXPR, { awaitPromise: true });
|
|
6196
|
+
if (!state || typeof state !== "object")
|
|
6197
|
+
return "No focused route found.";
|
|
6198
|
+
const result = getFocusedRoute(state);
|
|
6207
6199
|
if (!result)
|
|
6208
6200
|
return "No focused route found.";
|
|
6209
6201
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/plugins/navigation.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/plugins/navigation.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,yCA+J3B,CAAC"}
|
package/package.json
CHANGED