create_rule
Create a new Semgrep rule to detect code patterns by specifying a search pattern, target language, and message. Output the rule to a file for use in static analysis.
Instructions
Creates a new Semgrep rule
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": {
"output_path": "<output_path>",
"pattern": "<pattern>",
"language": "<language>",
"message": "<message>"
},
"name": "create_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output_path | Yes | Absolute path for output rule file | |
| pattern | Yes | Search pattern for the rule | |
| language | Yes | Target language for the rule | |
| message | Yes | Message to display when rule matches | |
| severity | No | Rule severity (ERROR, WARNING, INFO) | WARNING |
| id | No | Rule identifier | custom_rule |