MCPcopy Create free account
hub / github.com/WJX20/claude-code / isMemorySearch

Function isMemorySearch

src/utils/collapseReadSearch.ts:101–124  ·  view source on GitHub ↗

* Check if a search tool use targets memory files by examining its path, pattern, and glob.

(toolInput: unknown)

Source from the content-addressed store, hash-verified

99 * Check if a search tool use targets memory files by examining its path, pattern, and glob.
100 */
101function isMemorySearch(toolInput: unknown): boolean {
102 const input = toolInput as
103 | { path?: string; pattern?: string; glob?: string; command?: string }
104 | undefined
105 if (!input) {
106 return false
107 }
108 // Check if the search path targets a memory file or directory (Grep/Glob tools)
109 if (input.path) {
110 if (isAutoManagedMemoryFile(input.path) || isMemoryDirectory(input.path)) {
111 return true
112 }
113 }
114 // Check glob patterns that indicate memory file access
115 if (input.glob && isAutoManagedMemoryPattern(input.glob)) {
116 return true
117 }
118 // For shell commands (bash grep/rg, PowerShell Select-String, etc.),
119 // check if the command targets memory paths
120 if (input.command && isShellCommandTargetingMemory(input.command)) {
121 return true
122 }
123 return false
124}
125
126/**
127 * Check if a Write or Edit tool use targets a memory file and should be collapsed.

Callers 1

collapseReadSearchGroupsFunction · 0.85

Calls 4

isAutoManagedMemoryFileFunction · 0.85
isMemoryDirectoryFunction · 0.85

Tested by

no test coverage detected