Skip to main content
Glama
EL4CTEO

Roblox Studio MCP

Search script source

script_grep
Read-onlyIdempotent

Search Luau source across a Roblox place to locate definitions or usages before editing, returning matching lines with paths and line numbers.

Instructions

Searches inside Luau source across the place and returns matching lines with their paths and line numbers.

Use this to find where something is defined or used before editing it — it is far cheaper than reading whole scripts to look for one call.

Patterns are Lua patterns, which are not regular expressions: % escapes instead of backslash, there is no alternation, and - means a lazy quantifier. Set literal to search for text exactly as written, which is usually what you want for identifiers.

To look for several identifiers, pass them together as patterns (literal, up to 16): one pass over the place instead of one per name, and each line says which of them it matched. mode="files" lists matching scripts only; mode="counts" gives matching-line counts per pattern.

Results are grouped by script with its rev, which script_edit accepts as revision. Matches come from the script editor's live buffer, so unsaved edits are searched too.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo'lines': matching lines. 'files': one row per matching script. 'counts': matching-line counts per pattern.lines
pathNoLimit to this subtree, e.g. "ServerScriptService". Omit to search everywhere.
limitNoMaximum items to return (1-500).
cursorNoOpaque cursor from a previous call's `nextCursor`. Omit for the first page.
literalNoTreat `pattern` as plain text rather than a Lua pattern.
patternNoLua pattern, or exact text when `literal` is set, e.g. "PlayerAdded".
patternsNoSeveral literal strings searched in one pass, instead of `pattern`.
studioIdNoTarget Studio; omit for the active one.
classNameNoRestrict to one script class: "Script", "LocalScript" or "ModuleScript".
ignoreCaseNoCase-insensitive. Both sides are lowercased, so pattern classes like %u stop being meaningful — combine with `literal`.
contextLinesNoLines of context to show either side of each match.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.8.6
    • addedInput schema / properties / mode
      Added value: +{
      +  "default": "lines",
      +  "description": "'lines': matching lines. 'files': one row per matching script. 'counts': matching-line counts per pattern.",
      +  "enum": [
      +    "lines",
      +    "files",
      +    "counts"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / pattern / minLength
      Added value: +1
    • addedInput schema / properties / patterns
      Added value: +{
      +  "description": "Several literal strings searched in one pass, instead of `pattern`.",
      +  "items": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "maxItems": 16,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "pattern"
      -]
  2. First observedv0.1.8

TDQS

A4.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover safety (readOnlyHint, destructiveHint=false, idempotentHint). The description adds valuable context: results come from the live editor buffer and include unsaved edits; results are grouped by script with a rev that script_edit accepts. This cross-tool hint is beyond what annotations provide. Lacks pagination/cursor behavior detail but implies it via schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core verb/resource/return shape, then usage, then pattern semantics, then multi-pattern behavior, then result grouping and cross-tool link. Every sentence earns its place with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 11 params, no output schema, and rich annotations, the description covers what the agent needs: when to use, pattern language differences, identifier-search guidance, result grouping format, and a cross-tool link (rev → script_edit revision). Nothing important is missing for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is already 100%, so baseline is 3. The description adds meaningful semantics on top: Lua patterns are not regex with specifics about %, alternation, and lazy quantifier; literal mode advice; multi-pattern single-pass guidance with max 16. This goes beyond schema descriptions and materially helps correct usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (Searches) and resource (Luau source across the place), with a clear description of what it returns (matching lines with paths and line numbers). Differentiates from siblings by positioning it as cheaper than script_read and references script_edit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says when to use ('find where something is defined or used before editing it') and implicitly when not to ('far cheaper than reading whole scripts'). Prescribes literal mode for identifiers and multi-pattern mode for several identifiers, giving concrete guidance across the alternatives available.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.