test_match_code_rule
Test code against ast-grep YAML rules to verify pattern matching before applying to projects. Validate rule accuracy by scanning code samples.
Instructions
Test a code against an ast-grep YAML rule. This is useful to test a rule before using it in a project.
Internally calls: ast-grep scan --inline-rules --json --stdin
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>",
"yaml": "<yaml>"
},
"name": "test_match_code_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The code to test against the rule | |
| yaml | Yes | The ast-grep YAML rule to search. It must have id, language, rule fields. |