Skip to main content
Glama
bcharleson

Instantly MCP Server

update_lead

Update lead information in Instantly.ai campaigns. Modify fields like name, company, contact details, or custom variables while preserving existing data through proper merging.

Instructions

Update lead (partial update).

⚠️ IMPORTANT: custom_variables REPLACES the entire object! To preserve existing custom variables:

  1. First call get_lead to retrieve current values

  2. Merge your changes with existing values

  3. Pass the complete merged object

Example: If lead has {"industry": "Tech"} and you want to add {"size": "Large"}, you must pass {"industry": "Tech", "size": "Large"} - not just {"size": "Large"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function that executes the update_lead tool. It constructs a partial update body from input parameters and sends a PATCH request to the /leads/{lead_id} endpoint, returning the JSON response.
    async def update_lead(params: UpdateLeadInput) -> str:
        """
        Update lead (partial update).
        
        ⚠️ IMPORTANT: custom_variables REPLACES the entire object!
        To preserve existing custom variables:
        1. First call get_lead to retrieve current values
        2. Merge your changes with existing values
        3. Pass the complete merged object
        
        Example: If lead has {"industry": "Tech"} and you want to add {"size": "Large"},
        you must pass {"industry": "Tech", "size": "Large"} - not just {"size": "Large"}
        """
        client = get_client()
        
        body: dict[str, Any] = {}
        
        if params.personalization is not None:
            body["personalization"] = params.personalization
        if params.website is not None:
            body["website"] = params.website
        if params.last_name is not None:
            body["last_name"] = params.last_name
        if params.first_name is not None:
            body["first_name"] = params.first_name
        if params.company_name is not None:
            body["company_name"] = params.company_name
        if params.phone is not None:
            body["phone"] = params.phone
        if params.lt_interest_status is not None:
            body["lt_interest_status"] = params.lt_interest_status
        if params.pl_value_lead is not None:
            body["pl_value_lead"] = params.pl_value_lead
        if params.assigned_to is not None:
            body["assigned_to"] = params.assigned_to
        if params.custom_variables is not None:
            body["custom_variables"] = params.custom_variables
        
        result = await client.patch(f"/leads/{params.lead_id}", json=body)
        return json.dumps(result, indent=2)
  • Pydantic BaseModel defining the input schema for the update_lead tool, including lead_id (required) and optional fields for partial updates.
    class UpdateLeadInput(BaseModel):
        """
        Input for updating a lead (partial update).
        
        ⚠️ custom_variables replaces entire object - include existing values!
        """
        
        model_config = ConfigDict(str_strip_whitespace=True, extra="ignore")
        
        lead_id: str = Field(..., description="Lead UUID")
        personalization: Optional[str] = Field(default=None)
        website: Optional[str] = Field(default=None)
        last_name: Optional[str] = Field(default=None)
        first_name: Optional[str] = Field(default=None)
        company_name: Optional[str] = Field(default=None)
        phone: Optional[str] = Field(default=None)
        lt_interest_status: Optional[int] = Field(default=None)
        pl_value_lead: Optional[str] = Field(default=None)
        assigned_to: Optional[str] = Field(default=None)
        custom_variables: Optional[dict[str, Any]] = Field(
            default=None,
            description="⚠️ REPLACES ALL - include existing values!"
        )
  • The LEAD_TOOLS list exports the update_lead function along with other lead tools, which is used by get_all_tools() to collect and register tools with the MCP server.
    LEAD_TOOLS = [
        list_leads,
        get_lead,
        create_lead,
        update_lead,
        list_lead_lists,
        create_lead_list,
        update_lead_list,
        get_verification_stats_for_lead_list,
        add_leads_to_campaign_or_list_bulk,
        delete_lead,
        delete_lead_list,
        move_leads_to_campaign_or_list,
    ]
  • TOOL_ANNOTATIONS dictionary entry for update_lead, specifying destructiveHint=False, applied during dynamic tool registration in register_tools().
    "create_lead": {"destructiveHint": False},
    "update_lead": {"destructiveHint": False},
Behavior4/5

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

The description adds valuable behavioral context beyond the annotations. While annotations only indicate destructiveHint=false (non-destructive), the description reveals the critical nuance that custom_variables 'REPLACES the entire object!' This is a crucial behavioral trait that isn't captured in annotations. It also provides a step-by-step workflow for safe usage. No contradiction with annotations exists.

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 efficiently structured with zero wasted text. It starts with the core purpose, immediately highlights the most important warning with an emoji, provides clear numbered steps for correct usage, and concludes with a concrete example. Every sentence serves a distinct purpose and contributes to understanding.

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

Completeness5/5

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

Given this is a mutation tool with 0% schema description coverage but with an output schema present, the description provides excellent contextual completeness. It covers the critical behavioral nuance (custom_variables replacement behavior), provides usage workflow, and includes examples. The presence of an output schema means the description doesn't need to explain return values, allowing it to focus on the most important usage considerations.

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 description provides essential parameter semantics that compensate for the 0% schema description coverage. It explains the critical behavior of the custom_variables parameter ('REPLACES the entire object!') and provides a concrete example showing how to properly handle parameter values. This adds significant meaning beyond what the bare schema provides, especially given the low schema coverage.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Update lead (partial update).' It specifies the verb ('update'), resource ('lead'), and scope ('partial update'), distinguishing it from create_lead and delete_lead. However, it doesn't explicitly differentiate from update_account or update_campaign, which are similar mutation operations on different resources.

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 and how to use this tool: 'To preserve existing custom variables: 1. First call get_lead to retrieve current values 2. Merge your changes with existing values 3. Pass the complete merged object.' It names a specific alternative (get_lead) for prerequisite data retrieval and gives a concrete example of correct usage versus incorrect usage.

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