Skip to main content
Glama
bcharleson

Instantly MCP Server

create_lead

Add a single lead to an email outreach campaign with custom variables and duplicate prevention options.

Instructions

Create a single lead with custom variables.

Use skip_if_in_campaign=true to prevent duplicates (recommended).

Custom variables must match field names defined in the campaign. Example: {"industry": "Technology", "company_size": "50-100"}

For bulk imports (10+ leads), use add_leads_to_campaign_or_list_bulk instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that implements the create_lead tool. It constructs a request body from the input parameters and sends a POST request to the Instantly API's /leads endpoint to create a new lead.
    async def create_lead(params: CreateLeadInput) -> str:
        """
        Create a single lead with custom variables.
        
        Use skip_if_in_campaign=true to prevent duplicates (recommended).
        
        Custom variables must match field names defined in the campaign.
        Example: {"industry": "Technology", "company_size": "50-100"}
        
        For bulk imports (10+ leads), use add_leads_to_campaign_or_list_bulk instead.
        """
        client = get_client()
        
        body: dict[str, Any] = {
            "email": params.email,
        }
        
        if params.campaign:
            body["campaign"] = params.campaign
        if params.first_name:
            body["first_name"] = params.first_name
        if params.last_name:
            body["last_name"] = params.last_name
        if params.company_name:
            body["company_name"] = params.company_name
        if params.phone:
            body["phone"] = params.phone
        if params.website:
            body["website"] = params.website
        if params.personalization:
            body["personalization"] = params.personalization
        if params.lt_interest_status is not None:
            body["lt_interest_status"] = params.lt_interest_status
        if params.pl_value_lead:
            body["pl_value_lead"] = params.pl_value_lead
        if params.list_id:
            body["list_id"] = params.list_id
        if params.assigned_to:
            body["assigned_to"] = params.assigned_to
        if params.skip_if_in_workspace is not None:
            body["skip_if_in_workspace"] = params.skip_if_in_workspace
        if params.skip_if_in_campaign is not None:
            body["skip_if_in_campaign"] = params.skip_if_in_campaign
        if params.skip_if_in_list is not None:
            body["skip_if_in_list"] = params.skip_if_in_list
        if params.blocklist_id:
            body["blocklist_id"] = params.blocklist_id
        if params.verify_leads_on_import is not None:
            body["verify_leads_on_import"] = params.verify_leads_on_import
        if params.custom_variables:
            body["custom_variables"] = params.custom_variables
        
        result = await client.post("/leads", json=body)
        return json.dumps(result, indent=2)
  • Pydantic model defining the input schema (parameters) for the create_lead tool.
    class CreateLeadInput(BaseModel):
        """
        Input for creating a lead with custom variables.
        
        Use skip_if_in_campaign to prevent duplicates.
        """
        
        model_config = ConfigDict(str_strip_whitespace=True, extra="ignore")
        
        campaign: Optional[str] = Field(default=None, description="Campaign UUID")
        email: str = Field(..., description="Required - lead email address")
        first_name: Optional[str] = Field(default=None)
        last_name: Optional[str] = Field(default=None)
        company_name: Optional[str] = Field(default=None)
        phone: Optional[str] = Field(default=None)
        website: Optional[str] = Field(default=None)
        personalization: Optional[str] = Field(default=None)
        lt_interest_status: Optional[int] = Field(
            default=None, ge=-3, le=4,
            description="Interest status (-3 to 4)"
        )
        pl_value_lead: Optional[str] = Field(default=None, description="Pipeline value")
        list_id: Optional[str] = Field(default=None)
        assigned_to: Optional[str] = Field(default=None, description="User UUID")
        skip_if_in_workspace: Optional[bool] = Field(default=None)
        skip_if_in_campaign: Optional[bool] = Field(default=None, description="Recommended")
        skip_if_in_list: Optional[bool] = Field(default=None)
        blocklist_id: Optional[str] = Field(default=None)
        verify_leads_on_import: Optional[bool] = Field(default=None)
        custom_variables: Optional[dict[str, Any]] = Field(
            default=None,
            description="Match campaign field names"
        )
  • The dynamic registration loop in register_tools() that registers the create_lead function (imported from tools/leads.py) as an MCP tool with its annotations.
    for tool_func in tools:
        tool_name = tool_func.__name__
        annotations = TOOL_ANNOTATIONS.get(tool_name, {})
        
        # Register tool with FastMCP
        mcp.tool(
            name=tool_name,
            annotations=annotations,
        )(tool_func)
  • TOOL_ANNOTATIONS dictionary entry providing metadata (destructiveHint: False) for the create_lead tool used during registration.
    "create_lead": {"destructiveHint": False},
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only provide destructiveHint=false, indicating it's not destructive. The description adds valuable behavioral context: it explains the duplicate prevention mechanism ('skip_if_in_campaign=true to prevent duplicates'), provides an example of custom variables usage, and clarifies the bulk operation alternative. However, it doesn't mention authentication requirements, rate limits, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded: the first sentence states the core purpose, followed by specific usage tips, an example, and an alternative for bulk operations. Every sentence adds value with zero wasted words, making it easy to scan and understand.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (so return values are documented elsewhere) and annotations cover safety (destructiveHint=false), the description provides strong context for usage and parameters. It covers the main behavioral aspects (duplicate prevention, custom variables, bulk alternative) but doesn't address all potential edge cases or system constraints like rate limits.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description carries full burden. It effectively explains key parameters: it clarifies the purpose of 'skip_if_in_campaign' (prevent duplicates), provides an example structure for 'custom_variables' with field matching requirements, and implicitly indicates 'email' is required. This adds significant meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Create a single lead') and resource ('lead with custom variables'), distinguishing it from siblings like 'add_leads_to_campaign_or_list_bulk' (for bulk operations) and 'update_lead' (for modifications). The first sentence directly answers what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool ('Create a single lead') versus alternatives ('For bulk imports (10+ leads), use add_leads_to_campaign_or_list_bulk instead'). It also includes a recommendation for a specific parameter ('Use skip_if_in_campaign=true to prevent duplicates (recommended)').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/bcharleson/instantly-mcp-python'

If you have feedback or need assistance with the MCP directory API, please join our Discord server