Skip to main content
Glama

create_product_rate_plan

Create a product rate plan by specifying name, type (contract/ongoing/prepaid), and optional details like effective dates and commitment.

Instructions

Create a rate plan. POST /product-rateplans. Required: productId (product reference, URI: /products/{productId}), name, type (contract|ongoing|prepaid). Optional: description, effectiveStartDate, effectiveEndDate, minimumCommitment, image.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productIdYesProduct ID (URI: /products/{productId})
nameYesRate plan name
typeYesType: contract, ongoing, or prepaid
descriptionNoDescription
effectiveStartDateNoEffective start date
effectiveEndDateNoEffective end date
minimumCommitmentNoMinimum commitment
minimumCommitmentLengthNoMinimum commitment length
minimumCommitmentUnitNoMinimum commitment unit
changeStatusBasedOnChargeNoChange status based on charge
sourceTemplateIdNoSource template ID
imageNoImage

Implementation Reference

  • Handler function for the create_product_rate_plan tool. Parses input args with Zod schema, then calls ratePlanService.createRatePlan() to POST /product-rateplans.
    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.path.join(".")}: ${e.message}`).join("; "));
      }
      return handleToolCall(() => ratePlanService.createRatePlan(client, parsed.data));
    }
    
    export const createRatePlanTool: Tool = {
      definition,
      handler,
    };
  • Zod schema and inputSchema definition for create_product_rate_plan. Defines required fields: productId, name, type (contract|ongoing|prepaid). Optional fields: description, effectiveStartDate, effectiveEndDate, minimumCommitment, minimumCommitmentLength, minimumCommitmentUnit, changeStatusBasedOnCharge, sourceTemplateId, image.
    const schema = z.object({
      productId: z.number().int().positive("productId is required"),
      name: z.string().min(1, "name is required"),
      type: z.enum(["contract", "ongoing", "prepaid"], {
        errorMap: () => ({ message: "type must be contract, ongoing, or prepaid" }),
      }),
      description: z.string().optional(),
      effectiveStartDate: z.string().optional(),
      effectiveEndDate: z.string().optional(),
      minimumCommitment: z.boolean().optional(),
      minimumCommitmentLength: z.number().optional(),
      minimumCommitmentUnit: z.string().optional(),
      changeStatusBasedOnCharge: z.boolean().optional(),
      sourceTemplateId: z.number().optional(),
      image: z.string().optional(),
    });
    
    const definition = {
      name: "create_product_rate_plan",
      description:
        "Create a rate plan. POST /product-rateplans. Required: productId (product reference, URI: /products/{productId}), name, type (contract|ongoing|prepaid). Optional: description, effectiveStartDate, effectiveEndDate, minimumCommitment, image.",
      inputSchema: {
        type: "object" as const,
        properties: {
          productId: { type: "number", description: "Product ID (URI: /products/{productId})" },
          name: { type: "string", description: "Rate plan name" },
          type: { type: "string", description: "Type: contract, ongoing, or prepaid" },
          description: { type: "string", description: "Description" },
          effectiveStartDate: { type: "string", description: "Effective start date" },
          effectiveEndDate: { type: "string", description: "Effective end date" },
          minimumCommitment: { type: "boolean", description: "Minimum commitment" },
          minimumCommitmentLength: { type: "number", description: "Minimum commitment length" },
          minimumCommitmentUnit: { type: "string", description: "Minimum commitment unit" },
          changeStatusBasedOnCharge: { type: "boolean", description: "Change status based on charge" },
          sourceTemplateId: { type: "number", description: "Source template ID" },
          image: { type: "string", description: "Image" },
        },
        required: ["productId", "name", "type"],
      },
    };
  • Registration: registerProductRatePlanTools() returns an array including createRatePlanTool. The tool is exported from createRatePlan.ts and aggregated here.
    /** All 7 product rate plan tools. */
    export function registerProductRatePlanTools(): Tool[] {
      return [
        listRatePlansTool,
        getRatePlanTool,
        createRatePlanTool,
        updateRatePlanTool,
        deleteRatePlanTool,
        updateRatePlanStatusTool,
        syncRatePlanTool,
      ];
    }
  • Top-level tool registry: create_product_rate_plan is registered via registerProductRatePlanTools() which includes createRatePlanTool.
    const tools: Tool[] = [
      ...registerCustomerTools(),
      ...registerProductTools(),
      ...registerProductRatePlanTools(),
      ...registerProductRatePlanChargeTools(),
      ...registerSubscriptionTools(),
      ...registerInvoiceTools(),
      ...registerTransactionTools(),
      ...registerBillRunTools(),
      ...registerGatewayTools(),
      ...registerCurrencyTools(),
      ...registerIntegrationTools(),
      ...registerShippingTools(),
      ...registerFilterTools(),
      ...registerDocsTools(),
    ];
    
    /** All tool definitions for tools/list */
    export function getToolDefinitions(): ToolDefinition[] {
      return tools.map((t) => t.definition);
    }
    
    /** Execute a tool by name. Returns result or undefined if tool not found. */
    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 function createRatePlan() that POSTs to /product-rateplans with the CreateRatePlanBody payload. This is the underlying API call.
    export async function createRatePlan(
      client: Client,
      body: CreateRatePlanBody
    ): Promise<unknown> {
      return client.post<unknown>("/product-rateplans", body);
    }
Behavior2/5

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

With no annotations, the description carries the transparency burden. It only states creation and lists parameters, omitting behavioral details like side effects, idempotency, permissions, or what happens on failure. For a mutation tool, this is insufficient.

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?

The description is two sentences: first stating the action and endpoint, second listing required and optional parameters. It is front-loaded, efficient, and contains no extraneous information.

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?

Despite good purpose clarity, the description lacks completeness for a creation tool with 12 parameters and no output schema. Missing details include return value (e.g., created object ID), error conditions, prerequisite existence checks, and interaction with sibling tools.

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%, so the baseline is 3. The description repeats required and optional fields from the schema but adds minimal context, such as the URI format for productId and allowed type values. No significant 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 'Create a rate plan' with the HTTP endpoint 'POST /product-rateplans', and specifies required fields. This distinguishes it from siblings like 'create_product_rate_plan_charge' which creates charges, not rate plans.

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 'create_product_rate_plan_charge' or when not to use it. There is no mention of prerequisites, such as the existence of the product, or error conditions.

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