Open a local Java heap dump (.hprof) by absolute path. Starts MAT indexing in the background and returns a report_id immediately with status=PARSING. Poll get_heapdump_status until DONE. / 按绝对路径打开本地 Java 堆转储(.hprof)。后台启动 MAT 解析并立即返回 report_id 与 status=PARSING,用 get_heapdump_status 轮询直到 DONE。
输入参数path必填
Get parse status and progress for a heap dump report. / 查询堆转储报告的解析状态与进度。
输入参数report_id必填
List heap dumps known to this MCP server with their status. / 列出本 MCP 服务已知的堆转储及其状态。
无需输入参数。
Release a heap dump handle. Set stop_service=true to also stop the MAT helper process. / 释放堆转储句柄;stop_service=true 时同时停止 MAT 辅助进程。
输入参数report_id必填stop_service
Discover local Java processes that can be attached for a live heap dump. Returns pid, main class, command, and masked JVM arguments. The managed MAT helper is excluded. / 主动发现本机可 attach 的 Java 进程,返回 pid、主类、命令行和已掩码的 JVM 参数;MAT 辅助进程会被排除。
无需输入参数。
Capture a LIVE heap dump from a running JVM and start MAT parsing. First call with confirm=false (default) to preview the target, output directory, disk space, and timeout; call again with confirm=true to execute. A live dump triggers a Full GC and may pause the target JVM. The dump is written to output_dir (default: current working directory) and is automatically opened for MAT parsing. / 从运行中的 JVM 抓取 live 堆转储并自动开始 MAT 解析。先用默认 confirm=false 预览目标、输出目录、磁盘空间和超时,再用 confirm=true 执行。live dump 会触发 一次 Full GC,可能暂停目标 JVM;默认输出到当前目录。
输入参数pid必填confirmtimeoutoutput_dir
Show heap overview (used/committed/live heap, object/class/classloader counts, JDK version, leak suspect count). Always call this first to understand a heapdump. / 展示堆总览(已用/已提交/存活堆、对象/类/类加载器数量、JDK 版本、泄漏嫌疑数量)。分析 heapdump 时先调用本工具。
输入参数report_id必填
Class histogram sorted by shallow/retained/count. Top-N by default; pass top to override. objectSet reuses a prior OQL/RS result. / 按 shallow/retained/count 排序的类直方图,默认 Top-20。objectSet 可复用先前 OQL/RS 结果。
输入参数topsortobjectSetreport_id必填
Dominator tree: list biggest retained-heap dominators, drill down by passing parent objectId. / 支配树:列出 retained 最大的支配者,传 parent=objectId 可下钻。
输入参数topparentreport_id必填
List threads (name/state/daemon/frameCount), or drill into a thread's stack frames (pass thread=id) or frame locals (pass frame=idx). / 列出线程(名/状态/daemon/帧数),或下钻到某线程的栈帧(传 thread=id)、某帧的局部变量(再传 frame=idx)。
输入参数framethreadreport_id必填
Inspect thread locals grouped by valueClass (default) or thread. Useful for finding thread-local leaks. / 按 valueClass(默认)或 thread 分组查看 ThreadLocal,常用于发现 ThreadLocal 泄漏。
输入参数groupByreport_id必填
Inspect a single object (class, fields, statics, in/out refs, GC root). Required: object id. / 检查单个对象(类、字段、静态字段、入/出引用、GC Root)。必须传 object id。
输入参数id必填report_id必填
mat_path2gc
Path to GC roots
Read-only, synchronous lookup of the shortest reference chains from one object to GC roots, explaining why that object is still reachable and not collected. Returns up to five linear paths plus MAT's path tree. Typical flow: get an object id from mat_object, mat_histogram, mat_dominator, or a mat_leak_suspects preferredObjectId, confirm it with mat_object, then call this tool. Use mat_dominator instead when you want to know which object retains an entire subtree; use mat_leak_suspects when you do not yet have a specific object. Requires the report_id of a parsed dump (status=DONE).
输入参数object必填report_id必填excludeWeakSoft
Run an OQL query against the heap (slow!). Returns rows + a reusable resultSetId. Examples: "SELECT * FROM com.example.Foo s", "SELECT s.id.toString() FROM java.lang.String s". OQL can read arbitrary strings from the heap; handle results as private data. / 执行 OQL 查询(较慢)。返回行和可复用的 resultSetId。示例:SELECT * FROM com.example.Foo s。OQL 可读取堆内任意字符串,注意隐私。
输入参数q必填sortviewlimitreport_id必填
Run LeakHunter (async) — returns leak suspects with retained size and description. SLOW: may take a minute. / 运行 LeakHunter(异步),返回疑似泄漏点及 retained 大小与描述。慢查询,可能耗时数十秒。
输入参数report_id必填
Run comprehensive OOM diagnosis (async) combining leak suspects + SQL-in-threads + dominator analysis. / 综合 OOM 诊断(异步),聚合泄漏嫌疑、线程中的 SQL、支配树分析。
输入参数onlyRiskyreport_id必填culpritPct
Diagnose DB connection pools (active/idle counts + leaked connections held > thresholdMs). / 诊断数据库连接池(活跃/空闲数 + 持有超过 thresholdMs 的泄漏连接)。
输入参数report_id必填thresholdMs
mat_top_consumers
Top memory consumers
Read-only Top Consumers report: biggest individual objects plus retained-size breakdowns by class, class loader, and package. Use this as a quick 'who is using the most memory' overview after mat_overview. Prefer mat_histogram when you need a sortable list of every class with instance counts and shallow/retained sizes, and mat_dominator when you need to walk the object graph downward from a specific parent object. Requires the report_id of a parsed dump (status=DONE).
输入参数report_id必填
mat_sql_in_threads
SQL in thread stacks
Read-only scan of thread stacks for JDBC PreparedStatement objects and SQL strings, used to spot long-running or heavy queries held by threads at OOM time. Requires the report_id of a parsed dump (status=DONE). Results are sorted risky-first, then by the owning thread's retained heap, and include threadId, threadName, threadRetainedBytes, frame, source, objectId, sql, risk (risky|harmless|unknown), and reason. With onlyRisky=true, heartbeat/validation statements such as SELECT 1, SELECT 'x', /* ping */ and VALUES(1) are filtered out; pass onlyRisky=false to see all SQL-like strings.
输入参数onlyRiskyreport_id必填