get_product_rate_plan_charge
Retrieve a specific product rate plan charge by ID to get its detailed attributes and settings.
Instructions
Get a rate plan charge by ID. GET /product-rateplan-charges/{chargeId}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chargeId | Yes | Rate plan charge ID | |
| include | No | Attributes to include |
Implementation Reference
- Handler function for get_product_rate_plan_charge - parses args (chargeId, include), delegates to chargeService.getRatePlanCharge
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 { chargeId, include } = parsed.data; return handleToolCall(() => chargeService.getRatePlanCharge(client, chargeId, { include })); } - Zod schema validating chargeId (required string) and include (optional string)
const schema = z.object({ chargeId: z.string().min(1, "chargeId is required"), include: z.string().optional(), }); - src/tools/product_rate_plan_charges/index.ts:12-28 (registration)Tool registration - getRatePlanChargeTool is exported and included in the registerProductRatePlanChargeTools array
/** All 5 product rate plan charge tools. */ export function registerProductRatePlanChargeTools(): Tool[] { return [ listRatePlanChargesTool, getRatePlanChargeTool, createRatePlanChargeTool, updateRatePlanChargeTool, deleteRatePlanChargeTool, ]; } export { listRatePlanChargesTool } from "./listRatePlanCharges.js"; export { getRatePlanChargeTool } from "./getRatePlanCharge.js"; export { createRatePlanChargeTool } from "./createRatePlanCharge.js"; export { updateRatePlanChargeTool } from "./updateRatePlanCharge.js"; export { deleteRatePlanChargeTool } from "./deleteRatePlanCharge.js"; - src/tools/index.ts:49-57 (registration)executeTool dispatches by name - finds tool by definition.name matching 'get_product_rate_plan_charge'
export async function executeTool( name: string, args: Record<string, unknown> | undefined, client: RebilliaClient ): Promise<ToolResult | undefined> { const tool = tools.find((t) => t.definition.name === name); if (!tool) return undefined; return tool.handler(client, args); } - Service layer - makes the actual GET /product-rateplan-charges/{chargeId} API call
export async function getRatePlanCharge( client: Client, chargeId: 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-rateplan-charges/${chargeId}${q ? `?${q}` : ""}`); }