Skip to main content
Glama

create_subscription

Create a subscription by supplying product rate plan, customer, payment method, billing address, and effective start date.

Instructions

Create a subscription from a product rate plan. POST /subscriptions/from-product-rateplan. Required: productRatePlanId, customerId, customerPaymentMethodId, billingAddressId, effectiveStartDate.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productRatePlanIdYesProduct rate plan ID
customerIdYesCustomer ID
customerPaymentMethodIdYesCustomer payment method ID
billingAddressIdYesBilling address ID
effectiveStartDateYesEffective start date YYYY-MM-DD

Implementation Reference

  • The handler function that executes the create_subscription tool logic. It validates args using Zod schema, then calls subscriptionService.createSubscriptionFromProductRatePlan.
    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("; "));
      }
    
      const payload = parsed.data;
      return handleToolCall(() => subscriptionService.createSubscriptionFromProductRatePlan(client, payload));
    }
  • Input validation schema for create_subscription using Zod. Validates productRatePlanId, customerId, customerPaymentMethodId, billingAddressId (positive integers) and effectiveStartDate (YYYY-MM-DD format string).
    const dateSchema = z
      .string()
      .regex(/^\d{4}-\d{2}-\d{2}$/, "effectiveStartDate must be in YYYY-MM-DD format");
    
    const definition = {
      name: "create_subscription",
      description:
        "Create a subscription from a product rate plan. POST /subscriptions/from-product-rateplan. Required: productRatePlanId, customerId, customerPaymentMethodId, billingAddressId, effectiveStartDate.",
      inputSchema: {
        type: "object" as const,
        properties: {
          productRatePlanId: { type: "number", description: "Product rate plan ID" },
          customerId: { type: "number", description: "Customer ID" },
          customerPaymentMethodId: { type: "number", description: "Customer payment method ID" },
          billingAddressId: { type: "number", description: "Billing address ID" },
          effectiveStartDate: { type: "string", description: "Effective start date YYYY-MM-DD" },
        },
        required: ["productRatePlanId", "customerId", "customerPaymentMethodId", "billingAddressId", "effectiveStartDate"],
      },
    };
    
    const schema = z.object({
      productRatePlanId: z.number().int().positive("productRatePlanId is required"),
      customerId: z.number().int().positive("customerId is required"),
      customerPaymentMethodId: z.number().int().positive("customerPaymentMethodId is required"),
      billingAddressId: z.number().int().positive("billingAddressId is required"),
      effectiveStartDate: dateSchema,
    });
  • MCP tool definition (name, description, JSON Schema input schema) for create_subscription, used for tools/list responses. All 5 fields are required.
    const definition = {
      name: "create_subscription",
      description:
        "Create a subscription from a product rate plan. POST /subscriptions/from-product-rateplan. Required: productRatePlanId, customerId, customerPaymentMethodId, billingAddressId, effectiveStartDate.",
      inputSchema: {
        type: "object" as const,
        properties: {
          productRatePlanId: { type: "number", description: "Product rate plan ID" },
          customerId: { type: "number", description: "Customer ID" },
          customerPaymentMethodId: { type: "number", description: "Customer payment method ID" },
          billingAddressId: { type: "number", description: "Billing address ID" },
          effectiveStartDate: { type: "string", description: "Effective start date YYYY-MM-DD" },
        },
        required: ["productRatePlanId", "customerId", "customerPaymentMethodId", "billingAddressId", "effectiveStartDate"],
      },
    };
  • The underlying service function createSubscriptionFromProductRatePlan that makes the POST /subscriptions/from-product-rateplan API call.
    export async function createSubscriptionFromProductRatePlan(
      client: Client,
      body: CreateSubscriptionFromProductRatePlanBody
    ): Promise<unknown> {
      return client.post<unknown>("/subscriptions/from-product-rateplan", body);
    }
  • Registration of createSubscriptionTool in the subscription tools array returned by registerSubscriptionTools(), which is consumed in src/tools/index.ts.
    /** 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 present, so the description carries the full burden. It mentions the POST endpoint and required fields but fails to disclose important behavioral aspects such as idempotency, side effects (e.g., billing triggers), permission requirements, or what the response contains. This is minimal for a creation 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 concise with two sentences: one for purpose and endpoint, one listing required fields. It is front-loaded and efficient, though it could be slightly more structured for readability (e.g., bullet points).

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?

Given no output schema and no annotations, the description is incomplete. It does not explain the outcome of the call, error conditions, next steps, or prerequisites. Among a large set of siblings, it barely differentiates beyond the basic action.

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 lists the required field names but does not add any additional meaning beyond the schema's descriptions. For example, it doesn't explain relationships between parameters or constraints like date format validation.

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 'Create a subscription from a product rate plan' and gives the HTTP endpoint, distinguishing it from sibling tools like add_subscription_rate_plan (which adds to an existing subscription) and get_subscription (read). The required fields are listed, making the purpose unambiguous.

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?

The description implies usage for initial subscription creation from a product rate plan, but it does not explicitly state when to use this over alternatives like add_subscription_rate_plan or update_subscription. No guidance on prerequisites or exclusions is provided.

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