Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MetaMask Agent CLI Skills

SKILLs for the MetaMask Agent CLI (`@metamask/agentic-cli` v1.0.0). These skills enable AI agents to authenticate, manage wallets, swap tokens, bridge across chains, trade perpetual futures, and more using the MetaMask Agent CLI.
SKILLs for the MetaMask Agent CLI (`@metamask/agentic-cli` v2.0.0). These skills enable AI agents to authenticate, manage wallets, swap tokens, bridge across chains, trade perpetual futures, and more using the MetaMask Agent CLI.

## Skills

Expand Down
20 changes: 13 additions & 7 deletions skills/metamask-agent-wallet/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: Use when the user asks anything about blockchain wallets, transacti
license: MIT
metadata:
author: metamask
version: "2.2.0"
cliVersion: "1.0.0"
version: "3.0.0"
cliVersion: "2.0.0"
---

# MetaMask Agentic CLI Skill
Expand Down Expand Up @@ -35,15 +35,20 @@ Match the user's intent to a command and reference file, then read the reference
| Change BYOK mnemonic encryption password | `mm wallet password change` | [auth.md](references/auth.md) |
| Remove BYOK mnemonic encryption password | `mm wallet password remove` | [auth.md](references/auth.md) |
| Interpret raw CLI error codes | `AuthError`, `ValidationError`, `WALLET_ERROR` | [errors.md](references/errors.md) |
| Inspect CLI, skills, environment, and session health | `mm doctor` | [doctor.md](references/doctor.md) |
| Decode EVM calldata into a human-readable intent | `mm decode` | [decode.md](references/decode.md) |
| Create a wallet | `mm wallet create` | [wallet.md](references/wallet.md) |
| List all wallets | `mm wallet list` | [wallet.md](references/wallet.md) |
| Switch active wallet | `mm wallet select` | [wallet.md](references/wallet.md) |
| Show active wallet details | `mm wallet show` | [wallet.md](references/wallet.md) |
| Show active wallet address | `mm wallet address` | [wallet.md](references/wallet.md) |
| Check the active wallet balance | `mm wallet balance` | [wallet.md](references/wallet.md) |
| Show current trading mode and policies | `mm wallet trading-mode get` | [wallet.md](references/wallet.md) |
| Show a QR code and address to fund the active wallet | `mm wallet add-fund` | [wallet.md](references/wallet.md) |
| Show current trading mode | `mm wallet trading-mode get` | [wallet.md](references/wallet.md) |
| Set trading mode (guard or beast) | `mm wallet trading-mode set` | [wallet.md](references/wallet.md) |
| View wallet policy | `mm wallet policy get` | [wallet.md](references/wallet.md) |
| Set wallet policy | `mm wallet policy set` | [wallet.md](references/wallet.md) |
| Show project policy template | `mm wallet policy template` | [wallet.md](references/wallet.md) |
| Sign a plaintext message | `mm wallet sign-message` | [signing.md](references/signing.md) |
| Sign EIP-712 typed data | `mm wallet sign-typed-data` | [signing.md](references/signing.md) |
| Send a raw EVM transaction | `mm wallet send-transaction` | [transaction.md](references/transaction.md) |
Expand Down Expand Up @@ -95,6 +100,7 @@ Match the user's intent to a command and reference file, then read the reference
| Withdraw pUSD from Predict deposit wallet | `mm predict withdraw` | [predict.md](references/predict.md) |
| Fetch prediction order book | `mm predict book` | [predict.md](references/predict.md) |
| Watch a Predict job | `mm predict watch` | [predict.md](references/predict.md) |
| List recent transactions for the active wallet | `mm tx history` | [tx-history.md](references/tx-history.md) |
| Get a swap or bridge quote | `mm swap quote` | [swap.md](references/swap.md) |
| Execute a token swap or bridge | `mm swap execute` | [swap.md](references/swap.md) |
| Check swap or bridge status | `mm swap status` | [swap.md](references/swap.md) |
Expand Down Expand Up @@ -135,7 +141,7 @@ Every `mm` command accepts these flags:

