config_list
Retrieve current Google Cloud configuration settings directly within GCP MCP, enabling users to view and manage GCP resources without manual credential setup.
Instructions
List the current Google Cloud configuration.
Returns:
Current configuration settings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the 'config_list' MCP tool. It retrieves and displays the current Google Cloud configuration, including project ID, authentication status, and additional config file settings.@mcp.tool() def config_list() -> str: """ List the current Google Cloud configuration. Returns: Current configuration settings """ try: # Get project ID from config project_id = _get_project_id_from_config() # Get project ID from global variable if set if _current_project_id: project_id = _current_project_id output = "Current Configuration:\n" if project_id: output += f"- Project ID: {project_id}\n" else: output += "- Project ID: Not set\n" # Check if we have active credentials try: import google.auth credentials, default_project = google.auth.default() if hasattr(credentials, 'service_account_email'): output += f"- Authenticated as: {credentials.service_account_email} (Service Account)\n" else: output += "- Authenticated as: User Account\n" if default_project and default_project != project_id: output += f"- Default Project in Credentials: {default_project}\n" except Exception: output += "- Authentication: Not authenticated or credentials not found\n" # Get additional configuration config_file = os.path.join(_get_config_path(), 'configurations', 'config_default') if os.path.exists(config_file): try: with open(config_file, 'r') as f: config_lines = f.readlines() if config_lines: output += "\nAdditional Configuration Settings:\n" for line in config_lines: line = line.strip() if line and not line.startswith('#') and '=' in line: key, value = line.split('=', 1) key = key.strip() value = value.strip() # Skip project since we already displayed it if key != 'project': output += f"- {key}: {value}\n" except: pass return output except Exception as e: return f"Error listing configuration: {str(e)}"