Skip to main content
Glama
krzko

Google Cloud MCP Server

by krzko

List Service SKUs

gcp-billing-list-skus

Retrieve pricing details and SKUs for Google Cloud services to analyze costs and plan budgets. Supports pagination and multiple currencies.

Instructions

List all SKUs (Stock Keeping Units) and pricing information for a Google Cloud service

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceIdYesGoogle Cloud service ID (e.g., 'services/6F81-5844-456A')
pageSizeNoMaximum number of SKUs to return (1-100)
pageTokenNoToken for pagination to get next page of results
currencyCodeNoCurrency code for pricing information (default: USD)USD

Implementation Reference

  • Handler function that lists SKUs for a specified Google Cloud service using the Cloud Billing Catalog API. Fetches SKUs, formats them with pricing info, categories, regions, and returns a markdown response with pagination support.
    async ({ serviceId, pageSize, pageToken, currencyCode }) => {
      try {
        const catalogClient = getCatalogClient();
    
        logger.debug(`Listing SKUs for service: ${serviceId}`);
    
        const request: any = {
          parent: serviceId,
          pageSize,
          currencyCode,
        };
    
        if (pageToken) {
          request.pageToken = pageToken;
        }
    
        const [skus, nextPageToken] = await catalogClient.listSkus(request);
    
        if (!skus || skus.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: `No SKUs found for service: ${serviceId}`,
              },
            ],
          };
        }
    
        let response = `# SKUs for Service\n\n`;
        response += `**Service:** ${serviceId}\n`;
        response += `**Currency:** ${currencyCode}\n`;
        response += `**SKUs Found:** ${skus.length}\n\n`;
    
        for (const skuData of skus) {
          const sku: SKU = {
            name: skuData.name || "",
            skuId: skuData.skuId || "Unknown",
            description: skuData.description || "Unknown SKU",
            category: {
              serviceDisplayName:
                skuData.category?.serviceDisplayName || "Unknown",
              resourceFamily: skuData.category?.resourceFamily || "Unknown",
              resourceGroup: skuData.category?.resourceGroup || "Unknown",
              usageType: skuData.category?.usageType || "Unknown",
            },
            serviceRegions: skuData.serviceRegions || [],
            pricingInfo: (skuData.pricingInfo || []).map((pi) => ({
              summary: pi.summary || "",
              pricingExpression: {
                usageUnit: pi.pricingExpression?.usageUnit || "",
                usageUnitDescription:
                  pi.pricingExpression?.usageUnitDescription || "",
                baseUnit: pi.pricingExpression?.baseUnit || "",
                baseUnitDescription:
                  pi.pricingExpression?.baseUnitDescription || "",
                baseUnitConversionFactor:
                  pi.pricingExpression?.baseUnitConversionFactor || 0,
                displayQuantity: pi.pricingExpression?.displayQuantity || 0,
                tieredRates: (pi.pricingExpression?.tieredRates || []).map(
                  (tr) => ({
                    startUsageAmount: tr.startUsageAmount || 0,
                    unitPrice: {
                      currencyCode: tr.unitPrice?.currencyCode || "USD",
                      units: String(tr.unitPrice?.units || "0"),
                      nanos: tr.unitPrice?.nanos || 0,
                    },
                  }),
                ),
              },
              currencyConversionRate: pi.currencyConversionRate || 1,
              effectiveTime:
                typeof pi.effectiveTime === "string"
                  ? pi.effectiveTime
                  : pi.effectiveTime
                    ? new Date().toISOString()
                    : "",
            })),
            serviceProviderName: skuData.serviceProviderName || "Unknown",
            geoTaxonomy: skuData.geoTaxonomy
              ? {
                  type: String(skuData.geoTaxonomy.type || "Unknown"),
                  regions: skuData.geoTaxonomy.regions || [],
                }
              : undefined,
          };
    
          response += `## ${sku.description}\n\n`;
          response += `**SKU ID:** ${sku.skuId}\n`;
          response += `**Service Provider:** ${sku.serviceProviderName}\n`;
          response += `**Category:**\n`;
          response += `- Service: ${sku.category.serviceDisplayName}\n`;
          response += `- Resource Family: ${sku.category.resourceFamily}\n`;
          response += `- Resource Group: ${sku.category.resourceGroup}\n`;
          response += `- Usage Type: ${sku.category.usageType}\n`;
    
          if (sku.serviceRegions.length > 0) {
            response += `**Regions:** ${sku.serviceRegions.join(", ")}\n`;
          }
    
          if (sku.geoTaxonomy) {
            response += `**Geographic Taxonomy:** ${sku.geoTaxonomy.type}\n`;
            if (sku.geoTaxonomy.regions.length > 0) {
              response += `**Geo Regions:** ${sku.geoTaxonomy.regions.join(", ")}\n`;
            }
          }
    
          if (sku.pricingInfo.length > 0) {
            response += `**Pricing Information:** ${sku.pricingInfo.length} pricing tier(s) available\n`;
          }
    
          response += "\n---\n\n";
        }
    
        if (nextPageToken) {
          response += `**Next Page Token:** ${nextPageToken}\n`;
          response += `Use this token with the same tool to get the next page of results.\n`;
        }
    
        return {
          content: [
            {
              type: "text",
              text: response,
            },
          ],
        };
      } catch (error: any) {
        logger.error(`Error listing SKUs: ${error.message}`);
        throw new GcpMcpError(
          `Failed to list SKUs: ${error.message}`,
          error.code || "UNKNOWN",
          error.status || 500,
        );
      }
  • Input schema definition using Zod for the gcp-billing-list-skus tool, specifying parameters like serviceId, pageSize, pageToken, and currencyCode.
    {
      title: "List Service SKUs",
      description:
        "List all SKUs (Stock Keeping Units) and pricing information for a Google Cloud service",
      inputSchema: {
        serviceId: z
          .string()
          .describe(
            "Google Cloud service ID (e.g., 'services/6F81-5844-456A')",
          ),
        pageSize: z
          .number()
          .min(1)
          .max(100)
          .default(20)
          .describe("Maximum number of SKUs to return (1-100)"),
        pageToken: z
          .string()
          .optional()
          .describe("Token for pagination to get next page of results"),
        currencyCode: z
          .string()
          .default("USD")
          .describe("Currency code for pricing information (default: USD)"),
      },
  • Registration of the gcp-billing-list-skus tool on the MCP server, including name, schema, and handler reference.
    server.registerTool(
      "gcp-billing-list-skus",
      {
        title: "List Service SKUs",
        description:
          "List all SKUs (Stock Keeping Units) and pricing information for a Google Cloud service",
        inputSchema: {
          serviceId: z
            .string()
            .describe(
              "Google Cloud service ID (e.g., 'services/6F81-5844-456A')",
            ),
          pageSize: z
            .number()
            .min(1)
            .max(100)
            .default(20)
            .describe("Maximum number of SKUs to return (1-100)"),
          pageToken: z
            .string()
            .optional()
            .describe("Token for pagination to get next page of results"),
          currencyCode: z
            .string()
            .default("USD")
            .describe("Currency code for pricing information (default: USD)"),
        },
      },
      async ({ serviceId, pageSize, pageToken, currencyCode }) => {
        try {
          const catalogClient = getCatalogClient();
    
          logger.debug(`Listing SKUs for service: ${serviceId}`);
    
          const request: any = {
            parent: serviceId,
            pageSize,
            currencyCode,
          };
    
          if (pageToken) {
            request.pageToken = pageToken;
          }
    
          const [skus, nextPageToken] = await catalogClient.listSkus(request);
    
          if (!skus || skus.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: `No SKUs found for service: ${serviceId}`,
                },
              ],
            };
          }
    
          let response = `# SKUs for Service\n\n`;
          response += `**Service:** ${serviceId}\n`;
          response += `**Currency:** ${currencyCode}\n`;
          response += `**SKUs Found:** ${skus.length}\n\n`;
    
          for (const skuData of skus) {
            const sku: SKU = {
              name: skuData.name || "",
              skuId: skuData.skuId || "Unknown",
              description: skuData.description || "Unknown SKU",
              category: {
                serviceDisplayName:
                  skuData.category?.serviceDisplayName || "Unknown",
                resourceFamily: skuData.category?.resourceFamily || "Unknown",
                resourceGroup: skuData.category?.resourceGroup || "Unknown",
                usageType: skuData.category?.usageType || "Unknown",
              },
              serviceRegions: skuData.serviceRegions || [],
              pricingInfo: (skuData.pricingInfo || []).map((pi) => ({
                summary: pi.summary || "",
                pricingExpression: {
                  usageUnit: pi.pricingExpression?.usageUnit || "",
                  usageUnitDescription:
                    pi.pricingExpression?.usageUnitDescription || "",
                  baseUnit: pi.pricingExpression?.baseUnit || "",
                  baseUnitDescription:
                    pi.pricingExpression?.baseUnitDescription || "",
                  baseUnitConversionFactor:
                    pi.pricingExpression?.baseUnitConversionFactor || 0,
                  displayQuantity: pi.pricingExpression?.displayQuantity || 0,
                  tieredRates: (pi.pricingExpression?.tieredRates || []).map(
                    (tr) => ({
                      startUsageAmount: tr.startUsageAmount || 0,
                      unitPrice: {
                        currencyCode: tr.unitPrice?.currencyCode || "USD",
                        units: String(tr.unitPrice?.units || "0"),
                        nanos: tr.unitPrice?.nanos || 0,
                      },
                    }),
                  ),
                },
                currencyConversionRate: pi.currencyConversionRate || 1,
                effectiveTime:
                  typeof pi.effectiveTime === "string"
                    ? pi.effectiveTime
                    : pi.effectiveTime
                      ? new Date().toISOString()
                      : "",
              })),
              serviceProviderName: skuData.serviceProviderName || "Unknown",
              geoTaxonomy: skuData.geoTaxonomy
                ? {
                    type: String(skuData.geoTaxonomy.type || "Unknown"),
                    regions: skuData.geoTaxonomy.regions || [],
                  }
                : undefined,
            };
    
            response += `## ${sku.description}\n\n`;
            response += `**SKU ID:** ${sku.skuId}\n`;
            response += `**Service Provider:** ${sku.serviceProviderName}\n`;
            response += `**Category:**\n`;
            response += `- Service: ${sku.category.serviceDisplayName}\n`;
            response += `- Resource Family: ${sku.category.resourceFamily}\n`;
            response += `- Resource Group: ${sku.category.resourceGroup}\n`;
            response += `- Usage Type: ${sku.category.usageType}\n`;
    
            if (sku.serviceRegions.length > 0) {
              response += `**Regions:** ${sku.serviceRegions.join(", ")}\n`;
            }
    
            if (sku.geoTaxonomy) {
              response += `**Geographic Taxonomy:** ${sku.geoTaxonomy.type}\n`;
              if (sku.geoTaxonomy.regions.length > 0) {
                response += `**Geo Regions:** ${sku.geoTaxonomy.regions.join(", ")}\n`;
              }
            }
    
            if (sku.pricingInfo.length > 0) {
              response += `**Pricing Information:** ${sku.pricingInfo.length} pricing tier(s) available\n`;
            }
    
            response += "\n---\n\n";
          }
    
          if (nextPageToken) {
            response += `**Next Page Token:** ${nextPageToken}\n`;
            response += `Use this token with the same tool to get the next page of results.\n`;
          }
    
          return {
            content: [
              {
                type: "text",
                text: response,
              },
            ],
          };
        } catch (error: any) {
          logger.error(`Error listing SKUs: ${error.message}`);
          throw new GcpMcpError(
            `Failed to list SKUs: ${error.message}`,
            error.code || "UNKNOWN",
            error.status || 500,
          );
        }
      },
    );
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions listing SKUs and pricing, but fails to describe key behaviors such as pagination handling (implied by 'pageToken' in schema but not explained), rate limits, authentication requirements, or error conditions. This leaves significant gaps for an agent to understand operational constraints.

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 a single, efficient sentence that directly states the tool's function without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It does not address behavioral aspects like pagination, error handling, or return format, which are critical for a tool with multiple parameters and no structured output documentation. This leaves the agent with insufficient context for reliable use.

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%, so the schema already documents all parameters thoroughly. The description adds no additional meaning beyond what the schema provides, such as examples of service IDs beyond the one given or clarification on currency code usage. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('all SKUs and pricing information for a Google Cloud service'), making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'gcp-billing-list-services' or 'gcp-billing-service-breakdown', which could cause confusion about when to use each tool.

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. With siblings like 'gcp-billing-list-services' and 'gcp-billing-service-breakdown' available, there is no indication of context, prerequisites, or exclusions to help an agent choose appropriately.

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/krzko/google-cloud-mcp'

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