get_product_rate_plan
Retrieve a specific product rate plan by its ID to view pricing and billing details for your subscription products.
Instructions
Get a rate plan by ID. GET /product-rateplans/{ratePlanId}. Rate plan reference: ratePlanId (URI: /product-rateplans/{ratePlanId}).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ratePlanId | Yes | Rate plan ID (URI: /product-rateplans/{ratePlanId}) | |
| include | No | Attributes to include |
Implementation Reference
- The get_product_rate_plan tool handler function. Parses args with zod schema (ratePlanId required, include optional), then calls ratePlanService.getRatePlan(client, ratePlanId, {include}) via handleToolCall.
async function handler(client: Client, args: Record<string, unknown> | undefined) { const parsed = schema.safeParse(args); if (!parsed.success) { return errorResult(parsed.error.errors.map((e) => e.message).join("; ")); } const { ratePlanId, include } = parsed.data; return handleToolCall(() => ratePlanService.getRatePlan(client, ratePlanId, { include })); } - Zod schema for get_product_rate_plan: validates ratePlanId (string, required) and include (string, optional).
const schema = z.object({ ratePlanId: z.string().min(1, "ratePlanId is required"), include: z.string().optional(), }); - Tool definition with name 'get_product_rate_plan', description, and inputSchema (JSON Schema format with ratePlanId string required, include string optional).
const definition = { name: "get_product_rate_plan", description: "Get a rate plan by ID. GET /product-rateplans/{ratePlanId}. Rate plan reference: ratePlanId (URI: /product-rateplans/{ratePlanId}).", inputSchema: { type: "object" as const, properties: { ratePlanId: { type: "string", description: "Rate plan ID (URI: /product-rateplans/{ratePlanId})" }, include: { type: "string", description: "Attributes to include" }, }, required: ["ratePlanId"], }, }; - src/tools/product_rate_plans/index.ts:15-25 (registration)Registration of getRatePlanTool within registerProductRatePlanTools(), which exports all 7 product rate plan tools as an array.
export function registerProductRatePlanTools(): Tool[] { return [ listRatePlansTool, getRatePlanTool, createRatePlanTool, updateRatePlanTool, deleteRatePlanTool, updateRatePlanStatusTool, syncRatePlanTool, ]; } - The actual API call: getRatePlan(client, ratePlanId, params) performs a GET request to /product-rateplans/{ratePlanId} with optional ?include= parameter.
export async function getRatePlan( client: Client, ratePlanId: string, params?: { include?: string } ): Promise<unknown> { const search = new URLSearchParams(); if (params?.include) search.append("include", params.include); const q = search.toString(); return client.get<unknown>(`/product-rateplans/${ratePlanId}${q ? `?${q}` : ""}`); }