Skip to main content
Glama

get-billing-info

Retrieve billing details for Google Cloud Platform projects to monitor costs and manage cloud spending.

Instructions

Get billing information for the current project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoProject ID to get billing info for (defaults to selected project)

Implementation Reference

  • Handler function that executes the 'get-billing-info' tool: parses input, checks selected project, uses CloudBillingClient to fetch project billing info and account details, handles errors, returns JSON response.
    } else if (name === "get-billing-info") {
      const { projectId } = GetBillingInfoSchema.parse(args);
      const targetProject = projectId || selectedProject;
      
      if (!targetProject) {
        return createTextResponse("No project selected. Please select a project first.");
      }
    
      try {
        const billingClient = new CloudBillingClient();
        const [billingInfo] = await billingClient.getProjectBillingInfo({
          name: `projects/${targetProject}`
        });
    
        if (!billingInfo.billingEnabled) {
          return createTextResponse("Billing is not enabled for this project.");
        }
    
        const billingAccount = billingInfo.billingAccountName;
        if (!billingAccount) {
          return createTextResponse("No billing account associated with this project.");
        }
    
        // Get billing account details
        const [account] = await billingClient.getBillingAccount({
          name: billingAccount
        });
    
        return createTextResponse(JSON.stringify({
          projectId: targetProject,
          billingEnabled: billingInfo.billingEnabled,
          billingAccountName: billingAccount,
          displayName: account.displayName,
          open: account.open
        }, null, 2));
      } catch (error: any) {
        console.error('Error getting billing info:', error);
        if (error.code === 7) {
          return createTextResponse("Error: Cloud Billing API is not enabled. Please enable it in the Google Cloud Console.");
        }
        return createTextResponse(`Error getting billing info: ${error.message}`);
      }
  • index.ts:125-138 (registration)
    Registration of the 'get-billing-info' tool in the list-tools handler, defining its name, description, and input schema.
    {
      name: "get-billing-info",
      description: "Get billing information for the current project",
      inputSchema: {
        type: "object",
        properties: {
          projectId: {
            type: "string",
            description: "Project ID to get billing info for (defaults to selected project)",
          },
        },
        required: [],
      },
    },
  • Zod validation schema for the input arguments of the 'get-billing-info' tool.
    const GetBillingInfoSchema = z.object({
      projectId: z.string().optional(),
    });
  • Import of CloudBillingClient used in the get-billing-info handler.
    import { CloudBillingClient } from '@google-cloud/billing';
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool 'Get's information, implying a read-only operation, but doesn't clarify permissions needed, rate limits, error conditions, or response format. This is a significant gap for a tool that likely accesses sensitive billing data.

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 purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy for an agent 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 doesn't explain what billing information is returned (e.g., costs, invoices, usage details), potential authentication needs, or how it interacts with sibling tools. For a billing-related tool, this leaves critical context gaps.

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 the single parameter 'projectId' with its default behavior. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints, resulting in a baseline score.

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 action ('Get') and resource ('billing information for the current project'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get-billing-budget' or 'get-cost-forecast', which likely provide related but different billing data, preventing a perfect 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 minimal guidance, implying usage for retrieving billing info but not specifying when to use this tool versus alternatives like 'get-billing-budget' or 'get-cost-forecast'. No explicit when/when-not instructions or prerequisites are included, 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

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/RadiumGu/gcp-ops-mcp'

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