smartlead_get_all_folders
Retrieve a list of all email marketing folders with their details and contained tests, enabling organized management of campaign assets.
Instructions
Get the list and details of all folders created in Smart Delivery along with tests inside each folder.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of folders to retrieve (default: 10) | |
| name | No | Filter folders by name | |
| offset | No | Offset for pagination (default: 0) |
Implementation Reference
- src/handlers/smartDelivery.ts:1083-1129 (handler)The handler function that validates input parameters using isGetAllFoldersParams, constructs a SmartDelivery API client, builds query parameters for limit, offset, and optional name filter, fetches folders from `/spam-test/folder`, and returns formatted JSON response or error message.async function handleGetAllFolders( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isGetAllFoldersParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_get_all_folders' ); } try { const smartDeliveryClient = createSmartDeliveryClient(apiClient); const { limit = 10, offset = 0, name = '' } = args; const queryParams = new URLSearchParams(); queryParams.append('limit', limit.toString()); queryParams.append('offset', offset.toString()); if (name) { queryParams.append('name', name); } const response = await withRetry( async () => smartDeliveryClient.get(`/spam-test/folder?${queryParams.toString()}`), 'get all folders' ); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], isError: false, }; } catch (error: any) { return { content: [{ type: 'text', text: `API Error: ${error.response?.data?.message || error.message}` }], isError: true, }; } }
- src/tools/smartDelivery.ts:509-530 (schema)Defines the tool metadata including name, description, category, and input schema for parameters limit (integer), offset (integer), and optional name (string). This schema is used for validation.export const GET_ALL_FOLDERS_TOOL: CategoryTool = { name: 'smartlead_get_all_folders', description: 'Get the list and details of all folders created in Smart Delivery along with tests inside each folder.', category: ToolCategory.SMART_DELIVERY, inputSchema: { type: 'object', properties: { limit: { type: 'integer', description: 'Number of folders to retrieve (default: 10)', }, offset: { type: 'integer', description: 'Offset for pagination (default: 0)', }, name: { type: 'string', description: 'Filter folders by name', }, }, }, };
- src/handlers/smartDelivery.ts:113-115 (registration)The switch case in the main SmartDelivery tool dispatcher that routes calls to 'smartlead_get_all_folders' to the handleGetAllFolders function.case 'smartlead_get_all_folders': { return handleGetAllFolders(args, apiClient, withRetry); }
- src/tools/smartDelivery.ts:509-530 (registration)The tool definition exported and included in the smartDeliveryTools array for registration in the MCP tool registry.export const GET_ALL_FOLDERS_TOOL: CategoryTool = { name: 'smartlead_get_all_folders', description: 'Get the list and details of all folders created in Smart Delivery along with tests inside each folder.', category: ToolCategory.SMART_DELIVERY, inputSchema: { type: 'object', properties: { limit: { type: 'integer', description: 'Number of folders to retrieve (default: 10)', }, offset: { type: 'integer', description: 'Offset for pagination (default: 0)', }, name: { type: 'string', description: 'Filter folders by name', }, }, }, };