Files

Grep-style code search across a directory

Recursive code search rooted at path (defaults to $HOME). Uses ripgrep when available, falling back to a native walker. Supports literal or regex patterns, smart-case (override with case_sensitive), glob filtering, before/after context_lines, and respect_gitignore. Results are capped by max_results; the response flags truncated when the cap is hit.

post/v1/search/code

Request

  • Base URL: http://localhost:9998
  • URL: http://localhost:9998/v1/search/code
  • Auth: HTTP bearer

Request body

patternstring required

Literal string or regular expression (when regex: true).

pathstring

Absolute root directory. Defaults to $HOME.

globstring

Glob filter (e.g. **/*.ts).

regexboolean

Treat pattern as a regular expression. Default false.

case_sensitiveboolean

Tri-state. Omit for smart-case (default), true/false to force.

context_linesinteger

Lines of context before and after each match. Capped by the service.

max_resultsinteger

Cap on the number of returned matches. Service-defined default and ceiling.

respect_gitignoreboolean

Respect .gitignore entries. Default true.

Response

Matches with file/line/column and surrounding context

totalinteger required
truncatedboolean required

True when max_results was reached.

enginestring required

Search backend used (e.g. ripgrep, native).

elapsedMsinteger required
errorsstring[]

Non-fatal errors encountered while walking. Omitted when empty.

Changes

No recorded changes to this operation across all 1 revision of this API.