1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude Code の組み込み mod「easel」でターミナルにグラフを描いてみた

1
Posted at

はじめに

Claude Code v2.1.330 で、ターミナルの会話の中にグラフを描く組み込み mod「easel」の追加が発表されました。

mod(Claude Code の見た目や動きを変えるプラグインの一種)として最初から入っており、インストール作業は要りません。

「グラフにして」と頼んだときと、MCP サーバーが時系列のメトリクスを返したときの 2 つの場面で、テキストだけのグラフが会話に描かれます。

easel でできること

Mods overview の「Mods built into Claude Code」では、/plugin に cc-plugin-easel という名前で出る組み込み mod として説明されています。

機能 例えばこう使う 止め方
チャートツール 「この CSV をグラフにして」 /plugin で mod ごと無効化
自動チャート Prometheus の range query の結果を MCP で取る /config の Auto charts をオフ

要件には、claude.ai のサブスクリプションでのログイン、macOS か Linux(WSL 以外)、v2.1.321 以降(Team / Enterprise は v2.1.326 以降)などがあります。 changelog では対象を Pro・Max と、提供されている場合の Team・Enterprise としています。手元の Pro プランでは、何も設定せずに有効になっていました。

やってみた

1. 頼んでグラフにしてみてもらう

CSV を貼って「グラフにして」と頼むと、Claude が easel - chart ツールを呼び、横棒グラフが描かれました。

❯ 次の CSV をグラフにして。
  tag,count
  AWS,15
  CloudFormation,3
  ...

⏺ easel - chart (MCP)(data: "tag,count\nAWS,15\n...", x: "tag", y: ["count"], form: "bars", title: "タグ別の件数")
  ⎿  タグ別の件数 · count
     AWS            ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆  15  53.6%
     CloudFormation ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆                                                               3  10.7%
     Bedrock        ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆                                                               3  10.7%
     AgentCore      ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆                                                               3  10.7%
     EC2            ▆▆▆▆▆▆▆▆▆▆                                                                    2   7.1%
     AWSCLI         ▆▆▆▆▆▆▆▆▆▆                                                                    2   7.1%
     total                                                                    28

形は折れ線・縦棒・横棒・小さな折れ線の並び(sparks)・構成比(share)から選ばれ、「縦棒で」のように指定もできます。

データを省略すると直前のツール結果がそのままグラフになるので(切り詰められた大きな結果は対象外)、集計コマンドを流して「今の結果をグラフに」と続けるのが手軽そうです。

2. MCP の結果に自動でグラフが付く

自動チャートは、Prometheus の range query(時間の範囲を指定して、メトリクスの推移を取る問い合わせ)のような形式の結果に付きます。

今回は手元に Prometheus がないため、同じ形式のダミーデータを返す MCP サーバーを用意して試しました。

ダミーの Prometheus MCP サーバー(クリックで展開)
fake_prom.py
#!/usr/bin/env python3
"""query_range 形式のダミーデータを返す最小の stdio MCP サーバー"""
import json, sys, math, time

def matrix():
    end = int(time.time()) // 60 * 60
    res = []
    for inst, base in (("web-1", 120), ("web-2", 90)):
        vals = []
        for i in range(60):
            v = base + 30 * math.sin(i / 8) + (80 if inst == "web-1" and 40 <= i <= 45 else 0)
            vals.append([end - (59 - i) * 60, f"{v:.1f}"])
        res.append({"metric": {"__name__": "http_requests_per_second", "instance": inst}, "values": vals})
    return {"status": "success", "data": {"resultType": "matrix", "result": res}}

def send(o):
    sys.stdout.write(json.dumps(o) + "\n"); sys.stdout.flush()

for line in sys.stdin:
    m = json.loads(line); mid, meth = m.get("id"), m.get("method")
    if meth == "initialize":
        send({"jsonrpc": "2.0", "id": mid, "result": {"protocolVersion": m["params"].get("protocolVersion", "2025-06-18"),
              "capabilities": {"tools": {}}, "serverInfo": {"name": "prometheus", "version": "0.0.1"}}})
    elif meth == "tools/list":
        send({"jsonrpc": "2.0", "id": mid, "result": {"tools": [{"name": "query_range",
              "description": "Run a PromQL range query against Prometheus (/api/v1/query_range).",
              "inputSchema": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]}}]}})
    elif meth == "tools/call":
        send({"jsonrpc": "2.0", "id": mid, "result": {"content": [{"type": "text", "text": json.dumps(matrix())}]}})
    elif mid is not None:
        send({"jsonrpc": "2.0", "id": mid, "result": {}})
claude mcp add prometheus -- python3 "$PWD/fake_prom.py"

「ピークの時刻を教えて」とだけ頼んだところ、グラフを頼んでいないのに、ツール結果の下に 2 系列の折れ線が描かれました。

❯ ダミーデータを返す Prometheus MCP サーバーで表示の動作確認をしています。query_range で
  http_requests_per_second を取得して、ピークの時刻を教えて

  Called prometheus
  ⎿  http_requests_per_second · Nov 22 2026 06:23 → 07:22 UTC
     a web-1  max 182 at 07:08  last 147  min 90  mean 130
     b web-2  max 120 at 06:36  last 117  min 60  mean  92
         │                                                                 ⣀⡠⠤⠤⠔⠒⠊⠉⢹
     150 ┤┈┈┈┈┈┈┈┈┈┈┈┈⣀⣀⡠⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢄⣀⣀⡀┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈⢠⠃┈┈┈┈┈┈┈┈⡇┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈⣀⣀⣀ a
         │⣀⠤⠖⠊⠉            ⣀⣀⣀⣀⣀⣀⣀⡀           ⠉⠑⠒⠤⣄⡀                      ⡜         ⢸      ⢀⣀⡤⠔⠊⠉⠁
     100 ┤┈┈⣀⠤⠖⠒⠉⠁┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈⠈⠉⠒⠢⠤⣄⡀┈┈┈┈┈┈┈⠉⠉⠒⠢⠤⢄⣀⣀┈┈┈┈┈┈┈┈⢠⠃┈┈┈┈┈┈┈┈┈┈⠉┈┈┈┈┈┈┈┈⣀⡤⠔⠒⠉⠉┈┈┈  b
         │                                                   ⠈⠉⠑⠒⠒⠦⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠖⠒⠚⠉⠉
         └───────────┬───────────────┬────────────────┬───────────────┬───────────────┬────────────────┬───
                     06:30           06:40            06:50           07:00           07:10           07:20
     auto chart · turn off in /config: Auto charts

(グラフは途中の行を省略しています)07:00 過ぎの web-1 だけの急上昇が一目で分かり、数値の羅列を読むより状況をつかみやすそうです。

まとめ

  • 「グラフにして」と頼むだけで、ターミナルの中で棒グラフや折れ線が見られるようになりました
  • Prometheus などのメトリクスを MCP で扱っている人は、頼まなくてもグラフが付くので恩恵が大きそうです
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?