Skip to content

Add visualize MCP tool for auto-plotting variables #6

@samtalki

Description

@samtalki

What

Add a visualize MCP tool that takes a variable name (or expression) from the current session and generates an appropriate UnicodePlots visualization based on the data type.

Why

Right now, plotting requires the user to know UnicodePlots API, import it, and write the right incantation. A visualize tool would let Claude (or the user) just say "visualize x" and get the right plot automatically.

How it would work

visualize(variable="x")              # auto-detect: vector → lineplot, matrix → heatmap
visualize(variable="df.age")         # column from a DataFrame → histogram
visualize(variable="loss_history", type="line")  # explicit type override

Type detection logic:

  • Vector{<:Real}lineplot (index vs value) or histogram (if looks like samples)
  • Matrix{<:Real}heatmap
  • Two vectors of same length → scatterplot
  • Named tuple / Dict of numbers → barplot
  • DataFrame column → histogram

The tool would:

  1. Check if UnicodePlots is loaded on the worker, offer to install if not
  2. Inspect the variable's type and size via get_worker_info patterns
  3. Generate and execute the appropriate plot code
  4. Return the rendered plot with ANSI colors

Scope

  • New file: src/visualize.jl
  • New tool registration in src/tools.jl
  • Add to plugin skills
  • Tests for type detection logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions