Skip to main content
Glama

search_code

Search bounded UTF-8 source files under approved roots for exact text and return relative paths with line numbers.

Instructions

Literal UTF-8 source search; results include relative path and line.

Use for literal text search within bounded UTF-8 files under approved roots. Supply the exact search text, depth and result cap. Search results may expose sensitive lines; read-only.

The search skips protected names, hidden and system entries, and linked entries, so a missing result does not prove a file is absent.

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": {
      "path": "<path>",
      "text": "<text>"
    },
    "name": "search_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesRoot directory under existing Owner read roots for literal UTF-8 content search.
textYesExact UTF-8 text to search for (1 to 120 characters; no line breaks).
depthNoMaximum directory traversal depth, 0 to 12; default 8.
max_resultsNoMaximum matches returned, 1 to 100; default 50.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.2

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does well: it declares the operation read-only, warns that results may expose sensitive lines, and explains that protected, hidden, system and linked entries are skipped so a missing match does not prove absence. It stops short of describing truncation behavior when max_results is reached, which keeps it at 4.

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?

It is front-loaded with the one-line summary and organized into purpose, behavior and caveat. There is minor redundancy between the first line and the 'Use for literal text search' sentence, but no filler.

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

Completeness4/5

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

An output schema exists, so return-shape explanation is unnecessary, and parameters are fully documented in the schema. The remaining gap is the absence of explicit boundaries against sibling search/read tools, but overall the definition is complete enough to invoke correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so each of the four parameters already carries bounds and defaults. The description only restates that exact text, depth and result cap should be supplied, adding no format or edge-case meaning beyond the schema, so the baseline 3 applies.

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

Purpose4/5

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

The description gives a specific verb and resource: a literal UTF-8 content search that returns relative path and line. The word 'literal' implicitly separates it from name-based tools like find_files and from regex-style matching, but no sibling is named explicitly, so differentiation is left partly to inference.

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

Usage Guidelines4/5

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

It states clearly when to use the tool: literal text search within bounded UTF-8 files under approved roots, with an instruction to supply exact text, depth and result cap. It does not name alternatives or explicitly say when not to use it (e.g. for non-UTF-8 or pattern matching), which keeps it below a 5.

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