| Flag | Short | Description |
| --- | --- | --- |
| `--format` | `-f` | Output format: `text`, `json`, `yaml`, `toml`, or `toon` (defaults to `text` in TTY, `json` when piped) |
| `--format` | `-f` | Output format: `text`, `json`, or `toon` (defaults to `text` in TTY, `json` when piped) |
| `--json` | | Shorthand for `--format=json` |
| `--toon` | | Shorthand for `--format=toon` |
| `--verbose` | `-v` | Show debug logs on stderr. Use for troubleshooting |
Expand All @@ -148,21 +154,21 @@ Run these checks before the first CLI operation in a session, in order.

### 1. Version compatibility

This skill is written for `@metamask/agentic-cli` **v1.0.0** (see `cliVersion` in the frontmatter). Check the installed version:
This skill is written for `@metamask/agentic-cli` **v2.0.0** (see `cliVersion` in the frontmatter). Check the installed version:

```bash
mm --version
```

The installed version is the value after `@metamask/agentic-cli/` (e.g. `@metamask/agentic-cli/1.0.0 darwin-arm64 node-v24.14.1`). Compare its `major.minor` against the pinned `cliVersion`. Optionally check the latest published version (best-effort; skip silently on network failure):
The installed version is the value after `@metamask/agentic-cli/` (e.g. `@metamask/agentic-cli/2.0.0 darwin-arm64 node-v22.18.0`). Compare its `major.minor` against the pinned `cliVersion`. Optionally check the latest published version (best-effort; skip silently on network failure):

```bash
npm view @metamask/agentic-cli version
```

If the installed `major.minor` differs from the pinned `cliVersion`, or the installed version is behind the latest release, warn the user once and continue:

> Version mismatch: installed CLI `<installed>`, this skill is pinned to `1.0.0`, latest release is `<latest>`. Command syntax in this skill may be inaccurate until they are aligned. Update the CLI with `npm install -g @metamask/agentic-cli@latest`, then re-install the skills with `npx skills add metaMask/agent-skills`.
> Version mismatch: installed CLI `<installed>`, this skill is pinned to `2.0.0`, latest release is `<latest>`. Command syntax in this skill may be inaccurate until they are aligned. Update the CLI with `npm install -g @metamask/agentic-cli@latest`, then re-install the skills with `npx skills add metaMask/agent-skills`.

Run this check once per session. Do not block operations on it.

Expand Down
14 changes: 7 additions & 7 deletions skills/metamask-agent-wallet/references/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Use these commands to initialize wallet mode, sign in, inspect authentication st

## `init` Command

Initialize the project by selecting wallet mode and trading mode. Requires an authenticated session — run `mm login` first.
Initialize the project by selecting wallet mode and trading mode. Requires an authenticated session. Run `mm login` first.

### Syntax

