home / skills / composiohq / awesome-claude-skills / agent-mail-automation

agent-mail-automation skill

/agent-mail-automation

This skill automates Agent Mail tasks via Rube MCP, ensuring live tool discovery and reliable connections before executing workflows.

npx playbooks add skill composiohq/awesome-claude-skills --skill agent-mail-automation

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.9 KB
---
name: agent-mail-automation
description: "Automate Agent Mail tasks via Rube MCP (Composio). Always search tools first for current schemas."
requires:
  mcp: [rube]
---

# Agent Mail Automation via Rube MCP

Automate Agent Mail operations through Composio's Agent Mail toolkit via Rube MCP.

**Toolkit docs**: [composio.dev/toolkits/agent_mail](https://composio.dev/toolkits/agent_mail)

## Prerequisites

- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active Agent Mail connection via `RUBE_MANAGE_CONNECTIONS` with toolkit `agent_mail`
- Always call `RUBE_SEARCH_TOOLS` first to get current tool schemas

## Setup

**Get Rube MCP**: Add `https://rube.app/mcp` as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.

1. Verify Rube MCP is available by confirming `RUBE_SEARCH_TOOLS` responds
2. Call `RUBE_MANAGE_CONNECTIONS` with toolkit `agent_mail`
3. If connection is not ACTIVE, follow the returned auth link to complete setup
4. Confirm connection status shows ACTIVE before running any workflows

## Tool Discovery

Always discover available tools before executing workflows:

```
RUBE_SEARCH_TOOLS
queries: [{use_case: "Agent Mail operations", known_fields: ""}]
session: {generate_id: true}
```

This returns available tool slugs, input schemas, recommended execution plans, and known pitfalls.

## Core Workflow Pattern

### Step 1: Discover Available Tools

```
RUBE_SEARCH_TOOLS
queries: [{use_case: "your specific Agent Mail task"}]
session: {id: "existing_session_id"}
```

### Step 2: Check Connection

```
RUBE_MANAGE_CONNECTIONS
toolkits: ["agent_mail"]
session_id: "your_session_id"
```

### Step 3: Execute Tools

```
RUBE_MULTI_EXECUTE_TOOL
tools: [{
  tool_slug: "TOOL_SLUG_FROM_SEARCH",
  arguments: {/* schema-compliant args from search results */}
}]
memory: {}
session_id: "your_session_id"
```

## Known Pitfalls

- **Always search first**: Tool schemas change. Never hardcode tool slugs or arguments without calling `RUBE_SEARCH_TOOLS`
- **Check connection**: Verify `RUBE_MANAGE_CONNECTIONS` shows ACTIVE status before executing tools
- **Schema compliance**: Use exact field names and types from the search results
- **Memory parameter**: Always include `memory` in `RUBE_MULTI_EXECUTE_TOOL` calls, even if empty (`{}`)
- **Session reuse**: Reuse session IDs within a workflow. Generate new ones for new workflows
- **Pagination**: Check responses for pagination tokens and continue fetching until complete

## Quick Reference

| Operation | Approach |
|-----------|----------|
| Find tools | `RUBE_SEARCH_TOOLS` with Agent Mail-specific use case |
| Connect | `RUBE_MANAGE_CONNECTIONS` with toolkit `agent_mail` |
| Execute | `RUBE_MULTI_EXECUTE_TOOL` with discovered tool slugs |
| Bulk ops | `RUBE_REMOTE_WORKBENCH` with `run_composio_tool()` |
| Full schema | `RUBE_GET_TOOL_SCHEMAS` for tools with `schemaRef` |

---
*Powered by [Composio](https://composio.dev)*

Overview

This skill automates Agent Mail tasks using Composio's Agent Mail toolkit via the Rube MCP gateway. It provides a reliable workflow pattern to discover tools, verify connections, and execute operations programmatically. Designed for safe, schema-driven automation, it enforces discovery-first and session-aware execution.

How this skill works

The skill first calls RUBE_SEARCH_TOOLS to fetch current tool slugs, input schemas, and recommended plans. It then validates the Agent Mail connection via RUBE_MANAGE_CONNECTIONS and ensures the connection status is ACTIVE. Finally it runs actions through RUBE_MULTI_EXECUTE_TOOL (or RUBE_REMOTE_WORKBENCH for bulk operations), passing schema-compliant arguments and an explicit memory object.

When to use it

  • Automating routine Agent Mail tasks like message routing, mailbox provisioning, or template sends
  • Running bulk or scheduled mail operations that require reliable tool discovery and pagination handling
  • Integrating Agent Mail functionality into larger Claude-driven workflows
  • When you need to programmatically manage Agent Mail connections and confirm active status
  • When tool schemas may change frequently and you must avoid hardcoded field names

Best practices

  • Always call RUBE_SEARCH_TOOLS first to retrieve current tool slugs and input schemas
  • Verify Agent Mail connection with RUBE_MANAGE_CONNECTIONS and proceed only if status is ACTIVE
  • Supply memory in every RUBE_MULTI_EXECUTE_TOOL call (use {} when empty)
  • Reuse session IDs for a single workflow; generate new session IDs for new workflows
  • Respect schema types and exact field names; handle pagination tokens when present

Example use cases

  • Discover available Agent Mail operations and run a template send using the discovered schema
  • Provision multiple mailboxes in bulk via RUBE_REMOTE_WORKBENCH and run_composio_tool()
  • Build a Claude workflow that checks connection health before executing message operations
  • Automate daily report distribution by fetching tool schemas, then executing scheduled sends
  • Migrate mailbox settings by iterating paginated responses and applying schema-compliant updates

FAQ

Do I need API keys to use Rube MCP?

No API keys are required. Add https://rube.app/mcp as an MCP server in your client config and use the provided RUBE_* calls.

What should I do if tool schemas change mid-workflow?

Stop execution, call RUBE_SEARCH_TOOLS again to refresh schemas, update arguments to match the new schema, then resume using a valid session or a new session as appropriate.