@@ -21,6 +21,28 @@ class ToolDefinition {
2121///
2222/// Extracted from FlutterMcpServer._getToolsList() — pure data, no logic.
2323class ToolRegistry {
24+ /// Gemini/Vertex AI maximum tool declarations per request.
25+ static const geminiToolLimit = 128 ;
26+
27+ /// Tools shown before any connection is established.
28+ ///
29+ /// Kept intentionally small (~11) so the total stays under the Gemini
30+ /// 128-function limit even when flutter-skill is combined with other MCP
31+ /// servers (e.g. Dart MCP). All other tools become visible after connecting.
32+ static const connectionOnlyTools = < String > {
33+ 'connect_app' ,
34+ 'connect_cdp' ,
35+ 'connect_openclaw_browser' ,
36+ 'connect_webmcp' ,
37+ 'scan_and_connect' ,
38+ 'launch_app' ,
39+ 'list_sessions' ,
40+ 'list_running_apps' ,
41+ 'get_connection_status' ,
42+ 'disconnect' ,
43+ 'diagnose_project' ,
44+ };
45+
2446 /// CDP-only tools that don't apply to bridge/Flutter platforms.
2547 static const cdpOnlyTools = < String > {
2648 'connect_cdp' ,
@@ -804,12 +826,6 @@ After starting, point the web SDK at ws://127.0.0.1:<port>.""",
804826 "description" : "Get browser console log messages" ,
805827 "inputSchema" : {"type" : "object" , "properties" : {}}
806828 },
807- {
808- "name" : "get_network_requests" ,
809- "description" :
810- "Get all network requests made by the page (via Performance API)" ,
811- "inputSchema" : {"type" : "object" , "properties" : {}}
812- },
813829 {
814830 "name" : "set_viewport" ,
815831 "description" : "Set browser viewport size (responsive testing)" ,
@@ -3624,8 +3640,15 @@ can visually compare them. Also returns text snapshots for structural comparison
36243640 });
36253641 }
36263642
3627- // Smart filtering: when connected, only return relevant tools
3628- if (! hasConnection) return allTools;
3643+ // Before any connection: only show connection/discovery tools.
3644+ // This keeps the total under the Gemini 128-function-declaration limit
3645+ // when flutter-skill is used alongside other MCP servers (e.g. Dart MCP).
3646+ // All tools become visible after connect_app / connect_cdp / etc.
3647+ if (! hasConnection) {
3648+ return allTools
3649+ .where ((t) => connectionOnlyTools.contains (t['name' ] as String ))
3650+ .toList ();
3651+ }
36293652
36303653 return allTools.where ((tool) {
36313654 final name = tool['name' ] as String ;
0 commit comments