Skip to main content
Glama

code_grep

Read-onlyIdempotent

Searches readable workspace files for literal text such as config keys, routes, SQL, JSON, YAML, or log messages, and accepts wildcards to query all enabled workspaces at once.

Instructions

Finds literal TEXT in any readable file of a workspace, not only C#: config keys, routes, log messages, SQL, JSON, YAML, Razor, scripts, markdown. WILDCARD SUPPORT: pass workspace='' to search ALL enabled workspaces at once. Files are read from disk on every call, so results are never stale and every line number is the real line (valid for code_read and file_edit_lines until the file changes). Matching is plain text on one line (no regex), any letter case unless caseSensitive=true. Results come in path order with the matching lines. Use code_search for C# type and member NAMES (ranked, forgiving); use code_grep when the text is not a name. Not searched: files the access policy blocks, vendored folders (wwwroot/lib, dist, vendor), .min. and minified files, binary files and files over about 1 MB; the result says how many were left out. Examples: code_grep('MyApi', 'ConnectionStrings') | code_grep('', 'api/orders', pathGlob='/*.cs') | code_grep('MyApi', 'TODO', pathGlob='src/Orders/').

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "workspace": "<workspace>",
      "query": "<query>"
    },
    "name": "code_grep"
  }
}

Input Schema

NameRequiredDescriptionDefault
pageNoOptional: page number, 1-based (default 1).
guideNotrue: put the code guide first in the result. Use on your first code call, or when told it changed.
queryYesLiteral text to find on one line (not a pattern, no line breaks)
pageSizeNoOptional: matching lines per page (default 50, max 200). Use with 'page' to read further.
pathGlobNoOptional: limit to workspace-relative paths. '*' stays inside a folder, '**' crosses folders, '?' is one character. Without '/' it matches the file name in any folder: '*.json', 'src/Orders/**', '**/appsettings*.yml'
workspaceYesWorkspace name as shown in Waymark, or '*' for ALL enabled workspaces
caseSensitiveNoOptional: case-sensitive match (default false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, yet the description still adds substantial behavior: files are re-read from disk each call so results are never stale, line numbers are real and valid for code_read/file_edit_lines until the file changes, matching is single-line plain text with no regex, and results come back in path order. The exclusion list (access-policy blocks, vendored folders, *.min.*, binary, >1 MB) plus the note that the result reports how many files were skipped is exactly the kind of context annotations cannot convey.

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

Conciseness4/5

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

Front-loaded with the core purpose, then uses labeled sections (WILDCARD SUPPORT, exclusion list, examples) so an agent can scan it. It is dense and slightly long, with the trailing examples partially restating pathGlob behavior already documented in the schema, but almost every sentence carries information.

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?

There is no output schema, and the description compensates by describing the return shape: path-ordered results with matching lines, a count of excluded files, and pagination behavior via page/pageSize. For a 7-parameter read tool with full annotation coverage, nothing an agent needs to call it correctly is missing.

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 coverage is 100%, so the baseline is 3, but the description goes further by spelling out pathGlob glob semantics ('*' stays in a folder, '**' crosses folders, '?' is one char, no '/' means match filename anywhere) and showing combined parameter usage in the examples. It also clarifies that caseSensitive defaults to insensitive matching behaviorally, not just structurally.

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 and resource ('Finds literal TEXT in any readable file of a workspace') and immediately scopes it beyond C# by enumerating file types. It explicitly contrasts itself with code_search by name, so an agent can distinguish the two without opening either schema.

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?

Gives an explicit routing rule: use code_search for C# type and member NAMES, use code_grep when the text is not a name. It also states the wildcard case (workspace='*') and provides three concrete invocation examples covering scoped and unscoped searches.

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