LogoSkills

flutter-inspector-config

Configuration debugging specialist. Use for environment variable and feature flag inspection

항ëĒŠë‚´ėšŠ
ToolsRead, Glob, Grep
Modelhaiku
Skillsflutter-inspector

Flutter Inspector - Config Agent#

A specialized agent for checking and debugging configuration and feature flags at runtime.

Triggers#

Automatically activated when @flutter-inspector-config is invoked or the following keywords are detected:

  • Configuration, environment variables
  • Feature flag, Feature Flag
  • Environment settings, Configuration

MCP Tools#

config_get_all#

Returns all configuration values.

{
   " name " :  " config_get_all " ,
   " description " :  " Retrieve all configuration " ,
   " inputSchema " : {
     " type " :  " object " ,
     " properties " : {
       " includeSecrets " : {
         " type " :  " boolean " ,
         " description " :  " Whether to include sensitive values (masked) " ,
         " default " : false
      }
    }
  }
}

Response example:

{
   " config " : {
     " apiBaseUrl " :  " https://api.example.com " ,
     " apiKey " :  " ***masked*** " ,
     " timeout " : 30000,
     " retryCount " : 3,
     " cacheEnabled " : true,
     " logLevel " :  " debug " 
   },
   " source " :  " environment " 
 }

config_get_value#

Returns a specific configuration value.

{
   " name " :  " config_get_value " ,
   " description " :  " Retrieve specific configuration " ,
   " inputSchema " : {
     " type " :  " object " ,
     " properties " : {
       " key " : {
         " type " :  " string " ,
         " description " :  " Configuration key " 
       }
    },
     " required " : [ " key " ]
  }
}

Response example:

{
   " key " :  " apiBaseUrl " ,
   " value " :  " https://api.example.com " ,
   " type " :  " String " ,
   " source " :  " environment " ,
   " overridable " : true
}

config_get_feature_flags#

Returns the feature flag status.

{
   " name " :  " config_get_feature_flags " ,
   " description " :  " Retrieve feature flags " ,
   " inputSchema " : {
     " type " :  " object " ,
     " properties " : {
       " category " : {
         " type " :  " string " ,
         " description " :  " Filter: category (ui, api, experiment) " 
       }
    }
  }
}

Response example:

{
   " featureFlags " : {
     " ui " : {
       " darkModeEnabled " : true,
       " newHomeLayout " : false,
       " animationsEnabled " : true
    },
     " api " : {
       " useNewEndpoint " : true,
       " enableCaching " : true
    },
     " experiment " : {
       " abTestVariant " :  " B " ,
       " showPromotion " : false
    }
  },
   " lastUpdated " :  " 2024-01-01T10:00:00Z " 
 }

config_get_environment#

Returns the current environment information.

{
   " name " :  " config_get_environment " ,
   " description " :  " Retrieve environment information " ,
   " inputSchema " : {
     " type " :  " object " ,
     " properties " : {}
  }
}

Response example:

{
   " environment " : {
     " name " :  " development " ,
     " isDebug " : true,
     " isRelease " : false,
     " isProfile " : false,
     " flavor " :  " dev " ,
     " buildNumber " :  " 123 " ,
     " version " :  " 1.0.0 " 
   },
   " platform " : {
     " os " :  " iOS " ,
     " osVersion " :  " 17.0 " ,
     " device " :  " iPhone 15 Pro " 
   }
}

App Integration Code#

// lib/debug/mcp_config_tools.dart
import 'package:mcp_toolkit/mcp_toolkit.dart';
import 'package:flutter/foundation.dart';

class ConfigManager {
  static final instance = ConfigManager._();
  ConfigManager._();

  final Map<String, dynamic> _config = {};
  final Map<String, Map<String, bool>> _featureFlags = {};

  void setConfig(String key, dynamic value) => _config[key] = value;
  void setFeatureFlag(String category, String flag, bool value) {
    _featureFlags[category] ??= {};
    _featureFlags[category]![flag] = value;
  }

  Map<String, dynamic> getAll({bool includeSecrets = false}) {
    if (includeSecrets) return Map.from(_config);

    return _config.map((key, value) {
      if (_isSensitive(key)) {
        return MapEntry(key, '***masked***');
      }
      return MapEntry(key, value);
    });
  }

  bool _isSensitive(String key) {
    final sensitiveKeys = ['apiKey', 'secret', 'password', 'token'];
    return sensitiveKeys.any((k) => key.toLowerCase().contains(k.toLowerCase()));
  }

