Grep across all scripts in the game
script-grepSearch decompiled Roblox scripts line by line for exact text or Luau patterns, returning matching lines with surrounding context grouped per script.
Instructions
Search decompiled Roblox scripts for a pattern, line by line, with surrounding context. Enumerates every client-readable LuaSourceContainer reachable from the active client (via QueryDescendants plus nil-parented scripts), decompiles each, and reports matching lines grouped per script. Matching uses Luau string.find: with literal=true the query is matched as a plain substring; otherwise it is treated as a Luau string pattern (note: Luau patterns, not JavaScript regex). Use exact identifiers or simple patterns; use semantic-search-scripts when behavior is known but names are not. Decompilation is best-effort and can be slow on large places, so the scan is capped by maxScripts. Signature: { query: string, root: any?, limit: any?, contextLines: any?, maxMatchesPerScript: any?, maxScripts: any?, literal: any?, caseSensitive: any?, threadContext: number? }. Phase: orchestrate; cost=medium; idempotency=read-only. Requires: active-client. Produces: structured-result. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| root | No | Root instance to enumerate scripts under (e.g. 'game', 'game.ReplicatedStorage'). Defaults to 'game'. Narrow this to keep the scan fast. | game |
| limit | No | Maximum number of scripts to return results from (default: 50). | |
| query | Yes | The search pattern. With literal=false it is interpreted as a Luau string pattern (%d, %w, %s, character classes [a-z], anchors, etc.). Use the literal flag for exact substring matching. | |
| literal | No | When true, treats the query as a plain literal substring - no pattern interpretation (string.find with plain=true). (default: false) | |
| maxScripts | No | Maximum number of scripts to decompile and scan before stopping (default: 400). | |
| contextLines | No | Number of lines of context to show before and after each match (default: 2). | |
| caseSensitive | No | When false, matches case-insensitively. (default: true) | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. | |
| maxMatchesPerScript | No | Maximum number of matches to return per script (default: 20). |