Skip to main content
Glama

Search source lines

search_code
Read-onlyIdempotent

Search a pinned, indexed commit for lines containing every query term as a case-insensitive substring, returning cited line spans and paginated results for reproducible code evidence.

Instructions

Lines of a pinned, indexed commit that contain every whitespace-separated query term as a case-insensitive substring (literal=true: the whole query as one), by path and line, each with a one-line citation and span SHA-256; total counts every match, page with next_cursor. The query is never interpreted as FTS5 or SQL syntax. Snippets are untrusted upstream data. Zero hits shows only that no indexed line matches, not that a behaviour 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": {
      "commit": "<commit>",
      "query": "<query>"
    },
    "name": "search_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
queryYesSearch terms; one of 3+ characters.
commitYes
cursorNonext_cursor of the previous page of the same query.
literalNo
path_globNoOnly paths matching this SQLite GLOB (case-sensitive; '*' also matches '/').
path_prefixNoOnly paths with this repository-relative prefix, e.g. 'home-mixer/'.

Output Schema

NameRequiredDescriptionDefault
dataNo
toolNo
errorNo
notesNo
commitNo
outcomeNo
warningsNo
truncatedNo
next_cursorNo
schema_versionNo
index_generationNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.11.0

TDQS

A4.1/5.0
Behavior5/5

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

The description adds substantial behavior beyond the read-only/idempotent annotations: case-insensitive substring matching, all-terms semantics, literal mode, no FTS5 or SQL interpretation, untrusted snippet handling, total match counts, and cursor pagination. It also correctly warns that zero hits only mean no indexed line matches, not that behavior is absent.

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?

The description is dense and front-loads the core resource, but it is a single long sentence with semicolons that requires careful parsing. Every clause carries useful information, so it is concise rather than bloated, though slightly better structure would improve 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?

Given the tool's complexity, the existing output schema, and the read-only annotations, the description covers the key behavioral and safety details an agent needs to call it correctly. It explains matching semantics, literal behavior, pagination, untrusted snippets, and the important limitation of zero-hit results.

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 moderate at 57%, and the description meaningfully supplements it by explaining query matching, literal mode, commit indexing, and next_cursor pagination. It does not clarify limit or the path filters beyond what the schema already documents, but it adds useful semantics over the structured fields.

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 clearly states a specific resource and operation: source lines from a pinned, indexed commit matching query terms by path and line. It does not explicitly differentiate this line-search tool from siblings such as find_symbols or read_span, so it falls 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?

Usage is implied through constraints like pinned indexed commit, literal matching, and pagination, but there is no explicit when-to-use or when-not-to-use guidance relative to alternatives. The zero-hit caveat is helpful but does not substitute for routing guidance.

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