Your agent needs contacts access to look up people by name or email, enrich context before sending messages, and manage address books on behalf of users. The Nylas CLI gives your agent access to contacts across Gmail, Outlook, Exchange, and iCloud through shell commands that return structured JSON.
Prerequisites
Section titled “Prerequisites”Make sure the CLI is installed and authenticated. If not, follow the AI agents quickstart first.
nylas auth whoami --jsonSearch contacts
Section titled “Search contacts”Find contacts by name or email. This is the most common operation — look someone up before sending an email or scheduling a meeting.
nylas contacts search --query "Alice" --jsonList contacts
Section titled “List contacts”List all contacts for the connected user.
nylas contacts list --limit 10 --jsonView contact details
Section titled “View contact details”Get the full details for a specific contact — emails, phone numbers, company, job title.
nylas contacts show <CONTACT_ID> --jsonCreate a contact
Section titled “Create a contact”Add a new contact to the user’s address book.
List contact groups
Section titled “List contact groups”See how contacts are organized (labels in Gmail, folders in Outlook).
nylas contacts groups list --jsonExample: enrich context before sending email
Section titled “Example: enrich context before sending email”A common agent pattern — look up the recipient before composing a message:
# 1. Search for the contact
# 2. (Agent uses contact details like company, title, and# recent interactions to personalize the email)
# 3. Send a personalized emailnylas email send \ --subject "Following up on our conversation" \ --body "Hi Alice, great talking with you at the conference..." \ --yesUsing MCP instead
Section titled “Using MCP instead”If your agent supports Model Context Protocol (Claude Code, Cursor, Windsurf, VS Code, Codex CLI), register the CLI as an MCP server for typed contact tools:
nylas mcp install --assistant claude-codeSee the Nylas MCP server docs for details.
What’s next
Section titled “What’s next”- Give your agent email access — read, send, and search email
- Give your agent calendar access — manage events and check availability
- Give your agent call recordings — record meetings and get transcripts
- AI agents quickstart — full CLI setup and command reference