gcp_list_cloud_functions
Retrieve all Google Cloud Functions in a specified GCP project and region to manage serverless resources.
Instructions
List all Cloud Functions in GCP
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | GCP project ID | |
| region | No | GCP region | us-central1 |
Implementation Reference
- src/tools/gcp-tools.ts:98-112 (handler)Handler implementation for the 'gcp_list_cloud_functions' tool. It initializes the GCPAdapter and calls listCloudFunctions() on it, then formats the response.case 'gcp_list_cloud_functions': { const functions = await adapter.listCloudFunctions(); return { total: functions.length, functions: functions.map((func) => ({ id: func.id, name: func.functionName, runtime: func.runtime, region: func.region, status: func.status, availableMemoryMb: func.availableMemoryMb, timeout: func.timeout, })), }; }
- src/tools/gcp-tools.ts:41-58 (schema)Schema definition for the 'gcp_list_cloud_functions' tool, including input parameters for projectId and region.{ name: 'gcp_list_cloud_functions', description: 'List all Cloud Functions in GCP', inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'GCP project ID', }, region: { type: 'string', description: 'GCP region', default: 'us-central1', }, }, }, },
- src/server.ts:68-69 (registration)Registration and routing logic in the main MCP server: checks if tool name matches gcpTools and calls the corresponding handler.} else if (gcpTools.some((t) => t.name === name)) { result = await handleGCPTool(name, args || {});
- src/adapters/gcp-adapter.ts:136-152 (helper)Core helper method in GCPAdapter that implements the logic to list Cloud Functions. Currently a placeholder returning empty array, with comments for full implementation using @google-cloud/functions.async listCloudFunctions(): Promise<GCPCloudFunction[]> { await this.initializeClients(); // Simplified implementation - would use Cloud Functions API in production // For now, return empty array as Cloud Functions client requires additional setup try { // In production, would use: // const { CloudFunctionsServiceClient } = await import('@google-cloud/functions'); // this.functionsClient = new CloudFunctionsServiceClient(); // const parent = `projects/${this.projectId}/locations/-`; // const [functionList] = await this.functionsClient.listFunctions({ parent }); return []; } catch (error) { throw new Error(`Failed to list cloud functions: ${error instanceof Error ? error.message : String(error)}`); } }