接口介绍
给定类全限定名,一次性返回该类的所有方法清单(签名、可见性、起止行号、注解),可选附带方法源码或仅返回签名;支持是否包含从父类/接口继承的方法。
工具名
list_methods_by_class_name
背景与目标
LLM Agent 经常需要"扫一遍某个类全貌"才能决定下一步看哪个方法。文件级读 + 自己拆方法 token 太重。这个工具把类的方法清单作为一次性结构化输出返回,是上层链路的目录级入口。
输入参数
| 参数 |
类型 |
必填 |
说明 |
class_full_name |
string |
是 |
类全限定名 |
repository_path |
string |
是 |
仓库本地绝对路径 |
include_inherited |
bool |
否 |
默认 false。true 时把继承自父类/接口的方法也列出(不返 source,只返签名) |
include_private |
bool |
否 |
默认 true |
include_source |
bool |
否 |
默认 true。false 时只返签名,适合先打目录再按需取源码 |
输出结构
{
"class_full_name": "com.example.UserController",
"file_path": "src/main/java/com/example/UserController.java",
"class_start_line": 14,
"class_end_line": 312,
"extends_class": "com.example.BaseController",
"implements_interfaces": ["com.example.RequestValidator"],
"total_methods": 8,
"methods": [
{
"method_signature": "getUser(HttpServletRequest, String): ResponseEntity<User>",
"method_short_name": "getUser",
"visibility": "public",
"is_static": false,
"is_abstract": false,
"start_line": 87,
"end_line": 105,
"annotations": ["@GetMapping(\"/users/{id}\")"],
"source": "@GetMapping(\"/users/{id}\")\npublic ResponseEntity<User> getUser(...) { ... }",
"inherited_from": null
}
]
}
验收标准
预估工作量
2-3 人日
接口介绍
给定类全限定名,一次性返回该类的所有方法清单(签名、可见性、起止行号、注解),可选附带方法源码或仅返回签名;支持是否包含从父类/接口继承的方法。
工具名
list_methods_by_class_name背景与目标
LLM Agent 经常需要"扫一遍某个类全貌"才能决定下一步看哪个方法。文件级读 + 自己拆方法 token 太重。这个工具把类的方法清单作为一次性结构化输出返回,是上层链路的目录级入口。
输入参数
class_full_namerepository_pathinclude_inheritedinclude_privateinclude_source输出结构
{ "class_full_name": "com.example.UserController", "file_path": "src/main/java/com/example/UserController.java", "class_start_line": 14, "class_end_line": 312, "extends_class": "com.example.BaseController", "implements_interfaces": ["com.example.RequestValidator"], "total_methods": 8, "methods": [ { "method_signature": "getUser(HttpServletRequest, String): ResponseEntity<User>", "method_short_name": "getUser", "visibility": "public", "is_static": false, "is_abstract": false, "start_line": 87, "end_line": 105, "annotations": ["@GetMapping(\"/users/{id}\")"], "source": "@GetMapping(\"/users/{id}\")\npublic ResponseEntity<User> getUser(...) { ... }", "inherited_from": null } ] }验收标准
inherited_from字段include_source=false时返回不带 source 的轻量版预估工作量
2-3 人日