Skip to main content
Glama
carloshpdoc

memorydetective

Run an XCUITest with leak detection (CI-runnable)

detectLeaksInXCUITest

Detect new retain cycles in XCUITest runs by diffing memory graph snapshots before and after a test cycle, failing CI when unexpected leaks appear.

Instructions

[mg.ci] Build the workspace for testing, launch the test cycle, capture a baseline .memgraph once the app appears, run the test to completion, capture an after .memgraph, and diff. Returns passed: false when new ROOT CYCLE blocks appear that aren't in the allowlistPatterns list. Designed for CI gating: non-zero exit code on failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesPath to the .xcworkspace or .xcodeproj for the project.
schemeYesXcode scheme that builds and runs the XCUITest target.
testIdentifierYesXCUITest identifier in `<TestTarget>/<TestClass>/<testMethod>` form. Passed to `-only-testing` so we run exactly one test cycle.
appNameYesApp process name as it appears in `pgrep -x` (e.g. "DemoApp").
destinationNoxcodebuild destination string. Default targets the most common iOS Simulator profile.platform=iOS Simulator,name=iPhone 11,OS=latest
outputDirNoDirectory where the baseline + after `.memgraph` snapshots are written./tmp/memorydetective-xcuitest
allowlistPatternsNoSubstrings of class names that are allowed to leak. Examples: pre-existing SwiftUI internals you can't fix, third-party SDK leaks. Cycles whose root class contains any of these substrings won't fail the run.
skipBuildNoSkip the build-for-testing step (faster on CI when the build is already cached).
outputHtmlPathNoAbsolute path to write a self-contained HTML report (inline CSS, no external assets). When set, the response also gains an `htmlReportPath` field pointing at the same file. Designed for CI artifact upload + PR-comment attachment.
Behavior4/5

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

With no annotations, the description effectively discloses key behaviors: building, launching, capturing baseline/after memgraphs, diffing, and returning pass/fail based on new root cycle blocks. It also explains the allowlist mechanism and CI gating exit code. Some side effects (like temp files in outputDir) are implicit but clear enough.

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 a single focused paragraph, immediately front-loaded with the CI tag. Every sentence adds value: it covers build, capture, diff, fail condition, allowlist usage, and exit code. No wasted words.

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?

Although there is no output schema, the description explains return behavior ('passed: false' on failure, non-zero exit code) and mentions the optional htmlReportPath field. It does not explicitly describe the success return value or other response fields, but for a 9-parameter tool this is adequate.

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% with good parameter descriptions. The tool description adds high-level context (e.g., why appName is needed for pgrep, what allowlistPatterns do) but does not go beyond the schema's own descriptions substantially. Baseline 3 is appropriate.

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 an XCUITest with leak detection, capturing two memgraphs and diffing them. It distinguishes from siblings like 'detectLeaksInXCTest' (which likely targets XCTest) and other analyze tools by specifying XCUITest+CI gating.

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 explicitly says 'Designed for CI gating: non-zero exit code on failure', implying usage in CI pipelines. However, it does not mention when not to use this tool or suggest alternatives like other memory analysis tools for non-test scenarios.

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