Skip to main content
Glama

search_code

Search literal UTF-8 source text within approved directories and return relative file paths with matching line numbers, with configurable depth and result limits.

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.

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.5/5.0
Behavior3/5

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

With no annotations, the description carries the full load: it discloses read-only behavior, the approved-roots boundary, the UTF-8-only scope, and that results may expose sensitive lines. That is useful, but it leaves unstated what happens to binary/non-UTF-8 files, whether unreadable paths are skipped or error, and whether output is truncated when max_results is hit.

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?

Two tight paragraphs with the core capability front-loaded and the safety caveat at the end. Minor redundancy between 'Literal UTF-8 source search' and 'literal text search' in the following sentence, but nothing else wastes space.

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 and parameter coverage is complete, so the description only needs to cover behavior and scope, which it largely does (read-only, approved roots, sensitivity warning). Edge-case behavior for non-UTF-8 files and empty results is the remaining gap, but an agent can call it correctly from what is given.

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 the schema already defines path, text, depth, and max_results including ranges and defaults. The description's 'Supply the exact search text, depth and result cap' echoes those fields without adding syntax, escaping, or case-sensitivity semantics beyond what the schema provides; 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 states a specific verb and resource ('Literal UTF-8 source search') and adds a concrete outcome detail ('results include relative path and line'), so an agent knows exactly what arrives. It does not name a sibling such as find_files or read_text_file to sharpen the boundary, which keeps it short of a 5.

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

Usage Guidelines3/5

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

'Use for literal text search within bounded UTF-8 files under approved roots' gives clear positive context and a scope constraint. However, there is no when-not guidance and no named alternative among the many siblings (find_files for filename matching, read_text_file for known paths), so routing still requires inference.

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