gcp_run_status
Check Cloud Run service status and deployment state in Google Cloud Platform. Retrieve service health, region details, and project information for monitoring and troubleshooting.
Instructions
Cloud Run 상태|서비스 상태|배포 상태|run status - Cloud Run 서비스 상태를 조회합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service | Yes | Cloud Run 서비스 이름 | |
| region | No | 리전 (예: asia-northeast3). 기본: gcloud 설정값 | |
| project_id | No | GCP 프로젝트 ID (기본: 현재 설정된 프로젝트) | |
| format | No | 출력 형식 (기본: text) | text |
Implementation Reference
- src/gcp/runStatus.ts:47-116 (handler)Main handler function that executes the tool: builds and runs gcloud command to describe Cloud Run service, parses output, formats status, handles errors.export async function gcpRunStatus(args: GcpRunStatusArgs) { try { const projectId = await getProjectId(args.project_id); // Build command let command = `run services describe ${args.service} --project=${projectId} --format=json`; if (args.region) { command += ` --region=${args.region}`; } const result = await executeGcloud(command, 30000); // Parse JSON output let serviceInfo: any = {}; try { serviceInfo = JSON.parse(result.stdout || '{}'); } catch { serviceInfo = {}; } // Extract relevant information const status = { name: serviceInfo.metadata?.name || args.service, url: serviceInfo.status?.url || 'N/A', region: args.region || serviceInfo.metadata?.labels?.['cloud.googleapis.com/location'] || 'N/A', revision: serviceInfo.status?.latestReadyRevisionName || 'N/A', status: serviceInfo.status?.conditions?.find((c: any) => c.type === 'Ready')?.status === 'True' ? 'Ready' : 'Not Ready', traffic: serviceInfo.status?.traffic?.map((t: any) => ({ revisionName: t.revisionName || t.latestRevision ? 'latest' : 'unknown', percent: t.percent || 0, })) || [], lastDeployed: serviceInfo.metadata?.creationTimestamp || null, containerImage: serviceInfo.spec?.template?.spec?.containers?.[0]?.image || 'N/A', }; if (args.format === 'json') { return { content: [ { type: 'text', text: JSON.stringify({ project: projectId, ...status, raw: serviceInfo, }, null, 2), }, ], }; } return { content: [ { type: 'text', text: formatRunStatus(status), }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: formatError(error), }, ], isError: true, }; } }
- src/gcp/runStatus.ts:4-38 (schema)Tool schema definition including name, description, annotations, and inputSchema with properties for service, region, project_id, format.export const gcpRunStatusDefinition = { name: 'gcp_run_status', description: 'Cloud Run 상태|서비스 상태|배포 상태|run status - Cloud Run 서비스 상태를 조회합니다', annotations: { title: 'Cloud Run 상태 조회', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, inputSchema: { type: 'object' as const, properties: { service: { type: 'string', description: 'Cloud Run 서비스 이름', }, region: { type: 'string', description: '리전 (예: asia-northeast3). 기본: gcloud 설정값', }, project_id: { type: 'string', description: 'GCP 프로젝트 ID (기본: 현재 설정된 프로젝트)', }, format: { type: 'string', enum: ['text', 'json'], description: '출력 형식 (기본: text)', default: 'text', }, }, required: ['service'], }, };
- src/index.ts:77-89 (registration)Registration of all tools including gcpRunStatusDefinition in the tools array used for ListToolsRequestHandler.const tools = [ gcpSetupDefinition, gcpLogsReadDefinition, gcpRunStatusDefinition, gcpRunLogsDefinition, gcpSqlQueryDefinition, gcpSqlProxyDefinition, gcpStorageListDefinition, gcpSecretListDefinition, gcpAuthStatusDefinition, gcpServicesListDefinition, gcpBillingInfoDefinition, ];
- src/index.ts:217-218 (registration)Dispatch/execution handler in the CallToolRequestSchema switch case that calls the gcpRunStatus function.case 'gcp_run_status': return await gcpRunStatus(args as any) as CallToolResult;