Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_folder_by_id

Retrieve details for a specific email marketing folder using its unique ID to access campaign organization and content information.

Instructions

Get details of a specific folder by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folder_idYesID of the folder to retrieve

Implementation Reference

  • The main handler function that validates the input parameters using isGetFolderByIdParams, creates a SmartDelivery API client, makes a GET request to `/spam-test/folder/{folder_id}`, and returns the formatted JSON response or handles errors.
    async function handleGetFolderById(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isGetFolderByIdParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_folder_by_id'
        );
      }
    
      try {
        const smartDeliveryClient = createSmartDeliveryClient(apiClient);
        const { folder_id } = args;
        
        const response = await withRetry(
          async () => smartDeliveryClient.get(`/spam-test/folder/${folder_id}`),
          'get folder by ID'
        );
    
        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 requiring a 'folder_id' integer parameter.
    export const GET_FOLDER_BY_ID_TOOL: CategoryTool = {
      name: 'smartlead_get_folder_by_id',
      description: 'Get details of a specific folder by ID.',
      category: ToolCategory.SMART_DELIVERY,
      inputSchema: {
        type: 'object',
        properties: {
          folder_id: {
            type: 'integer',
            description: 'ID of the folder to retrieve',
          },
        },
        required: ['folder_id'],
      },
    };
  • Type guard function that validates the input arguments match the expected GetFolderByIdParams interface (object with numeric 'folder_id').
    export function isGetFolderByIdParams(args: unknown): args is GetFolderByIdParams {
      return (
        typeof args === 'object' &&
        args !== null &&
        'folder_id' in args &&
        typeof (args as GetFolderByIdParams).folder_id === 'number'
      );
    }
  • src/index.ts:217-219 (registration)
    Registers the smartDeliveryTools array (which includes this tool) to the MCP tool registry if the smartDelivery category is enabled.
    if (enabledCategories.smartDelivery) {
      toolRegistry.registerMany(smartDeliveryTools);
    }
  • Switch case in handleSmartDeliveryTool that routes calls to this specific tool handler.
    case 'smartlead_get_folder_by_id': {
      return handleGetFolderById(args, apiClient, withRetry);
    }
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