Skip to content

Commit e86ebdb

Browse files
Merge pull request #10 from sebthom/patch-1
Add underlying ast-grep commands to MCP tool documentation
2 parents 1ddfd03 + c2f6f9b commit e86ebdb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ def dump_syntax_tree(
7171
`format` is the output format of the syntax tree.
7272
use `format=cst` to inspect the code's concrete syntax tree structure, useful to debug target code.
7373
use `format=pattern` to inspect how ast-grep interprets a pattern, useful to debug pattern rule.
74+
75+
Internally calls: ast-grep run --pattern <code> --lang <language> --debug-query=<format>
7476
"""
7577
return run_ast_grep_dump(code, language, format.value)
7678

@@ -83,6 +85,8 @@ def test_match_code_rule(
8385
"""
8486
Test a code against an ast-grep YAML rule.
8587
This is useful to test a rule before using it in a project.
88+
89+
Internally calls: ast-grep scan --inline-rules <yaml> --json --stdin
8690
"""
8791
args = ["ast-grep", "scan","--inline-rules", yaml, "--json", "--stdin"]
8892
if CONFIG_PATH:
@@ -113,6 +117,8 @@ def find_code(
113117
Find code in a project folder that matches the given ast-grep pattern.
114118
Pattern is good for simple and single-AST node result.
115119
For more complex usage, please use YAML by `find_code_by_rule`.
120+
121+
Internally calls: ast-grep run --pattern <pattern> --json <project_folder>
116122
"""
117123
return run_ast_grep_command(pattern, project_folder, language)
118124

@@ -127,6 +133,8 @@ def find_code_by_rule(
127133
It is a more advanced search tool than the simple `find_code`.
128134
129135
Tip: When using relational rules (inside/has), add `stopBy: end` to ensure complete traversal.
136+
137+
Internally calls: ast-grep scan --inline-rules <yaml> --json <project_folder>
130138
"""
131139
return run_ast_grep_yaml(yaml, project_folder)
132140

0 commit comments

Comments
 (0)