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-plugin

This 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 list

You 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 test

The 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

ToolDescription
nylas_list_messagesList recent messages with optional filters
nylas_search_messagesSearch messages by keyword
nylas_read_messageRead a specific message by ID
nylas_send_messageSend an email
nylas_create_draftCreate a draft message
nylas_list_threadsList email threads
nylas_list_foldersList mailbox folders/labels

Calendar tools

ToolDescription
nylas_list_eventsList calendar events
nylas_create_eventCreate a calendar event
nylas_update_eventUpdate an existing event
nylas_delete_eventDelete a calendar event
nylas_get_availabilityCheck free/busy availability

Contacts tools

ToolDescription
nylas_search_contactsSearch contacts by name or email
nylas_get_contactGet 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_messages with { unread: true, limit: 20 }, then summarizes senders, subjects, and snippets.
  • "Find emails from Sarah about the Q4 budget" — the agent calls nylas_search_messages with { 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_messages to find Dave's email, then nylas_create_draft with the reply content. It shows you the draft before sending.
  • "Send Alice the meeting notes from yesterday" — the agent calls nylas_search_contacts to resolve Alice's email address, composes the message, confirms with you, then calls nylas_send_message.

Calendar examples

  • "What's on my calendar this week?" — the agent calls nylas_list_events with 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_event with 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_availability for Thursday 12:00–18:00 and tells you which slots are open.
  • "Move my 3pm meeting to 4pm" — the agent calls nylas_list_events to find the 3pm event, then nylas_update_event to shift the start and end times by one hour.

Contacts examples

  • "What's Sarah Chen's email address?" — the agent calls nylas_search_contacts with { query: "Sarah Chen" } and returns the matching contact details.
  • "Look up everyone from Acme Corp in my contacts" — the agent calls nylas_search_contacts with { 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_availability to check both calendars, picks the first open slot, calls nylas_create_event with 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_events to find tomorrow's standup and its participants, then calls nylas_search_messages for each attendee to surface recent threads.
  • "Email everyone in my 2pm meeting that I'll be 10 minutes late" — the agent calls nylas_list_events to find the 2pm event, extracts the participant emails, composes a short message, confirms with you, then calls nylas_send_message to 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 discover

You'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 grants

7. 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-plugin
import { 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:

FeaturePlugin (this guide)CLI execMCP server
Setup complexityOne commandPATH + exec-approvalsConfig + running process
Tool schemasTyped (auto-registered)Text in TOOLS.mdTyped (MCP protocol)
Auth methodAPI keyCLI OAuthCLI OAuth
Multi-accountNamed grantsSingle grantSingle grant
Auto-discoveryYesNoNo
Shell access neededNoYesNo
Requires running processNoNoYes

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.comGrants 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-plugin

Next steps