Skip to main content
Glama
carloshpdoc

memorydetective

Count instances reachable from a specific cycle root

reachableFromCycle

Count objects reachable from a retain cycle root to distinguish the culprit from its dependencies. Get per-class counts and total reachable nodes by specifying a cycle index or root class name.

Instructions

[mg.memory] Cycle-scoped reachability + class counting. Answers questions like "how many NSURLSessionConfiguration instances are reachable from the cycle rooted at DetailViewModel?" — distinguishing the actual culprit (the cycle root) from its retained dependencies. Pick a cycle by zero-based cycleIndex or by rootClassName substring. Returns per-class counts ranked by occurrence, plus the total reachable node count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to a `.memgraph` file.
cycleIndexNoZero-based index of the ROOT CYCLE to scope to. Mutually exclusive with `rootClassName`. When neither is given, defaults to cycle index 0.
rootClassNameNoSubstring of the root cycle's class name (e.g. "DetailViewModel"). Picks the first ROOT CYCLE whose root matches. Mutually exclusive with `cycleIndex`.
classNameNoOptional filter — only count nodes whose className contains this substring. When omitted, returns the full per-class breakdown.
topNNoCap on per-class entries returned (default 20).
verbosityNoClass-name verbosity for the response. See analyzeMemgraph for the same flag.compact
Behavior4/5

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

No annotations provided, so description carries full burden. It details the return format (per-class counts, total reachable node count) and explains default behavior for cycleIndex. Does not mention potential errors or side effects, but for a read-only analysis tool this is acceptable.

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

Conciseness4/5

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

Description is front-loaded with purpose and includes a concrete example. It is slightly verbose but each sentence adds value. Could be streamlined, but overall well-structured.

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?

Given no output schema and six parameters, description adequately explains output and parameter usage. It covers the primary use case and parameter interplay. Lacks error handling details, but that is secondary for this tool.

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%, so baseline is 3. Description adds some value beyond schema (e.g., output format, cycleIndex default), but does not significantly enhance understanding of individual parameters beyond what the schema already provides.

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?

Description begins with '[mg.memory] Cycle-scoped reachability + class counting' and provides a concrete example ('how many NSURLSessionConfiguration instances are reachable from the cycle rooted at DetailViewModel?'). It clearly identifies the tool's function and distinguishes it from sibling tools by focusing on cycle-root scoped reachability rather than general leak analysis.

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?

Description explains how to select a cycle via cycleIndex or rootClassName, and gives a concrete question the tool answers. It lacks explicit when-not-to-use or alternative tool mentions, but the guidance is sufficient for the intended use case.

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