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

Function getFilePathFromToolInput

src/utils/collapseReadSearch.ts:91–96  ·  view source on GitHub ↗

* Extract the primary file/directory path from a tool_use input. * Handles both `file_path` (Read/Write/Edit) and `path` (Grep/Glob).

(toolInput: unknown)

Source from the content-addressed store, hash-verified

89 * Handles both `file_path` (Read/Write/Edit) and `path` (Grep/Glob).
90 */
91function getFilePathFromToolInput(toolInput: unknown): string | undefined {
92 const input = toolInput as
93 | { file_path?: string; path?: string; pattern?: string; glob?: string }
94 | undefined
95 return input?.file_path ?? input?.path
96}
97
98/**
99 * Check if a search tool use targets memory files by examining its path, pattern, and glob.

Callers 1

isMemoryWriteOrEditFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected