Skip to main content
Glama

auth_list

Retrieve a list of active Google Cloud credentials and identify the current default account for streamlined access and management using the GCP MCP server.

Instructions

    List active Google Cloud credentials.
    
    Returns:
        List of active credentials and the current default account
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'auth_list' MCP tool. It lists active Google Cloud credentials by checking application default credentials (ADC), extracting account info, and scanning gcloud credentials directory for additional accounts.
    def auth_list() -> str:
        """
        List active Google Cloud credentials.
        
        Returns:
            List of active credentials and the current default account
        """
        try:
            import google.auth
            
            # Check application default credentials
            try:
                credentials, project = google.auth.default()
                
                # Try to get email from credentials
                email = None
                if hasattr(credentials, 'service_account_email'):
                    email = credentials.service_account_email
                elif hasattr(credentials, 'refresh_token') and credentials.refresh_token:
                    # This is a user credential
                    adc_path = _get_adc_path()
                    if os.path.exists(adc_path):
                        try:
                            with open(adc_path, 'r') as f:
                                data = json.load(f)
                                if 'refresh_token' in data:
                                    # This is a user auth, but we can't get the email directly
                                    email = "User account (ADC)"
                        except:
                            pass
                
                credential_type = type(credentials).__name__
                
                output = "Active Credentials:\n"
                if email:
                    output += f"- {email} (Application Default Credentials, type: {credential_type})\n"
                else:
                    output += f"- Application Default Credentials (type: {credential_type})\n"
                
                if project:
                    output += f"\nCurrent Project: {project}\n"
                else:
                    output += "\nNo project set in default credentials.\n"
                
                # Check for other credentials in well-known locations
                credentials_dir = os.path.expanduser("~/.config/gcloud/credentials")
                if os.path.isdir(credentials_dir):
                    cred_files = [f for f in os.listdir(credentials_dir) if f.endswith('.json')]
                    if cred_files:
                        output += "\nOther available credentials:\n"
                        for cred_file in cred_files:
                            try:
                                with open(os.path.join(credentials_dir, cred_file), 'r') as f:
                                    data = json.load(f)
                                    if 'client_id' in data:
                                        output += f"- User account ({cred_file})\n"
                                    elif 'private_key_id' in data:
                                        output += f"- Service account: {data.get('client_email', 'Unknown')} ({cred_file})\n"
                            except:
                                output += f"- Unknown credential type ({cred_file})\n"
                
                return output
            except Exception as e:
                return f"No active credentials found. Please run auth_login() to authenticate.\nError: {str(e)}"
                
        except Exception as e:
            return f"Error listing credentials: {str(e)}"
  • Registration of authentication tools (including auth_list) by calling register_tools on the auth_tools module in the main GCP MCP server.
    auth_tools.register_tools(mcp)
  • Import of the auth tools module in the main server.py, aliased as auth_tools, which provides the register_tools function.
    from .gcp_modules.auth import tools as auth_tools
  • Helper function used by auth_list to determine the path to the application default credentials (ADC) file.
    def _get_adc_path() -> str:
        """Get the path to the application default credentials file."""
        # Standard ADC paths by platform
        if os.name == 'nt':  # Windows
            return os.path.join(os.environ.get('APPDATA', ''), 'gcloud', 'application_default_credentials.json')
        else:  # Linux/Mac
            return os.path.expanduser('~/.config/gcloud/application_default_credentials.json')
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the return content but doesn't cover critical aspects like whether this requires specific permissions, how it handles authentication state, or potential rate limits. This is inadequate for a tool that interacts with credentials.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise with two brief sentences: one stating the purpose and another describing the return value. It's front-loaded with the core functionality and wastes no words, making it easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of credential management and the lack of annotations and output schema, the description is incomplete. It doesn't explain authentication requirements, error conditions, or the format of returned data (e.g., structure of the list), leaving significant gaps for an agent to use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a baseline score of 4 for not adding unnecessary information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('active Google Cloud credentials'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_service_accounts' or 'config_list', which might also list credential-related information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., authentication status) or compare it to siblings like 'auth_login' or 'auth_revoke', leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/henihaddad/gcp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server