You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Claiming #137. I plan to implement read_method_source_by_method_name as an MCP tool in yasa_mcp/tools/read_method_source_by_method_name.py that reads the complete source code of a Java method by its fully qualified name. It reuses the O(n) brace-depth state machine from #134 (_compute_line_depths) and method range extraction from #135 (_extract_method_ranges) to locate method body boundaries, then extracts source from the original file content. Key features: (1) overload disambiguation via parameter_types — returns ambiguous: true with candidate signatures when not specified; (2) Javadoc and annotation control via include_javadoc / include_annotations flags; (3) supports constructors (no return type), abstract methods (declaration only, single line), and static initialization blocks (static { ... }); (4) nested lambda/anonymous class bodies are included in the parent method source. File location uses package-path convention first (src/main/java/...), falling back to traversal with class name pattern matching. Tests cover overloads, nested classes, constructors, static init blocks, abstract methods, and integration with the java-design-patterns open-source project (< 3s response).
Update: Implementation progress for read_method_source_by_method_name (#137)
Summary
Implemented read_method_source_by_method_name as an MCP tool in yasa_mcp/tools/read_method_source_by_method_name.py that reads the complete source code of a Java method by its fully qualified name, with overload disambiguation, Javadoc/annotation control, and support for constructors, abstract methods, and static initialization blocks.
Key features
Feature
Implementation
Method body boundary
Reuses O(n) brace-depth state machine from #134 (_compute_line_depths) + enhanced _extract_all_method_ranges that accepts both { (method body) and ; (abstract/interface declaration)
Overload disambiguation
parameter_types list for exact match; returns ambiguous: true + candidate signatures when not specified
Javadoc control
include_javadoc=true (default) extracts /** ... */ above method as separate field; false omits it
Annotation control
include_annotations=true (default) includes @xxx lines in source; false starts source from method declaration
Constructors
Detected by absence of return type; User.User returns all overloads
Abstract methods
; ending accepted; start_line == end_line (single line declaration)
Static init blocks
static { ... } detected via _STATIC_INIT_PATTERN; accessed as <static_init> method name
Nested lambda/anonymous
Included in parent method source (depth tracking ensures correct boundary)
File location
Package-path convention first (src/main/java/com/example/...), fallback to traversal with class name regex
How it works
Parse method_full_name → (package, class_name, method_name) via rsplit(".", 1)
Locate file: try src/main/java/{package}/{class}.java, then traverse all .java files with class name pattern
Activity
wryyyds7 commentedon Jul 30, 2026
I can try it.
wryyyds7 commentedon Jul 30, 2026
Claiming #137. I plan to implement
read_method_source_by_method_nameas an MCP tool inyasa_mcp/tools/read_method_source_by_method_name.pythat reads the complete source code of a Java method by its fully qualified name. It reuses the O(n) brace-depth state machine from #134 (_compute_line_depths) and method range extraction from #135 (_extract_method_ranges) to locate method body boundaries, then extracts source from the original file content. Key features: (1) overload disambiguation viaparameter_types— returnsambiguous: truewith candidate signatures when not specified; (2) Javadoc and annotation control viainclude_javadoc/include_annotationsflags; (3) supports constructors (no return type), abstract methods (declaration only, single line), and static initialization blocks (static { ... }); (4) nested lambda/anonymous class bodies are included in the parent method source. File location uses package-path convention first (src/main/java/...), falling back to traversal with class name pattern matching. Tests cover overloads, nested classes, constructors, static init blocks, abstract methods, and integration with the java-design-patterns open-source project (< 3s response).wryyyds7 commentedon Jul 30, 2026
Update: Implementation progress for read_method_source_by_method_name (#137)
Summary
Implemented
read_method_source_by_method_nameas an MCP tool inyasa_mcp/tools/read_method_source_by_method_name.pythat reads the complete source code of a Java method by its fully qualified name, with overload disambiguation, Javadoc/annotation control, and support for constructors, abstract methods, and static initialization blocks.Key features
_compute_line_depths) + enhanced_extract_all_method_rangesthat accepts both{(method body) and;(abstract/interface declaration)parameter_typeslist for exact match; returnsambiguous: true+ candidate signatures when not specifiedinclude_javadoc=true(default) extracts/** ... */above method as separate field;falseomits itinclude_annotations=true(default) includes@xxxlines in source;falsestarts source from method declarationUser.Userreturns all overloads;ending accepted;start_line == end_line(single line declaration)static { ... }detected via_STATIC_INIT_PATTERN; accessed as<static_init>method namesrc/main/java/com/example/...), fallback to traversal with class name regexHow it works
method_full_name→ (package, class_name, method_name) viarsplit(".", 1)src/main/java/{package}/{class}.java, then traverse all.javafiles with class name pattern_extract_all_method_ranges(filters bydepth == class_depth + 1to exclude method-internal calls)parameter_typesor returnambiguous[source_start, actual_end](annotations → method}line)/** ... */Verification against acceptance criteria
ambiguous=True, 2 candidates with correct signaturesinclude_javadoc=Falseomits javadoc;include_annotations=Falseomits@GetMappingUser.Userreturns 2 constructor candidates<static_init>returnsstatic { ... }sourcestart_line == end_line, containsabstractTest coverage
$, no package, emptyPR
Will be created after tests pass.
wryyyds7 commentedon Jul 30, 2026
PR created: #154
[antgroup#138] list_methods_by_class_name: list all methods of a class
[antgroup#138] list_methods_by_class_name: list all methods of a class
[antgroup#138] list_methods_by_class_name: list all methods of a class
[antgroup#139] find_callers_by_method_name: find all call sites of a …
[antgroup#139] find_callers_by_method_name: find all call sites of a …
[antgroup#139] find_callers_by_method_name: find all call sites of a …
[antgroup#139] find_callers_by_method_name: find all call sites of a …
[antgroup#139] find_callers_by_method_name: find all call sites of a …