get_client_side_token
Retrieve a client-side token by ID for initializing Paddle.js in sandbox or production environments, with status indicators for active or revoked tokens.
Instructions
This tool will retrieve a client-side token from Paddle by its ID.
The returned token field is the client-side token that needs to be provided when initializing Paddle.js. Can be exposed client-side safely. If it starts with:
test_: The token is a test token for a sandbox environment and shouldn't be used in production.
live_: The token is a live token for a production environment. It can be used to test too but Paddle.js checkouts require real cards.
Client-side tokens have a status:
active: Client-side token can be used to authenticate with Paddle.js.
revoked: Client-side token has been revoked and can no longer be used to authenticate with Paddle.js.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientTokenId | Yes | Paddle ID of the client-side token. |
Implementation Reference
- src/functions.ts:991-999 (handler)The handler function that implements the core logic for the 'get_client_side_token' tool. It takes a Paddle instance and parameters including clientTokenId, retrieves the client-side token using paddle.clientTokens.get, and returns it or any error.export const getClientSideToken = async (paddle: Paddle, params: z.infer<typeof Parameters.getClientSideTokenParameters>) => { try { const { clientTokenId } = params; const clientSideToken = await paddle.clientTokens.get(clientTokenId); return clientSideToken; } catch (error) { return error; } };
- src/tools.ts:998-1008 (schema)The schema definition for the MCP tool 'get_client_side_token', including method name, description prompt, parameters schema reference, and required actions (read and get on clientSideTokens).method: "get_client_side_token", name: "Get a client-side token", description: prompts.getClientSideTokenPrompt, parameters: params.getClientSideTokenParameters, actions: { clientSideTokens: { read: true, get: true, }, }, },
- src/api.ts:89-93 (registration)Registration of the getClientSideToken handler function in the toolMap object used by PaddleAPI to dispatch tool method calls to the appropriate handler.[TOOL_METHODS.LIST_CLIENT_SIDE_TOKENS]: funcs.listClientSideTokens, [TOOL_METHODS.CREATE_CLIENT_SIDE_TOKEN]: funcs.createClientSideToken, [TOOL_METHODS.GET_CLIENT_SIDE_TOKEN]: funcs.getClientSideToken, [TOOL_METHODS.REVOKE_CLIENT_SIDE_TOKEN]: funcs.revokeClientSideToken, };
- src/toolkit.ts:69-85 (registration)Dynamic registration of the tool in the MCP server via this.tool() call in the loop over tools array, mapping to PaddleAPI.run(tool.method, arg).this.tool( tool.method, tool.description, tool.parameters.shape, annotations, async (arg: unknown, _extra: unknown) => { const result = await this._paddle.run(tool.method, arg); return { content: [ { type: "text" as const, text: String(result), }, ], }; }, );
- src/constants.ts:83-83 (helper)Constant definition for the tool method string used in TOOL_METHODS and mappings.GET_CLIENT_SIDE_TOKEN: "get_client_side_token",