Skip to main content
Glama

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

NameRequiredDescriptionDefault
queryYesPrimary substring to match (case-insensitive, ABAP CS).
query2NoOptional second substring. When set, both query and query2 must appear on the same line.
excludeNoUp to 3 substrings; a line containing any of them is dropped.
timeoutNoSeconds 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.
versionNoSource version for PROG and CLAS main include reads. Default active. FUGR subincludes always read the active version.
packagesYesPackages 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_atNoIndex of the first scan target to read, from `next_start_at` of the previous answer; 0 by default.
max_objectsNoCap the total objects scanned across all packages (default 500). Setting truncated.by_max_objects=true when exceeded.
emit_no_hitsNoWhen true, list zero-hit targets in a separate no_hits array. Default false.
object_typesNoSubset of object families to scan (default: all three).
object_filterNoGlob applied to object names within each package (e.g. "Z*").
time_budget_msNoInternal 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_commentsNoSkip col-1 '*' and full-line '"' comment lines. Default false (comments are scanned).
include_subpackagesNoRecurse into subpackages (default true).
max_hits_per_objectNoCap 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv20.1.0

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so thoroughly: read-only nature, comment handling, version limitation for FUGR includes, truncation flags and their causes, time-budget behavior, batch-envelope scanning, pagination semantics, and the concurrency warning about parallel calls against the same SAP system. It also discloses that a timeout cancels the read and logs off its ABAP session, leaving the system as it was.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose and critical caveats are front-loaded, but the rest is a dense single block that repeats schema content (the timeout explanation and time_budget_ms guidance largely duplicate their schema descriptions). Much of the detail is necessary for a 15-parameter tool, but some sentences could be trimmed without losing behavior.

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 15 parameters, no annotations, and no output schema, the description is unusually complete: it documents return fields like total_targets and next_start_at, truncation flags, resume behavior, timeout side effects, and concurrency constraints. An agent has enough information to call it correctly and interpret the answer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline would be 3, but the description adds real meaning beyond the schema: mask resolution is best-effort and scoped to the ADT repository-search window, version affects only PROG/CLAS main includes, and max_hits_per_object vs max_objects drive distinct truncation flags. It also explains how time_budget_ms, next_start_at, and start_at interact when a scan stops early.

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?

States a specific verb and resource: search ABAP source text inside packages, scoped to programs, function groups, and classes. The scope is precise enough to separate it from object-level search, but it never names sibling SearchObject or otherwise explicitly differentiates itself from that tool.

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 operational context: prefer concrete package names for certainty, narrow masks and use object_types/object_filter/max_objects, and run only one SearchSource per destination. It explains how to resume with next_start_at and how to avoid by_object_cap. However, it never routes the agent to a specific alternative tool when this one is a poor fit.

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