extract_customer_info
Extract customer name, phone, email, and address from conversation history to auto-fill CRM records.
Instructions
Extract contact information from conversation history using AI.
The AI reads through all messages with this customer and extracts their name, phone number, email address, and physical address. Great for auto-filling CRM records from chat conversations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customer_id | Yes | Customer ID to extract info for | |
| org_id | No | Organization ID (uses YAPARAI_ORG_ID env var if not provided) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/yaparai/tools/crm.py:69-89 (handler)The main handler function for the extract_customer_info tool. It resolves the org ID, creates an API client, and delegates to client.crm_extract_info().
async def extract_customer_info( customer_id: str, org_id: str | None = None, ) -> dict: """ Extract contact information from conversation history using AI. The AI reads through all messages with this customer and extracts their name, phone number, email address, and physical address. Great for auto-filling CRM records from chat conversations. Args: customer_id: Customer ID to extract info for org_id: Organization ID (uses YAPARAI_ORG_ID env var if not provided) Returns: Dict with extracted info: name, phone, email, address. """ oid = resolve_org_id(org_id) client = YaparAIClient() return await client.crm_extract_info(oid, customer_id) - src/yaparai/tools/crm.py:69-89 (schema)The function signature and docstring define the input schema (customer_id required, org_id optional) and output schema (dict with name, phone, email, address).
async def extract_customer_info( customer_id: str, org_id: str | None = None, ) -> dict: """ Extract contact information from conversation history using AI. The AI reads through all messages with this customer and extracts their name, phone number, email address, and physical address. Great for auto-filling CRM records from chat conversations. Args: customer_id: Customer ID to extract info for org_id: Organization ID (uses YAPARAI_ORG_ID env var if not provided) Returns: Dict with extracted info: name, phone, email, address. """ oid = resolve_org_id(org_id) client = YaparAIClient() return await client.crm_extract_info(oid, customer_id) - src/yaparai/server.py:84-91 (registration)Import of extract_customer_info from the crm module into the server registration file.
from yaparai.tools.crm import ( list_customers, get_customer, extract_customer_info, send_shipping_info, bulk_message, sync_customers_from_inbox, ) - src/yaparai/server.py:168-174 (registration)Explicit registration of extract_customer_info as an MCP tool via mcp.tool() call.
# Enterprise: CRM (6) mcp.tool(list_customers) mcp.tool(get_customer) mcp.tool(extract_customer_info) mcp.tool(send_shipping_info) mcp.tool(bulk_message) mcp.tool(sync_customers_from_inbox) - src/yaparai/client.py:289-293 (helper)HTTP client method crm_extract_info that sends a POST request to the Enterprise API endpoint to extract customer info from conversations using AI.
async def crm_extract_info(self, org_id: str, customer_id: str) -> dict: """Extract customer info from conversations via AI.""" return await self._request( "POST", f"/api/enterprise/orgs/{org_id}/crm/customers/{customer_id}/extract-info" )