DEV Community

Qasim Muhammad
Qasim Muhammad

Posted on • Originally published at cli.nylas.com

Give Your AI Agent Email, Calendar & Contacts — One Command

You want your OpenClaw agent to read email, check your calendar, and look up contacts — without wiring up shell commands or managing exec permissions. Here’s how.

Get started

  1. Sign up for Nylas and create an API key
  2. Connect at least one email account under Grants
  3. Run openclaw plugins install @nylas/openclaw-nylas-plugin
  4. Set your API key and start talking to your agent

Full setup guide with troubleshooting: cli.nylas.com/guides/install-openclaw-nylas-plugin

The problem with exec-based tool access

Most AI agent setups that interact with external services do it through shell commands. The agent constructs a CLI command, runs it via exec, and parses the text output. This works, but:

  • The agent guesses at flag syntax and gets it wrong
  • You need an exec-approvals.json allowlist for security
  • Output parsing breaks when the CLI format changes
  • You’re limited to one account at a time

The plugin approach: typed tools, zero shell access

The @nylas/openclaw-nylas-plugin package registers 14 native tools directly with OpenClaw. The agent calls nylas_list_messages with structured JSON parameters and gets JSON back. No command construction, no output parsing.

Install in one command:

openclaw plugins install @nylas/openclaw-nylas-plugin
Enter fullscreen mode Exit fullscreen mode

Configure your Nylas API key:

openclaw config set nylas.apiKey "YOUR_NYLAS_API_KEY"
Enter fullscreen mode Exit fullscreen mode

Verify:

openclaw nylas status
openclaw nylas discover
Enter fullscreen mode Exit fullscreen mode

That’s it. 14 tools are now available across email, calendar, and contacts.

What tools do you get?

Email (7 tools): list messages, search, read, send, create drafts, list threads, list folders

Calendar (5 tools): list events, create/update/delete events, check availability

Contacts (2 tools): search contacts, get contact details

Real conversations

Once installed, you talk to your agent naturally:

  • "What are my unread emails?" — agent calls nylas_list_messages with { unread: true }
  • "Schedule a meeting with bob@company.com Tuesday at 2pm" — agent calls nylas_create_event
  • "Am I free Thursday afternoon?" — agent calls nylas_get_availability
  • "Find a time to meet with Alice this week and send her an invite" — agent chains nylas_get_availability + nylas_create_event

The agent confirms before sending emails or creating events.

Multi-account support

If your API key has multiple grants (work Gmail + personal Outlook), the plugin handles it:

openclaw nylas discover
# Found 2 grants:
#   work     - alice@company.com (Google)
#   personal - alice@gmail.com (Google)
Enter fullscreen mode Exit fullscreen mode

Say "send from my personal account" and the agent resolves the right grant automatically.

Plugin vs CLI exec vs MCP

Feature Plugin CLI exec MCP server
Setup One command PATH + allowlist Config + process
Tool schemas Typed Text file Typed
Multi-account Yes No No
Shell access needed No Yes No

Use the plugin for simplest setup and multi-account. Use CLI exec if you prefer OAuth auth. Use MCP if you need tools in Claude Desktop or Cursor.

Works with Gmail, Outlook, Exchange, Yahoo, iCloud, and IMAP

The Nylas API normalizes all six providers into a single interface. The plugin works identically regardless of which email provider your grants use.

Standalone usage in your own projects

You can also use the plugin as a standalone npm package in your own TypeScript or JavaScript projects:

import { NylasPlugin } from "@nylas/openclaw-nylas-plugin"

const plugin = new NylasPlugin({
  apiKey: process.env.NYLAS_API_KEY,
})

const tools = plugin.getTools()
const result = await plugin.executeTool("nylas_list_messages", {
  limit: 5,
  unread: true,
})
Enter fullscreen mode Exit fullscreen mode

This is useful if you’re building a custom agent and want typed Nylas tools without the CLI.

Top comments (0)