Skip to main content
Glama

sharphy_inspect_heap

Inspect managed heap allocations, generation sizes, fragmentation, and object leak retainers in a .NET memory dump to diagnose high memory usage, memory leaks, or OutOfMemoryException.

Instructions

Inspects managed heap allocations, generation sizes (Gen 0/1/2, LOH, POH), fragmentation, and object leak retainers in a memory dump. Use this tool when diagnosing high memory usage, memory leaks, or OutOfMemoryException. Do NOT use for general crash RCA (use 'sharphy_analyze_dump') or thread lock cycles (use 'sharphy_deadlock_detector'). Non-destructive, read-only inspection.

Input Schema

NameRequiredDescriptionDefault
dumpPathYesAbsolute path to the target memory dump file (.dmp)
topObjectsNoTop N object types ranked by total memory size

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does disclose the safety profile: 'Non-destructive, read-only inspection.' It does not mention prerequisites such as dump size limits, analysis duration, or behavior on an invalid/missing dumpPath, leaving some operational gaps for a heavy artifact-analysis tool.

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?

Three sentences, front-loaded with the capability, then routing guidance, then safety. Every sentence earns its place with zero filler.

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?

No output schema exists, but the description enumerates the kinds of findings returned (generation sizes, fragmentation, retainers), which partially substitutes. Minor gap: no indication of result volume or cost when analyzing a large dump.

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 coverage is 100%, so both dumpPath and topObjects are already fully documented in the schema. The description adds no further parameter meaning (e.g., how topObjects interacts with output size or whether generation data is always returned), so the baseline 3 applies.

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

Purpose5/5

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

States a specific verb ('Inspects') plus a precise resource list — heap allocations, Gen 0/1/2/LOH/POH sizes, fragmentation, and leak retainers in a memory dump. This is clearly distinguishable from sharphy_analyze_dump and sharphy_deadlock_detector, which the description names.

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

Usage Guidelines5/5

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

Gives an explicit positive trigger (high memory usage, memory leaks, OutOfMemoryException) and explicit exclusions with named alternatives for crash RCA and thread lock cycles. An agent needs no inference to route between these siblings.

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