Expand All @@ -18,8 +18,8 @@ mm init [--wallet <mode>] [--mode <mode>] [--mnemonic <phrase>] [--password <pas
| --- | --- | --- |
| `--wallet` | No | Wallet mode: `server-wallet` or `byok` |
| `--mode` | No | Trading mode: `guard` or `beast` (server-wallet only) |
| `--mnemonic` | No | BIP-39 mnemonic phrase for BYOK wallet. Never pass inline — set `MM_MNEMONIC` env var instead. |
| `--password` | No | Password to encrypt the BYOK mnemonic at rest. Never pass inline — set `MM_PASSWORD` env var instead. If omitted in interactive mode, the CLI prompts. If omitted in non-interactive mode, mnemonic is stored unencrypted. |
| `--mnemonic` | No | BIP-39 mnemonic phrase for BYOK wallet. Never pass inline. Set `MM_MNEMONIC` env var instead. |
| `--password` | No | Password to encrypt the BYOK mnemonic at rest. Never pass inline. Set `MM_PASSWORD` env var instead. If omitted in interactive mode, the CLI prompts. If omitted in non-interactive mode, mnemonic is stored unencrypted. |

### Example

Expand All @@ -36,11 +36,11 @@ mm init --wallet byok

### Note

- In server-wallet mode, if the account already has a remote EVM wallet, `mm init` syncs it and loads the existing trading mode and policies instead of prompting for a new trading mode or creating a wallet.
- In server-wallet mode, if the account already has a remote EVM wallet, `mm init` syncs it and loads the existing trading mode instead of prompting for a new trading mode or creating a wallet. Use `mm wallet policy get` to view the wallet policy.

## `init show` Command

Display the current initialization settings (wallet mode, trading mode, policies).
Display the current initialization settings (wallet mode, trading mode). Use `mm wallet policy get` to view the wallet policy separately.

### Syntax

Expand Down Expand Up @@ -150,7 +150,7 @@ mm config get [env|verbose|format]
| --- | --- |
| `env` | Target API environment: `prod`, `dev`, or `uat` (defaults to `prod` when unset) |
| `verbose` | Whether verbose logging is persisted (`true` or `false`) |
| `format` | Default output format: `json`, `text`, `yaml`, `toml`, or `toon` |
| `format` | Default output format: `json`, `text`, or `toon` |

Omit the key to return all values.

Expand All @@ -177,7 +177,7 @@ mm config set <env|verbose|format> <value>
| --- | --- |
| `env` | `prod`, `dev`, or `uat` |
| `verbose` | `true` or `false` |
| `format` | `json`, `text`, `yaml`, `toml`, or `toon` |
| `format` | `json`, `text`, or `toon` |

### Overrides

Expand Down
44 changes: 44 additions & 0 deletions skills/metamask-agent-wallet/references/doctor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Doctor command

Use `mm doctor` to inspect CLI version, AI skills, environment, and session health. This command does not require authentication or initialization.

## `doctor` command

### Syntax

```bash
mm doctor
```

### Supported flags

This command does not support additional flags beyond output format options.

### Output

| Field | Type | Description |
| --- | --- | --- |
| `cli` | string | Installed CLI version |
| `env` | string | Current environment (`prod`, `dev`, or `uat`) |
| `authenticated` | boolean | Whether the CLI session is valid |
| `initialized` | boolean | Whether you have run `mm init` (wallet mode and trading mode are set for server wallets) |
| `recommendedSkills` | object | Installed MetaMask AI skill status for `metamask-agent-wallet` and `metamask-agent-workflows` |
| `compatible` | boolean or null | Whether the installed CLI version is compatible with the installed skills. `null` if no skills are detected |
| `hints` | string[] | Actionable guidance, for example missing skills, auth issues, init needed, or version mismatch |

### Skill detection

`mm doctor` detects installed skills from the global skills lock file (`~/.agents/.skill-lock.json` or `$XDG_STATE_HOME/skills/.skill-lock.json`). It parses `SKILL.md` frontmatter for the skill `version` and `cliVersion` metadata, then checks the CLI `major.minor` against the skill `cliVersion` requirement.

### Example

```bash
mm doctor
mm doctor --toon
```

### Notes

- Use as the first step in troubleshooting to check if CLI, auth, init, and skills are healthy.
- Run after a CLI upgrade to verify skill compatibility.
- Use in CI or scripting to confirm environment and session state.
8 changes: 7 additions & 1 deletion skills/metamask-agent-wallet/references/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ This reference lists error codes the CLI actually emits. SDK-only or remapped co
| Code | Meaning |
| --- | --- |
| `ABORTED` | Operation aborted by user |
| `NOT_INITIALIZED` | Project not initialized — run `mm init` |
| `NOT_INITIALIZED` | Project not initialized. Run `mm init` |
| `NO_MNEMONIC` | Mnemonic not stored |
| `NO_TTY` | No TTY available for interactive prompts |
| `MISSING_ID` | Missing ID parameter |
Expand Down Expand Up @@ -150,6 +150,12 @@ This reference lists error codes the CLI actually emits. SDK-only or remapped co
| `PREDICT_GEOBLOCKED` | Polymarket is not available in your region; Predict features cannot be used from this location. Emitted by `mm predict setup` (region guard) and surfaced by `mm predict geoblock` |
| `UNSUPPORTED_PREDICT_CHAIN` | Predict chain not supported |

## Transaction History Errors

| Code | Meaning |
| --- | --- |
| `NO_HISTORY_WALLETS` | No EVM wallets found in roster for transaction history |

## Network & Filesystem Errors

| Code | Meaning |
Expand Down
37 changes: 37 additions & 0 deletions skills/metamask-agent-wallet/references/tx-history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Transaction history command

Use `mm tx history` to list recent transactions for the active wallet or specific addresses.

## `tx history` command

### Syntax

```bash
mm tx history [--addresses <addrs>] [--chain <chains>] [--type <filter>] [--limit <n>]
```

### Supported flags

| Name | Required | Description |
| --- | --- | --- |
| `--addresses` | No | Comma-separated EVM wallet addresses to include. Defaults to all EVM wallets for your account |
| `--chain` | No | Comma-separated chain filters (e.g. `1,137` or `eip155:1`). Run `mm chains list` to see options |
| `--type` | No | Filter by direction (`in`, `out`, `self`) or transaction category/type |
| `--limit` | No | Maximum number of transactions to return (1-500, default 50) |

### Example

```bash
mm tx history
mm tx history --limit 10 --toon
mm tx history --chain 1,8453
mm tx history --type out
mm tx history --addresses 0x742d...f2bD18 --chain 137 --limit 100
```

### Notes

- If you omit `--addresses`, the command queries all EVM wallets for your account.
- Addresses must be 0x-prefixed EVM addresses.
- `--limit` must be between 1 and 500. Values outside this range return an `INVALID_LIMIT` error.
- If your account has no EVM wallets, the command returns a `NO_HISTORY_WALLETS` error.
89 changes: 88 additions & 1 deletion skills/metamask-agent-wallet/references/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,32 @@ mm wallet address
mm wallet address --chain-namespace evm
```

## `wallet add-fund` Command

Show a QR code and address to fund the currently active wallet. In interactive mode (TTY or REPL), renders an ASCII QR code plus the address. In headless mode (`--json`, piped stdout), outputs the address only.

### Syntax

```bash
mm wallet add-fund [--chain-namespace <namespace>]
```

### Supported Flags

| Name | Required | Description |
| --- | --- | --- |
| `--chain-namespace` | No | Wallet chain namespace: `evm` (EIP-155) (allowed: `evm`) |

### Example

```bash
mm wallet add-fund
mm wallet add-fund --toon
```

## `wallet trading-mode get` Command

Show the current trading mode, active server-wallet address, and policies for the selected wallet. Server-wallet mode only.
Show the current trading mode and active server-wallet address for the selected wallet. Server-wallet mode only.

### Syntax

Expand Down Expand Up @@ -166,6 +189,70 @@ mm wallet trading-mode set guard
mm wallet trading-mode set beast
```

## `wallet policy get` Command

Show the policy for the active server wallet. Server-wallet mode only.

### Syntax

```bash
mm wallet policy get
```

### Supported Flags

This command does not support additional flags beyond output format options.

### Example

```bash
mm wallet policy get
mm wallet policy get --toon
```

## `wallet policy set` Command

Set the policy for the active server wallet. Server-wallet mode only.

### Syntax

```bash
mm wallet policy set --policy <yaml>
```

### Supported Flags

| Name | Required | Description |
| --- | --- | --- |
| `--policy` | Yes | Policy string to apply |

### Example

```bash
mm wallet policy set --policy "maxDailyOutflow: 1000"
```

## `wallet policy template` Command

Show the project policy template. Server-wallet mode only.

### Syntax

```bash
mm wallet policy template
```

### Supported Flags

This command does not support additional flags beyond output format options.

### Example

```bash
mm wallet policy template
mm wallet policy template --toon
```

## `wallet balance` Command

Show native and token balances for the active wallet.
Expand Down
2 changes: 1 addition & 1 deletion skills/metamask-agent-wallet/workflows/bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Use this workflow when the user wants to bridge tokens across chains.

Reference command syntax in `references/swap.md`. The CLI uses the same `swap` commands for bridging — set `--to-chain` to a different chain than `--from-chain`.
Reference command syntax in `references/swap.md`. The CLI uses the same `swap` commands for bridging. Set `--to-chain` to a different chain than `--from-chain`.

## Flow

Expand Down
8 changes: 7 additions & 1 deletion skills/metamask-agent-wallet/workflows/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ Use this workflow when a command fails, hangs, prompts unexpectedly, or behaves

## Universal Triage

Run or suggest these in order:
Run `mm doctor` first to inspect CLI version, skills, environment, and session health in one shot:

```bash
mm doctor
```

If you need more detail, run these in order:

```bash
mm --version
Expand Down
Loading