Skip to main content
Glama

Analyze Heap Histogram

analyze_heap_histo

Parses jmap -histo output to rank classes by bytes, report total heap, and flag suspected application-level memory leaks from non-JDK classes above 5% heap.

Instructions

Parse jmap -histo output: top classes by bytes, total heap, and suspected application-level memory leaks (non-JDK classes taking >5% heap).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "histo": "<histo>"
    },
    "name": "analyze_heap_histo"
  }
}

Input Schema

NameRequiredDescriptionDefault
histoYesOutput of `jmap -histo <pid>`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden, and it does disclose the non-obvious analysis rule: leaks are flagged only for non-JDK classes exceeding 5% of heap. That heuristic is genuinely valuable context an agent could not infer. Gaps remain on input limits (malformed or truncated histo output) and on how results are ordered or truncated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence with no filler, front-loading the action and input format before the returned artifacts. Every clause (top classes, total heap, leak rule) carries distinct information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter parse-only tool with no output schema, the description adequately covers input expectation, returned content, and the leak-detection threshold. What's missing is minor: result structure and behavior on unparseable input.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the single `histo` parameter is already documented as `jmap -histo <pid>` output in the schema. The description adds no format, size, or variant detail (e.g., `-live` output) beyond what the schema states, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Specific verb (parse) plus a precise resource (jmap -histo output) and it enumerates the three things it returns: top classes by bytes, total heap, and suspected leaks. It doesn't explicitly name or contrast with siblings like analyze_gc_log, which occupies adjacent memory-analysis territory, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by the required input: the agent must already have `jmap -histo <pid>` output in hand. There is no when-to-use vs. when-not guidance and no routing to sibling tools, which matters here because analyze_gc_log and analyze_thread_dump are plausible alternatives during a memory investigation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.