Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_fetch_all_clients

Retrieve a complete list of all clients stored in the Smartlead system to manage email marketing campaigns and client relationships.

Instructions

Retrieve a list of all clients in the system.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core implementation of the smartlead_fetch_all_clients tool. Validates input parameters, creates a SmartLead API client, fetches all clients via GET /client/, formats response as JSON text, handles API errors.
    async function handleFetchAllClients(
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isFetchAllClientsParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_fetch_all_clients'
        );
      }
    
      try {
        const smartLeadClient = createSmartLeadClient(apiClient);
        
        const response = await withRetry(
          async () => smartLeadClient.get('/client/'),
          'fetch all clients'
        );
    
        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, description, category, and input schema (no required parameters).
    export const FETCH_ALL_CLIENTS_TOOL: CategoryTool = {
      name: 'smartlead_fetch_all_clients',
      description: 'Retrieve a list of all clients in the system.',
      category: ToolCategory.CLIENT_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          // This endpoint doesn't require specific parameters beyond the API key
          // which is handled at the API client level
        },
        required: [],
      },
    };
  • src/index.ts:227-229 (registration)
    Registers the clientManagementTools array (containing smartlead_fetch_all_clients) to the central ToolRegistry if the clientManagement category is enabled.
    if (enabledCategories.clientManagement) {
      toolRegistry.registerMany(clientManagementTools);
    }
  • Category-level dispatcher that routes smartlead_fetch_all_clients calls to the specific handleFetchAllClients implementation.
    export async function handleClientManagementTool(
      toolName: string,
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      switch (toolName) {
        case 'smartlead_add_client': {
          return handleAddClient(args, apiClient, withRetry);
        }
        case 'smartlead_fetch_all_clients': {
          return handleFetchAllClients(args, apiClient, withRetry);
        }
        default:
          throw new Error(`Unknown Client Management tool: ${toolName}`);
      }
    }
  • Helper function that adapts the main Axios client to use SmartLead's API base URL for client management endpoints.
    function createSmartLeadClient(apiClient: AxiosInstance) {
      return {
        get: (url: string, config?: any) => 
          apiClient.get(`${SMARTLEAD_API_URL}${url}`, config),
        post: (url: string, data?: any, config?: any) => 
          apiClient.post(`${SMARTLEAD_API_URL}${url}`, data, config),
        put: (url: string, data?: any, config?: any) => 
          apiClient.put(`${SMARTLEAD_API_URL}${url}`, data, config),
        delete: (url: string, config?: any) => 
          apiClient.delete(`${SMARTLEAD_API_URL}${url}`, config)
      };
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

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