Guide
Install the OpenClaw Nylas Plugin
The @nylas/openclaw-nylas-plugin npm package gives your OpenClaw assistant native email, calendar, and contacts tools with typed schemas, auto-discovery of grants, and multi-account support. No exec commands or shell approvals needed.
What is the OpenClaw Nylas Plugin?
The @nylas/openclaw-nylas-plugin package is an npm-based plugin for OpenClaw that provides native tool schemas for email, calendar, and contacts. Instead of using OpenClaw's exec tool to run shell commands (as covered in the CLI exec guide), the plugin registers typed tools directly with the agent.
This means the agent calls tools like nylas_list_messages and nylas_send_message with structured parameters and gets JSON responses back — no command construction, no output parsing, no exec-approvals.json.
Key advantages over the exec approach:
- Typed tool schemas — the agent sees parameter names, types, and descriptions, reducing errors
- Auto-discovery — the plugin finds all grants associated with your API key automatically
- Multi-account — work with multiple email accounts using named grants
- No shell security config — no exec-approvals.json, no PATH setup, no allowlists
- Works with OpenClaw, Moltbot, and Clawdbot
Prerequisites
- OpenClaw installed and running. See the existing guide for setup instructions.
- Nylas dashboard account — sign up at dashboard-v3.nylas.com if you don't have one.
- Nylas API key — create one in the dashboard under Settings → API Keys.
- At least one grant — connect an email account (Gmail, Outlook, etc.) in the dashboard under Grants.
1. Install the plugin
OpenClaw has a built-in plugin manager. Install the package directly:
openclaw plugins install @nylas/openclaw-nylas-pluginThis downloads the package from npm and registers it with OpenClaw in under 30 seconds. The plugin registers all 14 tools immediately — no restart needed.
Verify the installation:
openclaw plugins listYou should see @nylas/openclaw-nylas-plugin in the output.
2. Configure your API key
The plugin needs your Nylas API key to authenticate. Set it via OpenClaw's config:
openclaw config set nylas.apiKey "YOUR_NYLAS_API_KEY"Alternatively, set the NYLAS_API_KEY environment variable in your shell profile or OpenClaw's environment config.
If you have a specific grant ID you want to use as the default (instead of auto-discovery), set it too:
openclaw config set nylas.grantId "YOUR_GRANT_ID"3. Verify it works
The plugin adds CLI commands under the openclaw nylas namespace. Check the status:
# Check plugin status and API connectivity
openclaw nylas status
# Discover all grants associated with your API key
openclaw nylas discover
# Test a quick email list
openclaw nylas testThe discover command shows all email accounts (grants) linked to your API key. The test command runs a basic email list to confirm end-to-end connectivity.
4. What tools does the plugin provide?
Once installed, the plugin registers 14 native tools across three domains — email, calendar, and contacts. Tools are available immediately with no restart required:
Email tools
| Tool | Description |
|---|---|
nylas_list_messages | List recent messages with optional filters |
nylas_search_messages | Search messages by keyword |
nylas_read_message | Read a specific message by ID |
nylas_send_message | Send an email |
nylas_create_draft | Create a draft message |
nylas_list_threads | List email threads |
nylas_list_folders | List mailbox folders/labels |
Calendar tools
| Tool | Description |
|---|---|
nylas_list_events | List calendar events |
nylas_create_event | Create a calendar event |
nylas_update_event | Update an existing event |
nylas_delete_event | Delete a calendar event |
nylas_get_availability | Check free/busy availability |
Contacts tools
| Tool | Description |
|---|---|
nylas_search_contacts | Search contacts by name or email |
nylas_get_contact | Get a specific contact by ID |
5. Example conversations
Once the plugin is installed and configured, here are realistic prompts and the tool calls the agent makes under the hood:
Email examples
- "What are my unread emails?" — the agent calls
nylas_list_messageswith{ unread: true, limit: 20 }, then summarizes senders, subjects, and snippets. - "Find emails from Sarah about the Q4 budget" — the agent calls
nylas_search_messageswith{ query: "from:sarah Q4 budget" }, reads the matching threads, and pulls out the key points. - "Draft a reply to the latest email from Dave saying I'll review it by Friday" — the agent calls
nylas_list_messagesto find Dave's email, thennylas_create_draftwith the reply content. It shows you the draft before sending. - "Send Alice the meeting notes from yesterday" — the agent calls
nylas_search_contactsto resolve Alice's email address, composes the message, confirms with you, then callsnylas_send_message.
Calendar examples
- "What's on my calendar this week?" — the agent calls
nylas_list_eventswith start and end timestamps for the current week, then summarizes each day's schedule. - "Schedule a 30-minute meeting with bob@company.com on Tuesday at 2pm" — the agent calls
nylas_create_eventwith the title, participants, start time, and duration. It confirms the event details before creating it. - "Am I free Thursday afternoon?" — the agent calls
nylas_get_availabilityfor Thursday 12:00–18:00 and tells you which slots are open. - "Move my 3pm meeting to 4pm" — the agent calls
nylas_list_eventsto find the 3pm event, thennylas_update_eventto shift the start and end times by one hour.
Contacts examples
- "What's Sarah Chen's email address?" — the agent calls
nylas_search_contactswith{ query: "Sarah Chen" }and returns the matching contact details. - "Look up everyone from Acme Corp in my contacts" — the agent calls
nylas_search_contactswith{ query: "Acme Corp" }and lists all matching names and email addresses.
Combined workflow examples
- "Find a time to meet with alice@company.com this week and send her an invite" — the agent calls
nylas_get_availabilityto check both calendars, picks the first open slot, callsnylas_create_eventwith Alice as a participant, and confirms the invite was sent. - "Check if I have any emails from the attendees of tomorrow's standup" — the agent calls
nylas_list_eventsto find tomorrow's standup and its participants, then callsnylas_search_messagesfor each attendee to surface recent threads. - "Email everyone in my 2pm meeting that I'll be 10 minutes late" — the agent calls
nylas_list_eventsto find the 2pm event, extracts the participant emails, composes a short message, confirms with you, then callsnylas_send_messageto each recipient.
6. How do I use multiple email accounts?
If your API key has multiple grants (e.g., a work Gmail and a personal Outlook account), the plugin supports named grants. First, discover what's available:
openclaw nylas discoverYou'll see output like:
Found 2 grants:
work - alice@company.com (Google)
personal - alice@gmail.com (Google)The agent can then specify which account to use when calling tools. For example, "list my work emails" vs "send from my personal account." The plugin resolves grant names to IDs automatically.
To manage grants from the CLI:
# List all configured grants
openclaw nylas grants7. Optional: Standalone usage
You can also use the plugin as a standalone npm package in your own TypeScript or JavaScript projects, outside of OpenClaw:
npm install @nylas/openclaw-nylas-pluginimport { NylasPlugin } from "@nylas/openclaw-nylas-plugin"
const plugin = new NylasPlugin({
apiKey: process.env.NYLAS_API_KEY!,
// Optional: specify a default grant ID
// grantId: "your-grant-id",
})
// Get the tool definitions (for registering with any LLM framework)
const tools = plugin.getTools()
// Execute a tool call
const result = await plugin.executeTool("nylas_list_messages", {
limit: 5,
unread: true,
})This is useful if you're building a custom agent with the agent tools guide pattern and want typed Nylas tools without the CLI.
8. Which approach should I choose: plugin, CLI exec, or MCP?
There are three ways to give an OpenClaw agent Nylas access. Here's how they compare:
| Feature | Plugin (this guide) | CLI exec | MCP server |
|---|---|---|---|
| Setup complexity | One command | PATH + exec-approvals | Config + running process |
| Tool schemas | Typed (auto-registered) | Text in TOOLS.md | Typed (MCP protocol) |
| Auth method | API key | CLI OAuth | CLI OAuth |
| Multi-account | Named grants | Single grant | Single grant |
| Auto-discovery | Yes | No | No |
| Shell access needed | No | Yes | No |
| Requires running process | No | No | Yes |
Recommendation: Use the plugin for the simplest setup and best multi-account support. Use the CLI exec approach if you already have the Nylas CLI authenticated and prefer OAuth-based auth. Use MCP if you need the same tools available to other MCP-compatible clients (Claude Desktop, Cursor, VS Code).
Troubleshooting
"apiKey is required"
The plugin cannot find your API key. Make sure you set it with openclaw config set nylas.apiKey or via the NYLAS_API_KEY environment variable. Check that the value is not empty:
openclaw config get nylas.apiKey"No grants found"
Your API key has no connected email accounts. Go to dashboard-v3.nylas.com → Grants and connect at least one email account. Then run openclaw nylas discover again.
401 Unauthorized
The API key is invalid or expired. Generate a new one in the Nylas dashboard under Settings → API Keys and update it:
openclaw config set nylas.apiKey "NEW_API_KEY"404 Not Found on grant operations
The grant ID does not exist or was deleted. Run openclaw nylas discover to see current grants and update your config if needed.
Plugin not showing up
If openclaw plugins list does not show the plugin, try reinstalling:
openclaw plugins uninstall @nylas/openclaw-nylas-plugin
openclaw plugins install @nylas/openclaw-nylas-pluginNext steps
- Nylas CLI with OpenClaw (exec approach) — the alternative setup using shell commands and exec-approvals
- Give AI Agents Email Access via MCP — connect Claude, Cursor, or VS Code to your inbox
- Build an Agent with Email Tools — use Nylas tools in a custom LLM agent
- Send email from the terminal — use the Nylas CLI directly for scripting
- Manage calendar from the terminal — timezone handling, DST, and AI scheduling