Skip to main content
Glama

create_contact

Add new contacts to Keila's newsletter system by providing email and optional name details for targeted communication.

Instructions

Create a new contact in Keila.

Args: email: Email address (required). first_name: First name (optional). last_name: Last name (optional).

Returns: The created contact record.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes
first_nameNo
last_nameNo

Implementation Reference

  • The MCP tool registration and handler wrapper for creating a contact.
    @mcp.tool()
    def create_contact(email: str, first_name: str | None = None, last_name: str | None = None) -> dict:
        """
        Create a new contact in Keila.
    
        Args:
            email: Email address (required).
            first_name: First name (optional).
            last_name: Last name (optional).
    
        Returns:
            The created contact record.
        """
        return _client.create_contact(email=email, first_name=first_name, last_name=last_name)
  • client.py:58-72 (handler)
    The actual Keila API client implementation that sends the request to create a contact.
    def create_contact(self, email: str, first_name: str | None = None, last_name: str | None = None,
                       external_id: str | None = None, data: dict | None = None) -> dict:
        """Create a new contact."""
        contact_data = {"email": email}
        if first_name:
            contact_data["first_name"] = first_name
        if last_name:
            contact_data["last_name"] = last_name
        if external_id:
            contact_data["external_id"] = external_id
        if data:
            contact_data["data"] = data
        resp = self.session.post(f"{self.url}/api/v1/contacts", json={"data": contact_data}, headers=self._headers(), timeout=30)
        resp.raise_for_status()
        return resp.json()

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/gwbischof/keila-mcp'

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