CostAffective
Back to Tools Overview
grep_code tool

Tool: grep_code

Regex and full-text fallback search across the repository, for when a literal text match is more useful than a structural query.

Arguments Schema

ParameterTypeRequiredDescription
patternstringRequiredRegex or exact text pattern to search.
repo_pathstringRequiredAbsolute path to the workspace root.
budgetstringOptionalToken boundary limit (small, medium, large).
Tool Input JSONRequest
{
  "pattern": "WithInstructions",
  "repo_path": "/path/to/repo",
  "budget": "small"
}
Tool Response JSONResponse
[
  {
    "file": "internal/mcpserver/server.go",
    "line": 14,
    "content": "server.WithInstructions(skill.Instructions()),"
  }
]

Developer Best Practices

  • Reach for the structural tools (find_symbol, search_code) first; use grep_code when only a literal match will do.
  • Supply a budget on broad patterns to avoid flooding the context window.