MCPcopy
hub / github.com/codeaashu/claude-code / call

Function call

src/tools/GrepTool/GrepTool.ts:310–576  ·  view source on GitHub ↗
(
    {
      pattern,
      path,
      glob,
      type,
      output_mode = 'files_with_matches',
      '-B': context_before,
      '-A': context_after,
      '-C': context_c,
      context,
      '-n': show_line_numbers = true,
      '-i': case_insensitive = false,
      head_limit,
      offset = 0,
      multiline = false,
    },
    { abortController, getAppState },
  )

Source from the content-addressed store, hash-verified

308 }
309 },
310 async call(
311 {
312 pattern,
313 path,
314 glob,
315 type,
316 output_mode = 'files_with_matches',
317 '-B': context_before,
318 '-A': context_after,
319 '-C': context_c,
320 context,
321 '-n': show_line_numbers = true,
322 '-i': case_insensitive = false,
323 head_limit,
324 offset = 0,
325 multiline = false,
326 },
327 { abortController, getAppState },
328 ) {
329 const absolutePath = path ? expandPath(path) : getCwd()
330 const args = ['--hidden']
331
332 // Exclude VCS directories to avoid noise from version control metadata
333 for (const dir of VCS_DIRECTORIES_TO_EXCLUDE) {
334 args.push('--glob', `!${dir}`)
335 }
336
337 // Limit line length to prevent base64/minified content from cluttering output
338 args.push('--max-columns', '500')
339
340 // Only apply multiline flags when explicitly requested
341 if (multiline) {
342 args.push('-U', '--multiline-dotall')
343 }
344
345 // Add optional flags
346 if (case_insensitive) {
347 args.push('-i')
348 }
349
350 // Add output mode flags
351 if (output_mode === 'files_with_matches') {
352 args.push('-l')
353 } else if (output_mode === 'count') {
354 args.push('-c')
355 }
356
357 // Add line numbers if requested
358 if (show_line_numbers && output_mode === 'content') {
359 args.push('-n')
360 }
361
362 // Add context flags (-C/context takes precedence over context_before/context_after)
363 if (output_mode === 'content') {
364 if (context !== undefined) {
365 args.push('-C', context.toString())
366 } else if (context_c !== undefined) {
367 args.push('-C', context_c.toString())

Callers

nothing calls this directly

Calls 12

expandPathFunction · 0.85
getCwdFunction · 0.85
normalizePatternsToPathFunction · 0.85
ripGrepFunction · 0.85
applyHeadLimitFunction · 0.85
toRelativePathFunction · 0.85
getFsImplementationFunction · 0.85
toStringMethod · 0.65
getAppStateFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected