Skip to content

code_smart_grep

code_smart_grep runs a pattern search across the indexed codebase and passes the matches to an LLM, which returns a synthesized answer to your question rather than a raw list of matching lines.

Requires GL_SMART_READ=true in the MCP server environment.

code_smart_grep(pattern="error", question="what error types are handled?")
code_smart_grep(pattern="process\.env\.", question="what environment variables are used?")
ParameterTypeDefaultDescription
patternstringrequiredRegex pattern to search for
questionstringrequiredWhat you want to know about the matches
ApproachTokens
code_grep(pattern="error") — 40 raw matches~2,000
code_smart_grep(pattern="error", question="what error types?")~100

85% token savings with a categorized, readable answer.

  • Finding patterns across many files where you need synthesis, not a list
  • Auditing error handling, env var usage, or deprecated patterns
  • Any grep where you would normally have to scan through many results yourself
  • Requires GL_SMART_READ=true in the MCP server configuration
  • For precise single-location lookups, plain code_grep is faster
  • Results are not cached (unlike code_smart_read)