Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_add_client

Add a new client to the Smartlead email marketing system with configurable permissions and optional white-label branding settings.

Instructions

Add a new client to the system, optionally with white-label settings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesEmail address of the client
logoNoLogo text or identifier
logo_urlNoURL to the client's logo image
nameYesName of the client
passwordYesPassword for the client's account
permissionYesArray of permissions to grant to the client. Use ["full_access"] for full permissions.

Implementation Reference

  • Core handler function that validates input parameters using isAddClientParams, creates a SmartLead API client proxy, performs POST request to '/client/save' endpoint with retry logic, and returns formatted API response or error.
    async function handleAddClient(
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isAddClientParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_add_client'
        );
      }
    
      try {
        const smartLeadClient = createSmartLeadClient(apiClient);
        
        const response = await withRetry(
          async () => smartLeadClient.post('/client/save', args),
          'add client'
        );
    
        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,
        };
      }
    }
  • TypeScript interface defining input parameters for smartlead_add_client and runtime type guard (isAddClientParams) for validation.
    export interface AddClientParams {
      name: string;
      email: string;
      permission: ClientPermission[];
      logo?: string;
      logo_url?: string | null;
      password: string;
    }
    
    // Fetch all clients
    export interface FetchAllClientsParams {
      // This endpoint doesn't require specific parameters beyond the API key
      // which is handled at the API client level
    }
    
    // Type guards
    export function isAddClientParams(args: unknown): args is AddClientParams {
      if (typeof args !== 'object' || args === null) return false;
      
      const params = args as Partial<AddClientParams>;
      
      return (
        typeof params.name === 'string' &&
        typeof params.email === 'string' &&
        Array.isArray(params.permission) &&
        params.permission.every(perm => typeof perm === 'string') &&
        typeof params.password === 'string' &&
        (params.logo === undefined || typeof params.logo === 'string') &&
        (params.logo_url === undefined || params.logo_url === null || typeof params.logo_url === 'string')
      );
    }
  • MCP tool definition including JSON input schema for smartlead_add_client parameters.
    export const ADD_CLIENT_TOOL: CategoryTool = {
      name: 'smartlead_add_client',
      description: 'Add a new client to the system, optionally with white-label settings.',
      category: ToolCategory.CLIENT_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the client',
          },
          email: {
            type: 'string',
            description: 'Email address of the client',
          },
          permission: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of permissions to grant to the client. Use ["full_access"] for full permissions.',
          },
          logo: {
            type: 'string',
            description: 'Logo text or identifier',
          },
          logo_url: {
            type: ['string', 'null'],
            description: 'URL to the client\'s logo image',
          },
          password: {
            type: 'string',
            description: 'Password for the client\'s account',
          },
        },
        required: ['name', 'email', 'permission', 'password'],
      },
    };
  • src/index.ts:226-229 (registration)
    Registers the clientManagementTools array (including smartlead_add_client) to the tool registry if clientManagement category is enabled.
    // Register client management tools if enabled
    if (enabledCategories.clientManagement) {
      toolRegistry.registerMany(clientManagementTools);
    }
  • Dispatcher function for client management tools that routes 'smartlead_add_client' calls to the specific handleAddClient 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}`);
      }
    }

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