Skip to main content
Glama

get_usage

Read-onlyIdempotent

Retrieve BubblyPhone usage data showing call counts, minutes, call costs, and number costs for specified months to track telephony spending and activity volumes.

Instructions

Get usage statistics for a time period — inbound/outbound call counts, minutes, costs, and number costs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNoMonth in YYYY-MM format (default: current month)

Implementation Reference

  • The handler function for get_usage tool - receives params, builds query object with period if provided, and calls the billing/usage API endpoint
    async (params) => {
      const query: Record<string, string> = {};
      if (params.period) query.period = params.period;
      return callTool(() => client.get("/billing/usage", query));
    }
  • Input schema for get_usage tool using Zod - defines optional 'period' parameter for month in YYYY-MM format
    inputSchema: {
      period: z.string().optional().describe("Month in YYYY-MM format (default: current month)"),
    },
  • Registration of the get_usage tool with MCP server including name, description, schema, annotations, and handler
    server.registerTool(
      "get_usage",
      {
        description: "Get usage statistics for a time period — inbound/outbound call counts, minutes, costs, and number costs.",
        inputSchema: {
          period: z.string().optional().describe("Month in YYYY-MM format (default: current month)"),
        },
        annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
      },
      async (params) => {
        const query: Record<string, string> = {};
        if (params.period) query.period = params.period;
        return callTool(() => client.get("/billing/usage", query));
      }
    );
  • Helper function callTool that wraps API calls with error handling - returns tool result on success or toolError on ApiError
    async function callTool<T>(fn: () => Promise<T>) {
      try {
        return toolResult(await fn());
      } catch (err) {
        const apiErr = err as ApiError;
        return toolError(`API error (${apiErr.status}): ${apiErr.message}`);
      }
    }
  • BubblyPhoneClient.get method used by get_usage handler - constructs URL with query params and makes authenticated GET request
    async get<T = unknown>(path: string, params?: Record<string, string>): Promise<T> {
      const url = new URL(`${this.baseUrl}${path}`);
      if (params) {
        for (const [key, value] of Object.entries(params)) {
          if (value !== undefined && value !== "") {
            url.searchParams.set(key, value);
          }
        }
      }
      return this.request<T>(url.toString(), { method: "GET" });
    }
Behavior4/5

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

Annotations cover safety (readOnly, non-destructive, idempotent). The description adds valuable behavioral context by detailing exactly what statistics are returned (call counts, minutes, costs, number costs), compensating for the missing output schema.

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?

Single sentence with zero waste. Front-loaded with action verb, uses em-dash efficiently to enumerate return values. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (single optional parameter) and rich annotations, the description is nearly complete. It effectively compensates for the lack of output schema by listing return value fields. Could mention default behavior (current month) but schema covers this.

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 coverage is 100% (the 'period' parameter is fully documented as 'Month in YYYY-MM format'). The description mentions 'for a time period' which aligns with the parameter but adds no additional syntax or semantic details beyond the schema. Baseline 3 appropriate for high schema coverage.

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?

Clear verb ('Get') + resource ('usage statistics') with specific data points listed (call counts, minutes, costs). Implicitly distinguishes from siblings like get_balance (current funds) and list_calls (individual records) by specifying aggregated statistics, though it doesn't explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or when-not-to-use guidance. An agent might confuse this with get_balance for cost inquiries or list_calls for call history. However, the specificity of 'inbound/outbound call counts, minutes, costs' implies this is for aggregated reporting over time periods.

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/JobXDubai/mcp-server'

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