Skip to content

Add rtk mysql — token-optimized MySQL client output (parity with rtk psql) #3130

Open

Description

@adam-msjc

RTK already wraps psql but not mysql. In a Claude Code agent workflow doing DB reporting, mysql is one of the top unhandled commands — 34 invocations in the last 30 days (per rtk discover) — and the raw result sets (wide tables, many rows) are exactly the large tool-output RTK is built to shrink. Today they pass through raw.

Request

A rtk mysql wrapper analogous to rtk psql that executes the query and returns a token-optimized rendering of the result set:

  • compact column widths
  • repeated-value elision
  • row truncation with an "N more rows" footer
  • null/blank normalization

…plus a rewrite-registry entry so mysql … auto-rewrites through the Claude Code hook.

Invocation patterns to handle

  • mysql --defaults-file=<cnf> -e "SQL" — must preserve --defaults-file (credentials are never passed on the CLI)
  • mysql -h <host> -u <user> <db> -e "SQL"
  • batch mode -B (TSV) and table mode -t

Example

mysql --defaults-file=/tmp/.my.cnf -t -e "SELECT ..."

→

rtk mysql --defaults-file=/tmp/.my.cnf -t -e "SELECT ..."

Why it matters

rtk psql already proves the pattern works for Postgres; MySQL parity would close one of the largest remaining raw-output gaps for teams whose reporting/analytics runs against MySQL.

Filed from findings via rtk discover (rtk 0.38.0, hook v3).

Activity

  1. added
    enhancement
    help wanted
    on Jul 21, 2026
  2. pszymkowiak commented on Jul 21, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟡 Priority medium
    🎯 Confidence 87%

    Summary

    Add an rtk mysql wrapper with token-optimized result-set rendering (parity with existing rtk psql) plus a rewrite-registry entry; well-specified with concrete invocation patterns and usage data (34 unhandled calls/30d).

    📁 Relevant files
    • src/filters/psql.rs
    • src/registry.rs
    • filters.toml

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. henit-chobisa commented on Jul 22, 2026

    @henit-chobisa

    Hi! I'd like to take this on. My plan is to mirror the existing rtk psql implementation, adapting the parsing for MySQL's output — handling both batch mode (-B, TSV) and table mode (-t), and making sure --defaults-file is preserved untouched (never logging credential-bearing args).

    Heads-up that I'm fairly new to the rtk codebase, so I'll spend a little time studying how psql and the command/rewrite registration work before I open a PR — so this may take me a bit longer than a regular contributor, but I'll keep it moving. I would very much appreciate your feedback on the PR and the approach if that's okay?

  4. henit-chobisa commented on Jul 22, 2026

    @henit-chobisa

    Hey there, I've explored around, and found the codebase quite easy to navigate actually. I'm an engineer at plane.so, and I worked on a similar project a few years back, pasting the link here.

    https://x.com/planepowers/status/1783503768690340077

    That's the reason, I found the codebase quite familiar and easy to navigate. I've raised the PR, for resolving this. Thanks!! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clienhancementhelp wantedpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions