Skip to main content
Glama

Search contrib and core code

search_code
Read-onlyIdempotent

Search the source of every indexed contrib project, plus core, for a code pattern: which files, or with by_repo which projects. Who-uses-a-core-symbol counts: list_symbol_users or lookup_core_symbol.

  • query is a regex. Set literal for exact text with ( [ ] . $ : or a space, and put r: f: lang: case: sym: b: terms in filters. repos: project machine name list. The index runs RE2, which has no lookaround or backreferences.

  • .module, .install, .theme, .engine, .profile and .inc count as PHP: lang:php includes them and sym: resolves inside them. No language filter is applied for you.

  • Returns total_matches and total_files plus a head of files (repo, path, matching lines), limit ≤ 50. by_repo: (repo, file_count) rows from a pull of up to 1000 files; total_files is the ceiling; truncated when cut. A parse error returns the index's own message.

  • not_indexed: the repos the index lacks. A project with no installs and no recent release is not indexed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoFiles to return, default 20, cap 50. Ignored with by_repo.
queryYesCode to find, a regex unless literal is true. Filters may be inline when literal is false, else in filters. Example: hook_form_alter f:\.module$
reposNoRestrict to these projects, by machine name, in one query.
by_repoNoReturn repos as (repo, file_count) instead of files. Pulls up to 1000 files; total_files is the ceiling.
filtersNoZoekt filters appended as written: r:<repo regex> f:<path regex> lang:<language> b:<branch> sym:<symbol> case:yes.
literalNotrue: query is matched as exact text. Use it for text with ( [ ] $ . such as #[Hook(. With literal, filters go in filters.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / literal / description
      Previous value: -"true: query is exact text, not a regex. Use it for text with ( [ ] $ . such as #[Hook(. With literal, filters go in filters."New value: +"true: query is matched as exact text. Use it for text with ( [ ] $ . such as #[Hook(. With literal, filters go in filters."
  2. Changed5 schema fields changed
    • changedInput schema / properties / by_repo / description
      Previous value: -"Return repos as (repo, file_count) instead of files; pulls up to 1000 files, total_files is the ceiling."New value: +"Return repos as (repo, file_count) instead of files. Pulls up to 1000 files; total_files is the ceiling."
    • changedInput schema / properties / limit / description
      Previous value: -"Files to return, default 20, cap 50; ignored with by_repo."New value: +"Files to return, default 20, cap 50. Ignored with by_repo."
    • changedInput schema / properties / literal / description
      Previous value: -"true = query is exact text, not a regex: use it for text with ( [ ] $ . such as #[Hook( ; with literal, filters go in filters."New value: +"true: query is exact text, not a regex. Use it for text with ( [ ] $ . such as #[Hook(. With literal, filters go in filters."
    • changedInput schema / properties / query / description
      Previous value: -"Code to find; a regex unless literal is true. Filters may be inline when literal is false, else in filters. Example: hook_form_alter f:\\.module$"New value: +"Code to find, a regex unless literal is true. Filters may be inline when literal is false, else in filters. Example: hook_form_alter f:\\.module$"
    • changedInput schema / properties / repos / description
      Previous value: -"Restrict to these project machine names (one query)."New value: +"Restrict to these projects, by machine name, in one query."
  3. Changed1 schema field changed
    • changedInput schema / properties / literal / description
      Previous value: -"Treat query as exact text (for ( [ ] $ . as in #[Hook(); filters go in filters."New value: +"true = query is exact text, not a regex: use it for text with ( [ ] $ . such as #[Hook( ; with literal, filters go in filters."
  4. Added

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations: the RE2 engine's lack of lookaround and backreferences, that .module/.install/.theme/.engine/.profile/.inc count as PHP and no language filter is auto-applied, the ≤50 limit, by_repo's 1000-file ceiling with truncation, parse-error passthrough, and the not_indexed caveat. This is exactly the behavioral context 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?

Front-loads the core action in the first sentence, then organizes the rest into four tight bullets covering query semantics, language handling, return shape, and index gaps. Dense but every bullet carries information; no filler sentences.

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?

With no output schema, the description correctly takes on the return-value burden, documenting total_matches, total_files, the file head fields (repo, path, matching lines), the by_repo shape, truncation, and not_indexed. Combined with the annotation-covered safety profile, nothing an agent needs to call it correctly is missing.

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 already 100%, so the baseline is 3, but the description adds real meaning: that query is a regex, that inline filters (r:, f:, lang:, case:, sym:, b:) require literal=false, and that repos is a machine-name list. The RE2 limitation is param-relevant context the schema omits.

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 (Search), resource (source of every indexed contrib project plus core), and object (a code pattern), with the file-vs-project scope made explicit. It explicitly routes the adjacent 'who-uses-a-core-symbol' task to list_symbol_users or lookup_core_symbol, so an agent can separate it from siblings without opening any schema.

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?

Gives clear conditions for key modes: set literal for exact text containing regex metacharacters or spaces, use filters otherwise, and use by_repo for project-level counts. It names alternatives for the symbol-count use case, though it doesn't spell out when NOT to reach for this tool for other query types.

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.

Resources