Skip to main content
Glama

modx_search_code

Search MODX element and resource content and names to find where a string appears, including references; returns matching line details for direct edits.

Instructions

Full-text search across element and resource CONTENT (and names). Finds the chunk/snippet/template/plugin/TV/resource that contains a string, including where an element is referenced or mentioned. Matches static elements by reading their static file. Use this to navigate the codebase (e.g. query 'header' finds the header chunk and everything that uses or mentions it). Each content hit returns id, line (1-based line of the match) and line_text (the exact line, verbatim) — so for a one-line change you can go straight to modx_edit_element_lines using line as start_line/end_line and line_text as expect, with no separate read. For multi-line context, open a window with modx_view_element around line.

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

Input Schema

NameRequiredDescriptionDefault
limitNoMax results (default 50, max 200).
queryYesSubstring to search for.
typesNoElement/resource types to search. Default: all.
case_sensitiveNoCase-sensitive match (default false).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.4

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations supplied the description carries the full burden, and it does disclose useful behavior: static elements are matched by reading their static file, and hits include references/mentions rather than only definitions. It still leaves gaps a search tool should close - no statement of read-only safety, result ordering, or cost/pagination behavior when limit is large.

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 purpose in the first sentence, then workflow and return-shape detail; no filler sentences. It is dense and long for a single paragraph, and the return-shape material could be separated, but every sentence carries actionable information.

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?

No output schema exists, so the description correctly compensates by explaining that content hits return id, line (1-based) and line_text verbatim. Combined with the hand-off to modx_edit_element_lines/modx_view_element, an agent can act on a result without an extra read; only ordering and safety behavior remain unstated.

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 query, limit, types, case_sensitive are already documented in the schema. The description adds only indirect semantics (the searchable type set mirrors the enumerated `types` values) and spends its detail on output fields (id/line/line_text) rather than parameter meaning, so it lands at the baseline.

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: full-text search across 'element and resource CONTENT (and names)', naming the concrete element kinds (chunk/snippet/template/plugin/TV/resource) it covers. It also clarifies the distinctive scope (matches inside content, including references/mentions) which separates it from content-fetching siblings like modx_get_element or modx_view_element.

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 an explicit navigation use case with a worked example (query 'header') and routes the agent onward: use modx_edit_element_lines directly for a one-line change, or modx_view_element for a window of multi-line context. It does not state when NOT to use it (e.g. versus the sibling modx_find_usages, which overlaps on 'where is this referenced').

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

Deploy Server

Other Tools