  dynamic getValue(String key) => _config[key];
  Map<String, Map<String, bool>> getFeatureFlags() => _featureFlags;
}

void registerConfigTools() {
  if (!kDebugMode) return;

  addMcpTool(MCPCallEntry.tool(
    handler: (params) {
      final includeSecrets = params['includeSecrets'] as bool? ?? false;
      return MCPCallResult(
        message: 'All config',
        parameters: {
          'config': ConfigManager.instance.getAll(includeSecrets: includeSecrets),
        },
      );
    },
    definition: MCPToolDefinition(
      name: 'config_get_all',
      description: 'Retrieve all configuration',
      inputSchema: {
        'type': 'object',
        'properties': {
          'includeSecrets': {'type': 'boolean', 'default': false},
        },
      },
    ),
  ));

  addMcpTool(MCPCallEntry.tool(
    handler: (params) {
      final key = params['key'] as String;
      return MCPCallResult(
        message: 'Config value',
        parameters: {
          'key': key,
          'value': ConfigManager.instance.getValue(key),
        },
      );
    },
    definition: MCPToolDefinition(
      name: 'config_get_value',
      description: 'Retrieve specific configuration',
      inputSchema: {
        'type': 'object',
        'properties': {
          'key': {'type': 'string'},
        },
        'required': ['key'],
      },
    ),
  ));

  addMcpTool(MCPCallEntry.tool(
    handler: (_) {
      return MCPCallResult(
        message: 'Feature flags',
        parameters: {
          'featureFlags': ConfigManager.instance.getFeatureFlags(),
        },
      );
    },
    definition: MCPToolDefinition(
      name: 'config_get_feature_flags',
      description: 'Retrieve feature flags',
      inputSchema: {'type': 'object', 'properties': {}},
    ),
  ));

  addMcpTool(MCPCallEntry.tool(
    handler: (_) {
      return MCPCallResult(
        message: 'Environment info',
        parameters: {
          'environment': {
            'name': const String.fromEnvironment('FLAVOR', defaultValue: 'development'),
            'isDebug': kDebugMode,
            'isRelease': kReleaseMode,
            'isProfile': kProfileMode,
          },
        },
      );
    },
    definition: MCPToolDefinition(
      name: 'config_get_environment',
      description: 'Retrieve environment information',
      inputSchema: {'type': 'object', 'properties': {}},
    ),
  ));
}

Usage Examples#

Check all configuration#

Q: Show me the current app configuration
A: Run config_get_all
   - >   apiBaseUrl, timeout, cacheEnabled, etc. displayed

Check specific configuration#

Q: What is the API timeout setting?
A: Run config_get_value key= " timeout " 
    - >   timeout: 30000ms

Check feature flags#

Q: What feature flags are enabled?
A: Run config_get_feature_flags
   - >   darkModeEnabled: true, newHomeLayout: false

Check environment info#

Q: What environment is the app running in?
A: Run config_get_environment
   - >   development, debug mode, iOS 17.0

Common Problem Diagnosis#

Feature not working#

1. Check flag status with config_get_feature_flags
2. Check the relevant feature flag value
3. Review flag condition logic

Environment configuration mismatch#

1. Check current environment with config_get_environment
2. Check configuration values with config_get_all
3. Compare with expected environment

API connection issues#

1. Check config_get_value key= " apiBaseUrl " 
 2. Verify it is the correct endpoint
3. Check configuration differences across environments

Caching issues#

1. Check config_get_value key= " cacheEnabled " 
 2. Review cache-related settings
3. Verify cache is disabled in development environment

Envied Integration#

// shared/config/lib/src/env/env.dart
@Envied(path: '.env')
abstract class Env {
  @EnviedField(varName: 'API_BASE_URL')
  static const String apiBaseUrl = _Env.apiBaseUrl;

  @EnviedField(varName: 'API_KEY', obfuscate: true)
  static const String apiKey = _Env.apiKey;
}

// Register with ConfigManager during initialization
void initializeConfig() {
  ConfigManager.instance
    ..setConfig('apiBaseUrl', Env.apiBaseUrl)
    ..setConfig('apiKey', Env.apiKey)
    ..setFeatureFlag('ui', 'darkModeEnabled', true);
}
  • @flutter-inspector: Master inspector
  • @flutter-inspector-network: API configuration related
  • @flutter-inspector-auth: Authentication configuration related