Skip to main content
Glama
carloshpdoc

memorydetective

Analyze a .memgraph file

analyzeMemgraph

Analyze .memgraph files to detect retain cycles and memory issues using the leaks command. Get structured summaries, cycle classifications, and actionable diagnostics for iOS memory debugging.

Instructions

[mg.memory] Run leaks(1) against a .memgraph file (exported from Xcode Memory Graph Debugger) and return a structured summary: header info, totals, top-level ROOT CYCLE blocks with chain length, plain-English diagnosis. Set fullChains: true to also include the full nested retain forest.

Pipeline: → classifyCycle (named-antipattern + fix hint) → reachableFromCycle (scope blame to a single root). The response includes suggestedNextCalls so the agent can chain without re-reasoning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to a `.memgraph` file (export from Xcode Memory Graph Debugger).
fullChainsNoWhen true, include the full nested retain chains in the response. Default false returns only top-level ROOT CYCLE summaries to keep payloads small.
verbosityNoClass-name verbosity. `compact` (default) drops module prefixes, collapses nested SwiftUI ModifiedContent into `+N modifiers`, and truncates deep generics with a hash placeholder. `normal` keeps more detail. `full` returns Swift demangled names verbatim.compact
maxClassesInChainNoCap on how many unique class names to surface per cycle's `classesInChain` array. Default 10, enough to identify app-level types without flooding the response.
referenceTreeTopNNoWhen `leakCount` is 0 (the typical abandoned-memory case), also run `leaks --referenceTree --groupByType --noContent` and surface the top N classes by live instance count in `abandonedMemoryTop[]`. Set to 0 to skip the second leaks invocation. Default 20.
outputFormatNoResponse format. Omitted or `json` (default, preserves v1.8 behavior) returns JSON.stringify of the result. `markdown` renders a human-readable view of the same data. `both` returns both content items in one response, so a client can display markdown to the user and parse JSON for the agent loop without a second call. `verify-fix-table` (v1.10, applies to `analyzeAbandonedMemory` and `diffMemgraphs`) emits a focused 4-column markdown comparison table (Class | Before | After | Delta) of the actionable rows; other tools fall back to `markdown` for this value.
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses the use of `leaks(1)`, the output structure, pipeline steps, and behavior of parameters like `fullChains` and `referenceTreeTopN`. However, it doesn't explicitly state that the tool is non-destructive or any authorization requirements, though the nature of the tool implies safety.

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?

The description is concise and well-structured: it starts with the main purpose, then details the pipeline, and finally explains parameters. Every sentence adds value without repetition, making it easy for an agent to parse quickly.

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

Completeness5/5

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

Given the tool's complexity with 6 parameters and no output schema, the description provides a thorough explanation of the output (header, totals, ROOT CYCLE blocks, diagnosis) and the pipeline. It also mentions `suggestedNextCalls`, ensuring the agent can chain tools effectively.

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

Parameters5/5

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

Schema coverage is 100%, but the description adds significant context beyond the schema. It explains the purpose of each parameter, such as what `fullChains` does, the meaning of `verbosity` levels, the function of `maxClassesInChain`, and the `outputFormat` options. This added value justifies a high score.

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?

The description clearly states the tool runs `leaks(1)` against a `.memgraph` file and returns a structured summary, specifying the verb, resource, and output format. It distinguishes from siblings like `analyzeAbandonedMemory` by focusing on memory graph debugging.

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

Usage Guidelines4/5

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

The description explains when to use the tool (for analyzing .memgraph files) and outlines the pipeline with `classifyCycle` and `reachableFromCycle`, including `suggestedNextCalls` for chaining. It could be more explicit about when not to use it versus alternatives, but the context of sibling tools provides sufficient guidance.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/carloshpdoc/memorydetective'

If you have feedback or need assistance with the MCP directory API, please join our Discord server