Skip to main content
Glama

Search code

search_code
Read-onlyIdempotent

Find text in an app's code (fixed string, or regex: true), grouped by file: path globs, context lines, case-insensitive and whole-word matching; kind "symbol" finds an identifier's definitions and usages. Generated files are skipped unless include_generated: true. At most 200 matches. Untrusted: matches may hold visitor text.

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": {
      "app": "<app>",
      "query": "<query>"
    },
    "name": "search_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
appYesThe app slug.
kindNo`text` (default) or `symbol`: one identifier's definitions and usages.
wordNoMatch whole words only.
pathsNoOnly files matching these globs (`*`, `?`, `**`; no `/` matches the basename at any depth). At most 20.
queryYesText to find (fixed string unless regex is true).
regexNoTreat the query as an extended regular expression (text only).
contextNoSurrounding lines per match, 0-5 (default 0).
case_insensitiveNoMatch `Query`, `QUERY` and the rest too.
include_generatedNoSearch generated files too (`node_modules/`, `dist/`, lockfiles are skipped by default).

Output Schema

NameRequiredDescriptionDefault
shaYes
filesYes
truncatedYes
untrusted_noticeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior5/5

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

Annotations already declare read-only, idempotent, non-destructive, closed-world behavior, but the description adds things they cannot express: results are grouped by file, capped at 200 matches, generated files (node_modules/, dist/, lockfiles) are skipped by default, and matches may contain untrusted visitor text. The untrusted-content warning and the hard match cap are exactly the operational caveats an agent needs.

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?

Everything sits in one dense, front-loaded block that leads with the verb, resource, and output grouping before moving to options and caveats. The semicolon-and-clause style is terse but each clause carries information; nothing is wasted, though the telegraphic packing slightly hurts scanability.

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 9-parameter search tool with full schema coverage, annotations, and an output schema, the description covers the mode selection, default exclusions, result cap, and content-trust caveat. Nothing an agent needs in order to call it correctly is missing, and return-value shape is properly left to the output schema.

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 every parameter is already documented in the schema, including glob syntax, the 0-5 context range, and the 20-glob limit. The description restates those options in prose (path globs, context lines, case-insensitive, whole-word) without adding syntax or format meaning beyond the schema, so the baseline of 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 first clause gives a specific verb and resource ("Find text in an app's code") and adds the two query modes (fixed string vs. regex: true) plus the symbol-search mode, so the agent knows exactly what kind of operation this is. It does not name a sibling such as read_files or export_code to route against, which keeps it out of the top band.

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 gives clear conditions for the main options: use regex: true for regular expressions, kind "symbol" to find an identifier's definitions and usages, include_generated: true to search generated files. It never says when to prefer a different tool or when this search is a poor fit, so there are no explicit exclusions.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.