Skip to main content
MCP Tools

find_pattern

Textual search, scoped to the graph. Runs git grep and returns path:line:col: text, optionally confined to a path prefix or to the files that import a given symbol.

This is the deliberate escape hatch. The graph answers structural questions exactly; some questions are not structural (a log string, a TODO, a magic constant, a config key), and pretending otherwise would send you elsewhere. Scoping the search to the graph-relevant file set is what keeps it from becoming an unscoped grep.

Input schema

{
"type": "object",
"properties": {
"pattern": {
"type": "string",
"description": "POSIX ERE pattern to search for (use fixed:true for a literal string)"
},
"scope": {
"type": "string",
"description": "Optional scope: a repo-relative path prefix, or files-importing(<symbol>)"
},
"fixed": {
"type": "boolean",
"description": "Treat pattern as a literal string instead of a regular expression"
}
},
"required": ["pattern"],
"additionalProperties": false
}

pattern is a POSIX extended regular expression, not PCRE. Set fixed: true for a literal search, which is also the right choice for anything containing regex metacharacters.

Scoping

scope takes either form:

  • A repo-relative path prefix, for example crates/travsr-store/.
  • files-importing(<symbol>), which confines the search to files that import that symbol. This is the form that makes the tool graph-aware rather than a plain grep: it answers "where, among the code that actually depends on this, does this text appear".

When to use

  • Non-structural text: error strings, TODOs, feature flags, config keys.
  • Confirming an empty structural result. If find_references returns nothing and you suspect the index rather than the code, a textual search distinguishes "not there" from "not indexed".
  • Symbols the graph cannot model, such as a name built by string concatenation or reflection.

Notes

  • Available over both stdio and SSE.
  • Backed by git grep, so it only sees tracked files and respects the repo's ignore rules.
  • Returns text, not graph nodes. Results are not edges and carry no structural guarantee.
  • The CLI equivalent is travsr pattern "<regex>".