πŸ“„ File detail

tools/GrepTool/prompt.ts

🧩 .tsπŸ“ 19 linesπŸ’Ύ 1,150 bytesπŸ“ text
← Back to All Files

🎯 Use case

This module implements the β€œGrepTool” tool (Grep) β€” something the model can call at runtime alongside other agent tools. On the API surface it exposes GREP_TOOL_NAME and getDescription β€” mainly functions, hooks, or classes. It composes internal code from AgentTool and BashTool (relative imports).

Generated from folder role, exports, dependency roots, and inline comments β€” not hand-reviewed for every path.

🧠 Inline summary

import { AGENT_TOOL_NAME } from '../AgentTool/constants.js' import { BASH_TOOL_NAME } from '../BashTool/toolName.js' export const GREP_TOOL_NAME = 'Grep'

πŸ“€ Exports (heuristic)

  • GREP_TOOL_NAME
  • getDescription

πŸ–₯️ Source preview

import { AGENT_TOOL_NAME } from '../AgentTool/constants.js'
import { BASH_TOOL_NAME } from '../BashTool/toolName.js'

export const GREP_TOOL_NAME = 'Grep'

export function getDescription(): string {
  return `A powerful search tool built on ripgrep

  Usage:
  - ALWAYS use ${GREP_TOOL_NAME} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${BASH_TOOL_NAME} command. The ${GREP_TOOL_NAME} tool has been optimized for correct permissions and access.
  - Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")
  - Filter files with glob parameter (e.g., "*.js", "**/*.tsx") or type parameter (e.g., "js", "py", "rust")
  - Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts
  - Use ${AGENT_TOOL_NAME} tool for open-ended searches requiring multiple rounds
  - Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code)
  - Multiline matching: By default patterns match within single lines only. For cross-line patterns like \`struct \\{[\\s\\S]*?field\`, use \`multiline: true\`
`
}