SearchSource
Search ABAP source text across one or more packages for a substring, returning matching lines with per-object hit caps and pagination so large scans can be resumed.
Instructions
[read-only] Search ABAP source text inside one or more packages (programs, function groups, classes). packages accepts * masks (Z*, /NS/Z*) alongside exact names; mask resolution is best-effort and scoped to the ADT repository-search result window — some matching packages may be left unscanned. For certainty, pass concrete package names. When using masks, narrow the mask itself and use object_types, object_filter, and max_objects as scan-target controls that apply after package resolution. Comments are searched by default; set exclude_comments=true to drop col-1 * and full-line " comments. The version parameter affects PROG and CLAS main include reads only — FUGR subinclude reads always go against the active version (the include endpoint reads the active version alone). truncated.by_object_cap means at least one object had MORE hits than max_hits_per_object, so that object's hits were capped. The object-count limit is max_objects (which sets truncated.by_max_objects). To avoid by_object_cap, raise max_hits_per_object. The scan is read in ADT batch envelopes: the searches of the package masks, each level of the package walk, then the sources of the scanned objects in envelopes of at most 300 reads (main sources and function group structures, then function group includes and function modules); time_budget_ms is checked before every envelope, and a scan it stops answers whole objects. Run only ONE SearchSource per destination at a time — multiple parallel SearchSource calls against the same SAP system saturate the scan backend and can make all of them time out. Prefer combining terms into a single call over parallel calls. A scan that stops before its last target answers next_start_at; pass it as start_at to go on. When next_start_at equals start_at, time_budget_ms passed before the first object was answered: raise time_budget_ms or lower max_objects. The answer carries total_targets, the scan targets of the walk; it is absent when time_budget_ms passed during the walk. Runs on an ABAP session of its own. Optional timeout (seconds): when it passes, the read is cancelled, its ABAP session logged off, and the system stays as it was. Set it below your MCP client's request limit — the TypeScript SDK's client cancels at 60 s; a client's cancel ends only the client's wait, and SAP runs the read on. Runs outside batch mode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Primary substring to match (case-insensitive, ABAP CS). | |
| query2 | No | Optional second substring. When set, both query and query2 must appear on the same line. | |
| exclude | No | Up to 3 substrings; a line containing any of them is dropped. | |
| timeout | No | Seconds to wait for the answer: a whole number, at least 1, no default — without it the call waits until SAP answers. When it passes, the read is cancelled (its ABAP session is logged off) and the call answers that nothing was changed. Set it below your MCP client's request limit — the TypeScript SDK's client cancels at 60 s; a cancel does nothing to SAP. | |
| version | No | Source version for PROG and CLAS main include reads. Default active. FUGR subincludes always read the active version. | |
| packages | Yes | Packages to scan. Each entry is either an exact dev-class name or a `*` mask, where `*` stands for any characters and a namespace prefix may lead it. | |
| start_at | No | Index of the first scan target to read, from `next_start_at` of the previous answer; 0 by default. | |
| max_objects | No | Cap the total objects scanned across all packages (default 500). Setting truncated.by_max_objects=true when exceeded. | |
| emit_no_hits | No | When true, list zero-hit targets in a separate no_hits array. Default false. | |
| object_types | No | Subset of object families to scan (default: all three). | |
| object_filter | No | Glob applied to object names within each package (e.g. "Z*"). | |
| time_budget_ms | No | Internal scan deadline in ms. When exceeded, returns the hits of the objects before `next_start_at` with truncated.by_timeout=true and next_start_at; when next_start_at equals start_at, the deadline passed before the first object was answered: raise time_budget_ms or lower max_objects. Set this BELOW your client/transport timeout (e.g. 540000 for a 600s client) so you get a partial result instead of a hard cutoff. | |
| exclude_comments | No | Skip col-1 '*' and full-line '"' comment lines. Default false (comments are scanned). | |
| include_subpackages | No | Recurse into subpackages (default true). | |
| max_hits_per_object | No | Cap hits per root object across its source units (default 100). When exceeded, truncated.by_object_cap=true is set. Raise this value if you need more hits per object. |