JVM Source Lens

v1.16.0
io.github.Sintexer/jvmsrc Checked 14 hours ago Published 2 months ago

Gradle-accurate JVM classpath; fetch Java source, signatures, and class structure for agents.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_class_source Get Java source for a class

Returns the Java source of a fully-qualified class. The heaviest tool in the ladder — reach for it only when you genuinely need method bodies. Use this when: reading implementation details, understanding control flow, or confirming behavior the signature alone can't reveal. Do NOT use it to discover method names (use get_class_structure) or to check signatures (use get_method_signature). Always prefer an excerpt over full source: • methodNames — array of method names to extract. Use "<init>" for constructors. Response echoes matchedMethodNames and unmatchedMethodNames. Unmatched name…

ParameterTypeDescription
className *string
projectRoot *string
configurationstring
endLineinteger
forceRefreshboolean
fullboolean
includeTestboolean
methodNamestring
methodNamesarray
modulePathstring
startLineinteger

find_in_class_source Find text in resolved Java source

Default query is a literal substring; set regex: true only for a JavaScript RegExp. Searches the source of one resolved class — like grep, scoped to a single classpath-resolved class, not the workspace. Use this when: the class is known and you need to locate a specific string, identifier, or pattern inside it. For discovering classes by name, use search_classes; for grepping a whole dependency JAR, use search_in_artifact. Resolves source the same way as get_class_source (sources JAR preferred; CFR decompilation if absent). Returns hits with line/column, matched text, optional multiline b…

ParameterTypeDescription
className *string
projectRoot *string
query *string
configurationstring
contextLinesinteger
forceRefreshboolean
fullboolean
includearray
includeTestboolean
maxHitsinteger
modulePathstring
regexboolean

resolve_dependencies Resolve Gradle dependencies

Runs (or returns cached) Gradle dependency resolution for the project and reports modules, configurations, and resolved artifacts. Use this when: diagnosing a version mismatch, debugging NoSuchMethodError / AbstractMethodError / ClassCastException across libraries, or confirming which version of a dependency is actually on the classpath. Start here before chasing symptoms in source. Params: standard project params; forceRefresh=true bypasses the hash cache — use it after dependency changes that don't touch build files (e.g., SNAPSHOT republish). Returns: compact text module/configuration…

ParameterTypeDescription
projectRoot *string
forceRefreshboolean
fullboolean
includearray

search_classes Search classes on the resolved classpath

Discovery tool for finding classes when you don't know the FQN. Returns a ranked suggestion list: each hit is className (FQN) plus libName (artifact or Gradle module) — enough to call get_class_structure next. Use this when: the user mentions a type by simple name, you see an unknown class in a stack trace, or you need to locate which dependency provides something. Follow up with get_class_structure (scope=overview) — never jump straight to get_class_source. Query: case-insensitive substring matched against FQN, simple name, and (when sources were available at index time) declared method…

ParameterTypeDescription
projectRoot *string
query *string
configurationstring
forceRefreshboolean
fullboolean
includearray
includeTestboolean
limitinteger
modulePathstring

get_method_signature Get Java method overload signatures

Lists every overload of a named method on a class. Preferred over get_class_source whenever you only need signatures. Use this when: verifying a method exists, checking parameter types, picking the right overload, or confirming a return type. For constructors, pass methodName = "<init>". Params: className; methodName (required singular) OR methodNames with exactly one element (alias — do not pass multiple names; call once per method or use get_class_structure). Standard project params. Resolution strategy (default, bytecodeOnly=false): 1. Parse .java from the sources JAR or inter-projec…

ParameterTypeDescription
className *string
projectRoot *string
bytecodeOnlyboolean
configurationstring
forceRefreshboolean
fullboolean
includearray
includeTestboolean
methodNamestring
methodNamesarray
modulePathstring

get_class_structure Get structured Java class API

Returns the API surface of a class: purpose, declared methods, optionally fields/annotations/hierarchy. The right starting point after search_classes and before fetching source. Use this when: you have an FQN and want to know what the class does and what methods it exposes. For a single method's overloads, use get_method_signature instead. Scope (default = overview): • overview — class purpose + declared method names. When the type is field-heavy (≥8 fields and ≤2 non-constructor declared methods), lists fields (capped) instead of only a count. • declared — signature line…

ParameterTypeDescription
className *string
projectRoot *string
configurationstring
forceRefreshboolean
fullboolean
includearray
includeTestboolean
modulePathstring
scopestring

search_in_artifact Search text across all classes in one resolved dependency JAR

Grep-like search across every class in one artifact (by Maven coordinates or absolute jarPath). Fetches source for each class (sources JAR preferred; CFR decompilation fallback) and runs the query, returning hits grouped by className. Use this when: you know which library contains a log message, exception string, or API literal — but not which class. Use find_in_class_source when the class is already known; use search_classes when you need to discover which library provides a class by name. Artifact selector (one required): • coordinates — { group, name, version? }. Omitting version…

ParameterTypeDescription
projectRoot *string
query *string
configurationstring
contextLinesinteger
coordinatesobject
forceRefreshboolean
fullboolean
includeTestboolean
jarPathstring
maxClassesinteger
maxHitsinteger
modulePathstring
regexboolean