Skip to main content
Glama
xcode-analyzer-mcp

xcode-analyzer-mcp

by sunny-maeng

fix_retain_cycles

Fix common retain cycles by adding weak to delegates, [weak self] to closures, and removeObserver in deinit. Previews changes by default before applying.

Instructions

Automatically fix common retain cycle patterns: add weak to delegates, add [weak self] + guard let self to closures, add removeObserver in deinit. Defaults to dry-run mode (preview only). Set dryRun to false to apply changes.

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": {
      "projectPath": "<projectPath>"
    },
    "name": "fix_retain_cycles"
  }
}

Input Schema

NameRequiredDescriptionDefault
dryRunNoPreview changes without modifying files (default: true)
categoriesNoWhich fix categories to apply (default: all)
projectPathYesPath to the Xcode project root directory
targetPathsNoSpecific files/directories to fix (default: entire project)
excludePatternsNoGlob patterns to exclude

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/5.0
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 and does disclose the most important behavior: this mutates source files, and it is safe by default because dryRun previews only. What it leaves out is what happens beyond the edit — reversibility, whether a backup or diff report is produced, and failure behavior on unparseable files.

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?

Front-loaded with the concrete fixes, then the safety default and the opt-out, in three tight sentences with no filler. The final sentence partially repeats the schema's own dryRun default note, which is defensible for a destructive-by-nature operation but is still slight redundancy.

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?

For a 5-parameter code-mutation tool with a fully described schema and no output schema, the description covers what it changes, its scope defaults, and its safe default mode. An agent has enough to decide and invoke it correctly.

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 all five parameters (including categories, targetPaths, excludePatterns) are already documented in the schema. The description only restates the dryRun default and adds no extra meaning about category semantics or glob syntax, so 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+resource ("fix common retain cycle patterns") and enumerates the exact transformations applied: weak delegates, [weak self] + guard let self, removeObserver in deinit. The mutation verb 'fix' cleanly distinguishes it from the sibling detect_retain_cycles without needing to name it.

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?

The description explains the dry-run default and the dryRun=false escape hatch, which is real operational guidance for applying changes. However, it gives no guidance on when to run this versus detect_retain_cycles first, no prerequisites (e.g., clean working tree), and no exclusions for cases where the automatic transform is unsafe.

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