Skip to main content
Glama

gcp_auth_status

Read-onlyIdempotent

Check Google Cloud Platform authentication status and account information to verify login credentials and active sessions.

Instructions

인증 상태|로그인 확인|계정 정보|auth status|whoami - GCP 인증 상태와 계정 정보를 확인합니다

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
show_all_accountsNo모든 인증된 계정 표시 (기본: false)
formatNo출력 형식 (기본: text)text

Implementation Reference

  • The core handler function for the 'gcp_auth_status' tool. It checks GCP authentication using checkGcloudAuth, fetches config and accounts if needed, and returns formatted output in text or JSON.
    export async function gcpAuthStatus(args: GcpAuthStatusArgs) {
      try {
        const authStatus = await checkGcloudAuth();
    
        if (!authStatus.authenticated) {
          return {
            content: [
              {
                type: 'text',
                text: formatError(authStatus.error),
              },
            ],
            isError: true,
          };
        }
    
        // Get additional configuration
        const configResult = await executeGcloud('config list --format=json', 10000);
        let config: any = {};
        try {
          config = JSON.parse(configResult.stdout || '{}');
        } catch {
          config = {};
        }
    
        // Get all accounts if requested
        let allAccounts: string[] = [];
        if (args.show_all_accounts) {
          try {
            const accountsResult = await executeGcloud('auth list --format="value(account)"', 10000);
            allAccounts = accountsResult.stdout.trim().split('\n').filter(Boolean);
          } catch {
            // Ignore errors
          }
        }
    
        const result = {
          authenticated: true,
          activeAccount: authStatus.account,
          project: authStatus.project,
          region: config.compute?.region || 'not set',
          zone: config.compute?.zone || 'not set',
          allAccounts: args.show_all_accounts ? allAccounts : undefined,
        };
    
        if (args.format === 'json') {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        }
    
        const lines = [
          '🔑 GCP 인증 상태',
          '',
          `✅ 인증됨`,
          `👤 계정: ${result.activeAccount}`,
          `📁 프로젝트: ${result.project || '(설정 안됨)'}`,
          `🌍 리전: ${result.region}`,
          `📍 존: ${result.zone}`,
        ];
    
        if (args.show_all_accounts && allAccounts.length > 1) {
          lines.push('', '📋 모든 인증된 계정:');
          allAccounts.forEach((account) => {
            const isActive = account === result.activeAccount;
            lines.push(`  ${isActive ? '→' : ' '} ${account}${isActive ? ' (활성)' : ''}`);
          });
        }
    
        return {
          content: [
            {
              type: 'text',
              text: lines.join('\n'),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: formatError(error),
            },
          ],
          isError: true,
        };
      }
    }
  • Tool schema definition including name, description, annotations, and input schema for parameters show_all_accounts and format. Also defines the TypeScript interface for function arguments.
    export const gcpAuthStatusDefinition = {
      name: 'gcp_auth_status',
      description: '인증 상태|로그인 확인|계정 정보|auth status|whoami - GCP 인증 상태와 계정 정보를 확인합니다',
      annotations: {
        title: 'GCP 인증 상태 확인',
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true,
      },
      inputSchema: {
        type: 'object' as const,
        properties: {
          show_all_accounts: {
            type: 'boolean',
            description: '모든 인증된 계정 표시 (기본: false)',
            default: false,
          },
          format: {
            type: 'string',
            enum: ['text', 'json'],
            description: '출력 형식 (기본: text)',
            default: 'text',
          },
        },
        required: [],
      },
    };
    
    interface GcpAuthStatusArgs {
      show_all_accounts?: boolean;
      format?: 'text' | 'json';
    }
  • src/index.ts:77-89 (registration)
    Adds gcpAuthStatusDefinition to the tools array returned by ListToolsRequestHandler, registering the tool with the MCP server.
    const tools = [
      gcpSetupDefinition,
      gcpLogsReadDefinition,
      gcpRunStatusDefinition,
      gcpRunLogsDefinition,
      gcpSqlQueryDefinition,
      gcpSqlProxyDefinition,
      gcpStorageListDefinition,
      gcpSecretListDefinition,
      gcpAuthStatusDefinition,
      gcpServicesListDefinition,
      gcpBillingInfoDefinition,
    ];
  • src/index.ts:227-228 (registration)
    In the CallToolRequestHandler switch statement, dispatches calls to the gcp_auth_status tool by invoking the gcpAuthStatus handler function.
    case 'gcp_auth_status':
      return await gcpAuthStatus(args as any) as CallToolResult;
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, openWorldHint=true, and idempotentHint=true, covering safety and idempotency. The description adds value by specifying it checks '인증 상태와 계정 정보' (authentication status and account info), which implies it returns user/account details, but doesn't disclose behavioral traits like rate limits, auth requirements, or output structure beyond what annotations provide.

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

Conciseness3/5

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

The description is a single phrase with redundant terms ('인증 상태|로그인 확인|계정 정보|auth status|whoami') that could be streamlined. It's front-loaded with the core purpose but includes unnecessary repetition, reducing efficiency without adding clarity.

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

Completeness3/5

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

Given the tool's low complexity (2 optional parameters, no output schema) and rich annotations, the description is minimally adequate. It states the purpose but lacks details on output format, error handling, or integration with siblings, leaving gaps for an agent to fully understand context despite annotations covering safety aspects.

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

Parameters3/5

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

Schema description coverage is 100%, with clear descriptions for both parameters (show_all_accounts and format). The description doesn't add any semantic details beyond the schema, such as explaining when to use 'show_all_accounts' or the implications of 'text' vs 'json' format. Baseline 3 is appropriate as the schema fully documents parameters.

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 tool's purpose as 'GCP 인증 상태와 계정 정보를 확인합니다' (check GCP authentication status and account information), which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'gcp_setup' or 'gcp_billing_info' that might also involve account-related operations, so it misses the highest score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing prior authentication), compare to siblings like 'gcp_setup' for setup or 'gcp_billing_info' for billing details, or specify use cases beyond generic status checking, leaving the agent with minimal context for selection.

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

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/su-record/hi-gcloud'

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