| ํญ๋ชฉ | ๋ด์ฉ |
| Invoke | /inspector |
| Aliases | /debug, /inspect, /flutter:debug |
| Category | kobic-development |
| Complexity | moderate |
| MCP Servers | flutter-inspector, serena |
/inspector โ ์ฑ ์์ ๋ค์ฌ๋ค๋ณด๋ "์ง๋จ ์์ฌ"#
ํ๋ง๋๋ก#
์คํ ์ค์ธ Flutter ์ฑ ์์์ ์ง๊ธ ๋ฌด์จ ์ผ์ด ๋ฒ์ด์ง๊ณ ์๋์ง ๋ค์ฌ๋ค๋ณด๋ ์ฒญ์ง๊ธฐ์
๋๋ค.
ํ๋ฉด ์ ํ, ๋ก๊ทธ์ธ, ํ๋ฉด ๋ฐ์ดํฐ, ํต์ ๊ฐ์ ๋ถ๋ถ์ ์์ฌ๊ฐ ์ฒญ์ง๊ธฐ๋ก ๋ชธ์์ ์ดํด๋ณด๋ฏ ์ค์๊ฐ์ผ๋ก ์ง๋จํฉ๋๋ค.
๋๊ฐยท์ธ์ ์ฐ๋์#
- ์ฑ์ด ์ด์ํ๊ฒ ๋์ํ๋๋ฐ ์์ธ์ ๋์ผ๋ก ํ์ธํ๊ณ ์ถ์ ๋ (ํ๋ฉด์ด ์ ๋์ด๊ฐ, ๋ก๊ทธ์ธ์ด ํ๋ฆผ, ๋ฐ์ดํฐ๊ฐ ์ ๋ณด์, ํต์ ์ค๋ฅ ๋ฑ)
- ๊ฐ๋ฐ์/AI ์์ด์ ํธ๊ฐ ์ฝ๋๋ฅผ ๊ณ ์น๊ธฐ ์ ์ ์ค์ ์คํ ์ํ๋ฅผ ๋จผ์ ์ ๊ฒํ ๋
- ๋จ, ์ฑ์ด ๋๋ฒ๊ทธ ๋ชจ๋๋ก ์คํ ์ค์ด์ด์ผ ์ง๋จ์ด ๊ฐ๋ฅํฉ๋๋ค (์คํ ์กฐ๊ฑด์ ์๋ ์์ธ ๋ช
์ธ ์ฐธ๊ณ ).
๋ฌด์์ ํด์ฃผ๋์#
์ฑ์ ๋ถ์๋ณ๋ก ๋๋ ์ง 9๊ฐ์ ์ ๋ฌธ ์ง๋จ๊ธฐ๋ฅผ ํตํด ์ค์๊ฐ ์ํ๋ฅผ ๋ณด์ฌ์ค๋๋ค.
nav โ ํ๋ฉด ์ ํ(ํ์ฌ ์ด๋ ํ๋ฉด์ธ์ง, ์ด๋ ๊ธฐ๋ก)
bloc โ ํ๋ฉด ๋ฐ์ดํฐยท์ํ ๊ด๋ฆฌ ํ๋ฆ
auth โ ๋ก๊ทธ์ธ/์ธ์ฆ ์ํ
network โ ์๋ฒ์ ์ฃผ๊ณ ๋ฐ์ ํต์ ๊ธฐ๋ก๊ณผ ์ค๋ฅ
log โ ์ฑ์ด ๋จ๊ธด ๊ธฐ๋ก(๋ก๊ทธ)
ui โ ํ๋ฉด ๊ตฌ์ฑ(๋ ์ด์์, ํ๋ฉด ๋ฐ์ผ๋ก ์์ ธ๋์จ ๋ถ๋ถ ๋ฑ)
config โ ์ค์ ๊ฐยท๊ธฐ๋ฅ on/off ํ๋๊ทธ
form โ ์
๋ ฅ ํผ์ ๊ฐยท๊ฒ์ฆ ์ค๋ฅ
image โ ์ด๋ฏธ์ง ์บ์ยท๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋
์ด๋ป๊ฒ ์ฐ๋์#
# ๋ชจ๋ ์์ญ์ ํ ๋ฒ์ ์ ๊ฒ
/inspector --all
# ํ๋ฉด ์ ํ ๋ฌธ์ ์ง๋จ
/inspector nav
# ํ๋ฉด ์ํ(BLoC)๋ฅผ ์์ธํ ์ ๊ฒ
/inspector bloc --verbose
# ํต์ ์ค๋ฅ ๋ถ์
/inspector network
-
์ง๋จํ ๋ถ์ ์ด๋ฆ(
nav, bloc, auth, network, log,
ui, config, form, image)์ ๋ถ์ฌ ๋ถ๋ฅด๋ฉด ๋ฉ๋๋ค.
--verbose๋ ๋ ์์ธํ, --all์ ๋ชจ๋ ๋ถ์๋ฅผ ํ๊บผ๋ฒ์ ์ ๊ฒํฉ๋๋ค.
์์์ ๋ฌด์จ ์ผ์ด ๋ฒ์ด์ง๋์#
๋๋ต 4๋จ๊ณ๋ก ์ง๋จ์ด ์งํ๋ฉ๋๋ค.
- ์ฐ๊ฒฐ ํ์ธ โ ์ฑ๊ณผ ์ ์์ ์ผ๋ก ์ฐ๊ฒฐ๋๋์ง, ์ง๋จ ๋๊ตฌ๋ฅผ ์ธ ์ ์๋์ง ํ์ธํฉ๋๋ค.
-
๋ฌธ์ ๋ถ์ ์ฐพ๊ธฐ โ ์ฆ์์ ๋ง๋ ๋ถ์๋ก ์๋ดํฉ๋๋ค(ํ๋ฉด ์ ํโ
nav, ์ํ ๋ฌธ์ โbloc, ๋ก๊ทธ์ธ ๋ฌธ์ โauth, ํต์ ๋ฌธ์ โnetwork).
- ์์ธ ๋ถ์ โ ํด๋น ๋ถ์ ์ ๋ฌธ ์ง๋จ๊ธฐ๋ฅผ ๋๋ ค ๋ก๊ทธยท์ํ๋ฅผ ์ถ์ ํ๊ณ ๋ฌธ์ ๋ฅผ ์ง์ด๋
๋๋ค.
- ํด๊ฒฐยทํ์ธ โ ์ฝ๋ ์์ ์์ ์ ์ํ๊ณ , ์ฆ์ ๋ฐ์(hot reload)ํ ๋ค ๋ค์ ์ ๊ฒํด ํ์ธํฉ๋๋ค.
โ๏ธ ์์ธ ์ต์
ยท์คํ ๋ช
์ธ (๊ฐ๋ฐ์ / AI ์์ด์ ํธ์ฉ)
Triggers#
- When app debugging is requested
- When runtime state inspection is needed
- When MCP toolkit-based inspection is needed
Context Trigger Pattern#
/inspector {area} [--options]
Parameters#
| Parameter | Required | Description | Example |
|---|
area | No | Inspection area | nav, bloc, auth, network, log, ui, config, form, image |
--verbose | No | Verbose output | |
--all | No | Inspect all areas | |
Sub-Inspectors#
9 Specialized Inspectors#
| Inspector | Role | Key Tools |
|---|
/inspector/nav | GoRouter navigation | nav_get_current_route, nav_get_history |
/inspector/bloc | BLoC state tracking | bloc_list_active, bloc_get_state |
/inspector/auth | Authentication status | auth_get_status, auth_get_user |
/inspector/network | HTTP request logging | network_get_logs, network_get_errors |
/inspector/log | App log management | log_get_recent, log_get_errors |
/inspector/ui | Widget tree inspection | ui_get_widget_tree, ui_find_overflow |
/inspector/config | Settings/feature flags | config_get_all, config_get_feature_flags |
/inspector/form | Form validation debugging | form_get_state, form_get_errors |
/inspector/image | Image cache/memory | img_get_cache_stats, img_analyze_warnings |
Prerequisites#
Flutter App Run Conditions#
# Run in debug mode (VM Service enabled)
flutter run --debug \
--enable-vm-service \
--host-vmservice-port=8182 \
--dds-port=8181 \
--disable-service-auth-codes
// main.dart
import 'package:mcp_toolkit/mcp_toolkit.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
MCPToolkitBinding.instance
..initialize()
..initializeFlutterToolkit();
if (kDebugMode) {
// Register custom tools
registerDebugTools();
}
runApp(const MyApp());
}
Diagnostic Workflow#
+---------------------------------------------+
| 1. Verify App Connection |
+---------------------------------------------+
| - Test hot_reload_flutter |
| - Check listClientToolsAndResources |
+---------------------------------------------+
|
v
+---------------------------------------------+
| 2. Identify Problem Area |
+---------------------------------------------+
| - Screen transition - > @flutter-inspector-nav|
| - State issue - > @flutter-inspector-bloc |
| - Login issue - > @flutter-inspector-auth |
| - API issue - > @flutter-inspector-network |
+---------------------------------------------+
|
v
+---------------------------------------------+
| 3. Detailed Analysis |
+---------------------------------------------+
| - Run specialized inspector tools |
| - Track logs and state |
| - Identify issues |
+---------------------------------------------+
|
v
+---------------------------------------------+
| 4. Resolution and Verification |
+---------------------------------------------+
| - Suggest code fixes |
| - Apply with hot_reload_flutter |
| - Confirm with re-inspection |
+---------------------------------------------+
Quick Diagnostics#
Screen Transition Issues#
1. /inspector/nav - > Check current route
2. nav_get_history - > Track transition history
3. nav_get_params - > Verify passed parameters
State Management Issues#
1. /inspector/bloc - > Active BLoC list
2. bloc_get_state - > Check current state
3. bloc_get_events - > Event history
API Errors#
1. /inspector/network - > Request/response logs
2. network_get_errors - > Check failed requests
3. /inspector/auth - > Check token status
UI Layout Issues#
1. /inspector/ui - > Check widget tree
2. ui_find_overflow - > Search for overflow
3. ui_get_screen_info - > Screen info
1. /inspector/image - > Image cache analysis
2. img_analyze_warnings - > Memory warnings
3. /inspector/log - > Performance related logs
MCP Integration#
| Step | MCP Server | Purpose |
|---|
| App connection | flutter-inspector | VM Service connection |
| Tool query | flutter-inspector | listClientToolsAndResources |
| Tool execution | flutter-inspector | runClientTool |
| Code analysis | serena | Related code search |
Examples#
Full state check#
Navigation debugging#
BLoC state check#
/inspector bloc --verbose
Network error analysis#
References#
- Detailed implementation:
.claude/agents/flutter-inspector.md - Sub-inspectors:
.claude/commands/inspector/ - MCP toolkit:
package/mcp_toolkit/