Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

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
NameRequiredDescriptionDefault
limitNoNumber of folders to retrieve (default: 10)
nameNoFilter folders by name
offsetNoOffset for pagination (default: 0)

Implementation Reference

  • 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, }; } }
  • 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', }, }, }, };
  • 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); }
  • 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', }, }, }, };

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/jonathan-politzki/smartlead-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server