MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getFilePathFromToolInput

Function getFilePathFromToolInput

src/utils/collapseReadSearch.ts:71–76  ·  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

69 * Handles both `file_path` (Read/Write/Edit) and `path` (Grep/Glob).
70 */
71function getFilePathFromToolInput(toolInput: unknown): string | undefined {
72 const input = toolInput as
73 | { file_path?: string; path?: string; pattern?: string; glob?: string }
74 | undefined
75 return input?.file_path ?? input?.path
76}
77
78/**
79 * 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