Skip to main content
Glama

search_source

Read-onlyIdempotent

Searches source files for literal text, strings, comments, or config keys, returning matching lines with file, line number, and total count; filter by path to narrow results.

Instructions

Searches the text of the source files of the graph and returns one line per matching line: file, line number and text, then a count. Use it for what is not a name in the graph: a string, a message, a comment, a configuration key. pattern is literal text, letter case ignored, matched inside one line; special are only .* (any characters), ^ first and $ last (the ends of the line) and a backslash before a character meant literally. path narrows the search to files whose path matches (tests/.*). For where a name is defined use find_definitions; for who uses a symbol use find_usages, which follows aliases and re-exports; to read around a match use read_source. It reads source files of the graph only. One call returns at most 200 matches, says the total and the match to go on from: pass that number as first. A line longer than 300 characters is cut.

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": {
      "pattern": "<pattern>"
    },
    "name": "search_source"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoPart of a file path, literal text with optional .* wildcards: only matching files are searched.
firstNoNumber of the first match to return (default 1); a cut answer names the next one as :next.
patternYesText to search for, as it is written in the code; .* stands for any characters, letter case is ignored.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.16.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, closed-world), and the description adds substantial behavior on top: a hard cap of 200 matches per call, a total count, a resume token passed back as `first`, truncation of lines over 300 characters, and the constraint that it reads only the graph's source files. These are operational facts unavailable in the annotations.

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 purpose and return format, then routing, then behavioral limits; every sentence carries information. It is dense to the point of being slightly run-on in the escaping clause ("special are only .* ... and a backslash before a character meant literally"), costing a little readability.

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?

For a three-parameter search tool with no output schema, the description supplies everything needed: result line format, match cap, pagination mechanism, truncation threshold, and the scope restriction to graph source files. Nothing an agent needs in order to call it correctly or interpret its output is missing.

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 coverage is 100%, so the baseline is 3; the schema already documents `path` wildcards, `first` defaulting to 1 with the :next pointer, and `pattern` case-insensitivity. The description does add meaning beyond it — pattern is literal text matched inside a single line, with only `.*`, `^`, `$` and backslash escapes special — but most of that nuance overlaps the schema wording rather than extending it.

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 ("searches the text of the source files of the graph") and immediately describes the return shape (one line per matching line: file, line number, text, then a count). It explicitly carves out scope against siblings: not a name in the graph, and defers to find_definitions/find_usages/read_source for those cases.

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 use case ("a string, a message, a comment, a configuration key") plus three named alternatives with the precise condition that selects each: find_definitions for where a name is defined, find_usages for who uses a symbol, read_source to read around a match. An agent can route correctly without opening other schemas.

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