list_contacts
Retrieve and display all contacts from the Keila newsletter system with pagination support. View contact details including email, name, status, and timestamps.
Instructions
List all contacts in Keila with pagination.
Args: page: Page number for pagination (optional).
Returns: A dict with 'data' (list of contacts) and 'meta' (pagination info). Each contact has id, email, first_name, last_name, status, data, and timestamps.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No |
Implementation Reference
- mcp_server.py:19-31 (handler)MCP tool handler for listing contacts, which delegates the call to the KeilaClient.
@mcp.tool() def list_contacts(page: int | None = None) -> dict: """ List all contacts in Keila with pagination. Args: page: Page number for pagination (optional). Returns: A dict with 'data' (list of contacts) and 'meta' (pagination info). Each contact has id, email, first_name, last_name, status, data, and timestamps. """ return _client.list_contacts(page=page) - client.py:37-47 (helper)The actual API client implementation for listing contacts via HTTP request.
def list_contacts(self, page: int | None = None, filter: dict | None = None) -> dict: """List contacts with optional pagination and filtering.""" params = {} if page is not None: params["paginate[page]"] = page if filter: for key, val in filter.items(): params[f"filter[{key}]"] = val resp = self.session.get(f"{self.url}/api/v1/contacts", params=params, headers=self._headers(), timeout=30) resp.raise_for_status() return resp.json()