list_businesses
Retrieve and filter businesses for a specific Paddle customer, with options for pagination, search by name or tax details, and status filtering.
Instructions
This tool will list businesses for a customer in Paddle.
Use the maximum perPage by default (200) to ensure comprehensive results. Filter businesses by id, search (fuzzy search on the business's name or tax or VAT number), and status as needed. Results are paginated - use the 'after' parameter with the last ID from previous results to get the next page. Sort and order results using the orderBy parameter.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customerId | Yes | Paddle ID of the customer. | |
| after | No | Return entities after the specified Paddle ID when working with paginated endpoints. | |
| id | No | Return only the IDs specified. Use a comma-separated list to get multiple entities. | |
| orderBy | No | Order returned entities by the specified field and direction. | |
| perPage | No | Set how many entities are returned per page. Returns the maximum number of results if a number greater than the maximum is requested. | |
| search | No | Return entities that match a search query. Pass an exact match for the business's name or tax or VAT number. | |
| status | No | Return entities that match the specified status. Use a comma-separated list to specify multiple status values. |
Implementation Reference
- src/functions.ts:342-352 (handler)The handler function for the 'list_businesses' tool. It lists businesses associated with a customer using the Paddle SDK's businesses.list method, handles the first page of results, extracts pagination data, and returns the businesses with pagination info. Catches and returns any errors.export const listBusinesses = async (paddle: Paddle, params: z.infer<typeof Parameters.listBusinessesParameters>) => { try { const { customerId, ...queryParams } = params; const collection = paddle.businesses.list(customerId, queryParams); const businesses = await collection.next(); const pagination = paginationData(collection); return { pagination, businesses }; } catch (error) { return error; } };
- src/tools.ts:325-335 (schema)Tool schema definition including method name, description from prompts, Zod parameters schema reference (params.listBusinessesParameters), and required actions (read/list on businesses). This configures the tool for MCP usage.method: "list_businesses", name: "List businesses for a customer", description: prompts.listBusinessesPrompt, parameters: params.listBusinessesParameters, actions: { businesses: { read: true, list: true, }, }, },
- src/api.ts:37-37 (registration)Registers the 'list_businesses' tool by mapping the constant TOOL_METHODS.LIST_BUSINESSES to the handler function funcs.listBusinesses in the toolMap used by PaddleAPI.run().[TOOL_METHODS.LIST_BUSINESSES]: funcs.listBusinesses,
- src/constants.ts:29-29 (registration)Defines the constant TOOL_METHODS.LIST_BUSINESSES = 'list_businesses' used for tool identification in registrations and mappings.LIST_BUSINESSES: "list_businesses",
- src/functions.ts:10-13 (helper)Helper function to extract pagination metadata (hasMore, estimatedTotal) from Paddle's PaginatedCollection, used by the list_businesses handler and other list functions.const paginationData = (collection: PaginatedCollection) => ({ hasMore: collection.hasMore, estimatedTotal: collection.estimatedTotal, });