get_subscription
Retrieve a Paddle subscription by ID to view details and optionally include previews of upcoming or recurring transactions.
Instructions
This tool will retrieve a subscription from Paddle by its ID.
Use the include parameter to include related entities in the response:
next_transaction: Include an object with a preview of the next transaction for this subscription. May include prorated charges that aren't yet billed and one-time charges.
recurring_transaction_details: Include an object with a preview of the recurring transaction for this subscription. This is what the customer can expect to be billed when there are no prorated or one-time charges.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subscriptionId | Yes | Paddle ID of the subscription. | |
| include | No | Include related entities in the response. Use a comma-separated list to specify multiple entities. |
Implementation Reference
- src/functions.ts:812-821 (handler)The handler function that implements the core logic of the 'get_subscription' tool. It retrieves a specific subscription using the Paddle SDK by subscription ID, optionally with additional query parameters, and handles errors by returning them.export const getSubscription = async (paddle: Paddle, params: z.infer<typeof Parameters.getSubscriptionParameters>) => { try { const { subscriptionId, ...queryParams } = params; const hasQueryParams = Object.keys(queryParams).length > 0; const subscription = await paddle.subscriptions.get(subscriptionId, hasQueryParams ? queryParams : undefined); return subscription; } catch (error) { return error; } };
- src/tools.ts:517-528 (schema)The tool schema definition in the tools array, specifying the method name, description, parameters schema (referencing params.getSubscriptionParameters), and required actions for the 'get_subscription' tool.{ method: "get_subscription", name: "Get a subscription", description: prompts.getSubscriptionPrompt, parameters: params.getSubscriptionParameters, actions: { subscriptions: { read: true, get: true, }, }, },
- src/api.ts:75-75 (registration)Registration of the getSubscription handler function in the toolMap object in PaddleAPI, mapping the TOOL_METHODS.GET_SUBSCRIPTION constant to the function for execution.[TOOL_METHODS.GET_SUBSCRIPTION]: funcs.getSubscription,
- src/constants.ts:67-67 (registration)Constant definition for the tool method name 'get_subscription' used in registration and tool definitions.GET_SUBSCRIPTION: "get_subscription",