← All tools

Code Engineering

Grep Search

Recursive regex search across project files — the 'grep' of the framework.

grep_search

Overview

The 'where is this string used' verb. Pairs with glob_files for 'find files' and symbol_search / symbol_references for definitions vs usages.

How it works

READ_ONLY. Skips the standard build/VCS directories. Same `**/X → X` glob fallback as glob_files. Default 0 context lines; pass context_lines=N for surrounding lines.

Example

When a user asks:

Where do we call ChatClient.call across the repo?

the agent calls the tool:

grep_search(pattern="ChatClient\\.call\\(", path_glob="**/*.java")

and gets back: src/main/java/.../Agent.java:142: chatClient.call(prompt) src/main/java/.../Reviewer.java:88: ChatClient.call(buildPrompt(history)) ... 8 more

What it's good for

Real scenarios where agents put this tool to work.

Impact analysis before a refactor: 'who uses this'
Find a magic string / config key referenced by a stack trace

Source

Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/code/search/GrepSearchTool.java in the swarm-ai repository.

Open grep_search on GitHub →