Skip to main content
Glama
ahmedselimmansor-ctrl

IBM Cloud MCP Server

billing_get_resource_usage

Retrieve billing usage for a specific resource group by providing the resource group ID and month.

Instructions

Get usage for a specific resource group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idNo
resource_group_idYes
monthYes

Implementation Reference

  • The handler for billing_get_resource_usage. It calls the IBM Cloud Billing API v4 endpoint to get usage for a specific resource group. Accepts optional account_id, required resource_group_id, and month (YYYY-MM). Delegates to IBMCloudAPIClient.get() wrapped in safeTool().
    server.tool("billing_get_resource_usage", "Get usage for a specific resource group", {
      account_id: z.string().optional(), resource_group_id: z.string(), month: z.string(),
    }, async (p) => safeTool(async () => {
      const acctId = p.account_id || await client.getAuth().getAccountId();
      return client.get(`${base}/accounts/${acctId}/resource_groups/${p.resource_group_id}/usage/${p.month}`);
    }));
  • Zod schema defining inputs for billing_get_resource_usage: account_id (optional string), resource_group_id (required string), month (required string in YYYY-MM format).
    account_id: z.string().optional(), resource_group_id: z.string(), month: z.string(),
  • Registration of the billing_get_resource_usage tool on the MCP server via server.tool() within the registerBillingTools function.
    server.tool("billing_get_resource_usage", "Get usage for a specific resource group", {
      account_id: z.string().optional(), resource_group_id: z.string(), month: z.string(),
    }, async (p) => safeTool(async () => {
      const acctId = p.account_id || await client.getAuth().getAccountId();
      return client.get(`${base}/accounts/${acctId}/resource_groups/${p.resource_group_id}/usage/${p.month}`);
    }));
  • The safeTool helper wraps the handler to catch errors and return proper MCP responses (successContent or errorContent).
    export async function safeTool<T>(fn: () => Promise<T>): Promise<ReturnType<typeof successContent> | ReturnType<typeof errorContent>> {
      try {
        const result = await fn();
        return successContent(result);
      } catch (error) {
        return errorContent(error);
      }
    }
  • The IBMCloudAPIClient.get() method used by the handler to make the authenticated GET request to the Billing API endpoint.
    async get<T = unknown>(url: string, queryParams?: Record<string, string | number | boolean | undefined>): Promise<T> {
      return this.request<T>(url, { method: "GET", queryParams });
    }
Behavior2/5

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

With no annotations, the description must disclose behavior. It only states the purpose, omitting details like idempotency, required permissions, or side effects. No contradictions with annotations since none exist.

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 sentence, concise but lacking structure. It does not waste words but also does not expand on key details.

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 tool has three parameters and no output schema, the description is insufficient. It does not indicate return format, pagination, or data scope necessary for an agent to correctly interpret results.

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

Parameters1/5

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

Schema description coverage is 0%, and the description fails to explain the three parameters (account_id, resource_group_id, month). It does not clarify required vs optional, format, or role of each parameter.

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 the resource (usage for a specific resource group). It distinguishes from sibling tools like billing_get_account_usage or billing_get_org_usage by specifying the resource group scope.

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?

No guidance on when to use this tool versus alternatives like billing_list_resource_instances_usage. No prerequisites or context for usage are provided.

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/ahmedselimmansor-ctrl/IBM_cloud_MCP_SERVER'

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