Skip to main content
Glama

update_subscription_rate_plan

Update a subscription rate plan by changing its name, type, effective start date, or enabling automatic status changes based on charges.

Instructions

Update a rate plan on a subscription. PUT /subscriptions/{subscriptionId}/rateplans/{ratePlanId}. Optional: name, type (contract|ongoing|prepaid), effectiveStartDate, changeStatusBasedOnCharge.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subscriptionIdYesSubscription ID (required)
ratePlanIdYesSubscription rate plan ID (required)
nameNoName
typeNocontract, ongoing, or prepaid
effectiveStartDateNoYYYY-MM-DD
changeStatusBasedOnChargeNoChange status based on charge

Implementation Reference

  • The handler function that executes the tool logic. It parses arguments with zod, extracts subscriptionId and ratePlanId, and calls the subscription service to perform the update.
    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 { subscriptionId, ratePlanId, ...body } = parsed.data;
      return handleToolCall(() =>
        subscriptionService.updateSubscriptionRatePlan(client, subscriptionId, ratePlanId, body)
      );
    }
    
    export const updateSubscriptionRatePlanTool: Tool = {
      definition,
      handler,
    };
  • Zod schema validating the tool's input: subscriptionId (required), ratePlanId (required), name, type, effectiveStartDate, changeStatusBasedOnCharge (all optional).
    const schema = z.object({
      subscriptionId: z.string().min(1, "subscriptionId is required"),
      ratePlanId: z.string().min(1, "ratePlanId is required"),
      name: z.string().optional(),
      type: z.enum(["contract", "ongoing", "prepaid"]).optional(),
      effectiveStartDate: z.string().optional(),
      changeStatusBasedOnCharge: z.boolean().optional(),
    });
  • Exports the Tool object combining the definition and handler, which is registered in the subscription tools index.
    export const updateSubscriptionRatePlanTool: Tool = {
      definition,
      handler,
    };
  • The UpdateSubscriptionRatePlanBody interface definition and the service function that sends a PUT request to /subscriptions/{subscriptionId}/rateplans/{ratePlanId}, filtering out undefined values.
    export interface UpdateSubscriptionRatePlanBody {
      name?: string;
      type?: "contract" | "ongoing" | "prepaid";
      effectiveStartDate?: string;
      changeStatusBasedOnCharge?: boolean;
      [k: string]: unknown;
    }
    
    export async function updateSubscriptionRatePlan(
      client: Client,
      subscriptionId: string,
      ratePlanId: string,
      body: UpdateSubscriptionRatePlanBody
    ): Promise<unknown> {
      const payload = Object.fromEntries(
        Object.entries(body).filter(([, v]) => v !== undefined)
      ) as UpdateSubscriptionRatePlanBody;
      return client.put<unknown>(
        `/subscriptions/${subscriptionId}/rateplans/${ratePlanId}`,
        Object.keys(payload).length ? payload : undefined
      );
    }
  • The tool is imported and included in the registerSubscriptionTools() array, registering it for use.
    import { updateSubscriptionRatePlanTool } from "./updateSubscriptionRatePlan.js";
    import { updateSubscriptionStatusTool } from "./updateSubscriptionStatus.js";
    import { updateSubscriptionTool } from "./updateSubscription.js";
    
    /** All 19 subscription tools. */
    export function registerSubscriptionTools(): Tool[] {
      return [
        listSubscriptionsTool,
        getSubscriptionTool,
        createSubscriptionTool,
        updateSubscriptionTool,
        deleteSubscriptionTool,
        updateSubscriptionStatusTool,
        getSubscriptionUpcomingChargesTool,
        getSubscriptionInvoicesTool,
        getSubscriptionLogsTool,
        getSubscriptionExternalInvoicesTool,
        listSubscriptionRatePlansTool,
        getSubscriptionRatePlanTool,
        addSubscriptionRatePlanTool,
        updateSubscriptionRatePlanTool,
        removeSubscriptionRatePlanTool,
        getSubscriptionRatePlanChargeTool,
        addSubscriptionRatePlanChargeTool,
        updateSubscriptionRatePlanChargeTool,
        removeSubscriptionRatePlanChargeTool,
      ];
    }
Behavior2/5

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

No annotations are provided, and the description only states it's a PUT operation. It does not disclose any side effects, permissions required, or whether the update is reversible. More behavioral context is needed for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one sentence plus a list of optional fields. It is concise and front-loaded with the main purpose, though it could be more structured (e.g., separating required and optional info).

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

Completeness3/5

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

With 6 parameters, no output schema, and no annotations, the description is adequate for a typical update operation. It covers the basic purpose and optional fields but lacks guidance on return values or behavioral impacts.

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 baseline is 3. The description repeats the optional fields and adds enum values for 'type' (contract|ongoing|prepaid), providing some extra meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update a rate plan on a subscription') and provides the HTTP method and path, distinguishing it from sibling tools like add_subscription_rate_plan and remove_subscription_rate_plan.

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?

While the description lists optional parameters, it does not provide explicit guidance on when to use this tool versus alternatives (e.g., add vs update). The purpose is clear, but no contextual usage hints are given.

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

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