Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_lead

Retrieve detailed information about a specific lead by providing its unique ID, enabling access to contact data for email marketing campaigns.

Instructions

Get details of a specific lead by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lead_idYesID of the lead to retrieve

Implementation Reference

  • Core handler function for 'smartlead_get_lead': validates input parameters using isGetLeadParams, fetches lead details via API GET /leads/{lead_id} with retry logic, returns JSON-formatted response or error message.
    async function handleGetLead(
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isGetLeadParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_lead'
        );
      }
    
      try {
        const response = await withRetry(
          async () => apiClient.get(`/leads/${args.lead_id}`),
          'get lead'
        );
    
        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,
        };
      }
    }
  • Tool definition including name, description, category, and input schema requiring 'lead_id' as a number.
    export const GET_LEAD_TOOL: CategoryTool = {
      name: 'smartlead_get_lead',
      description: 'Get details of a specific lead by ID.',
      category: ToolCategory.LEAD_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          lead_id: {
            type: 'number',
            description: 'ID of the lead to retrieve',
          },
        },
        required: ['lead_id'],
      },
    };
  • src/index.ts:207-209 (registration)
    Registers the array of lead tools (leadTools), which includes 'smartlead_get_lead', into the tool registry if leadManagement category is enabled.
    if (enabledCategories.leadManagement) {
      toolRegistry.registerMany(leadTools);
    }
  • Runtime type guard (validator) for GetLeadParams, ensuring 'lead_id' is present and a number.
    export function isGetLeadParams(args: unknown): args is GetLeadParams {
      return (
        typeof args === 'object' &&
        args !== null &&
        'lead_id' in args &&
        typeof (args as { lead_id: unknown }).lead_id === 'number'
      );
    }
  • src/index.ts:25-25 (registration)
    Imports the leadTools array containing the 'smartlead_get_lead' tool definition for registration.
    import { leadTools } from './tools/lead.js';

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