Skip to main content
Glama
carloshpdoc

memorydetective

Regex-search a Swift file (no LSP)

swiftSearchPattern

Search Swift source files with pure regex to find patterns like closure capture lists and Task self references that SourceKit-LSP misses.

Instructions

[mg.code] Pure regex search over a file's contents — no SourceKit-LSP, no IndexStoreDB. Catches what LSP misses: closure capture lists ([weak self], [unowned self]), Task { ... self ... } blocks, and any other pattern the agent constructs from a leak chain. Returns matches with line/character positions and a trimmed snippet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute path to a Swift source file.
patternYesRegex pattern (JavaScript flavour). The `g` flag is implied — every match is returned.
flagsNoAdditional RegExp flags ("i", "m", "s", "im", etc.).
maxMatchesNoCap on matches returned (default 50).
Behavior4/5

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

Despite no annotations, the description discloses that the tool uses pure regex (no LSP), returns matches with line/character positions and trimmed snippets. It does not mention performance characteristics or side effects, but the behavior is adequately described for a read-only search tool.

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?

The description is a single paragraph that efficiently conveys purpose, differentiation, and return format. It avoids redundancy and is front-loaded with the most critical information.

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?

The description explains the return format (positions and snippet) and provides context for why the tool is useful (catches LSP misses). For a regex search tool without an output schema, this is sufficient to guide an agent.

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

Parameters4/5

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

Schema coverage is 100%, and the description adds value by clarifying the regex flavor (JavaScript), implying the 'g' flag, and providing use cases that illustrate how parameters are used. This goes beyond what the schema alone 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?

The description states it performs pure regex search over Swift file contents, specifically targeting patterns missed by LSP-based tools. It clearly distinguishes from sibling tools like swiftFindSymbolReferences by explicitly mentioning no SourceKit-LSP or IndexStoreDB dependency.

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 implies usage when LSP-based searches fail, giving concrete examples like closure capture lists and Task blocks. While it doesn't explicitly state when not to use, the contrast with LSP tools is clear from the context of sibling tools.

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