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
| Name | Required | Description | Default |
|---|---|---|---|
| folder_id | Yes | ID of the folder to retrieve |
Implementation Reference
- src/handlers/smartDelivery.ts:1172-1211 (handler)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, }; } }
- src/tools/smartDelivery.ts:548-562 (schema)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'], }, };
- src/types/smartDelivery.ts:414-421 (helper)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); }
- src/handlers/smartDelivery.ts:119-121 (registration)Switch case in handleSmartDeliveryTool that routes calls to this specific tool handler.case 'smartlead_get_folder_by_id': { return handleGetFolderById(args, apiClient, withRetry); }