search_symbols
Find Java declarations by name pattern with * and ? wildcards, optionally filtered by kind (class, interface, method, field). Requires loading a project first.
Instructions
Search the project's source declarations by name pattern. Supports glob patterns: * (any chars), ? (single char)
USAGE: search_symbols(query="*Service", kind="class") OUTPUT: One page of matching declarations with locations
KIND (optional, compared case-insensitively):
class, interface, enum, record, annotation: exactly the types of that kind (class excludes interfaces, enums, records and annotation types)
method: method declarations (constructors are not included, and lambda expressions are not method declarations)
field: every field declaration, including static final constants and enum constants; each result's kind is field, constant or enumConstant (record components are not field declarations) Without kind, every type is searched (no methods or fields). Any other kind is rejected with INVALID_PARAMETER. Anonymous classes have no name to match and are never results.
A method's or field's containingType is its declaring type's fully qualified name (pkg.Outer$Inner; an anonymous class is pkg.Outer$1). A type in the default package reports its package as "(default package)".
EXAMPLES:
search_symbols(query="Order*") - types starting with Order
search_symbols(query="*Repository", kind="interface")
search_symbols(query="get*", kind="method")
search_symbols(query="log", kind="field")
PAGINATION: the kind and pattern filters apply first, then offset and maxResults select the page. meta.totalCount counts every matching declaration; pagination.hasMore (and meta.truncated) is true when more follow this page, so request offset + returned next. maxResults outside 0 to 1000 is INVALID_PARAMETER.
A query naming the declaring type (Type.member) makes JDT resolve each declaration of the name and keep those of that type and its subtypes; one in a type whose own supertypes do not all resolve may be in that hierarchy, and is a potential match, never a result.
potentialMatches, present only when there are any, holds the places JDT's search reports as possible matches but cannot confirm, because a type or name there does not resolve (a missing dependency or a compile error): count is their exact number, and locations lists them, as many as the results it stands beside may list. They are never counted or listed as results.
IMPORTANT: Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | Optional, case-insensitive: class, interface, enum, record, annotation, method or field. Omit to search every type. field includes static final constants and enum constants. | |
| query | Yes | Search pattern - supports * and ? wildcards | |
| offset | No | Skip the first N matching declarations (default 0) | |
| maxResults | No | Max results to return, 0 to 1000 (default 50) |