apply_rewrite_rule
Apply a formal Double-Pushout rewrite rule to a diagram using a rule spec and match mapping, transforming its graph structure and returning modified stats.
Instructions
Apply a formal Double-Pushout (DPO) rewrite rule to a diagram.
Args: diagram_id: Target diagram ID rule_spec: Serialize RewriteRule dict with 'lhs' and 'rhs' patterns match_mapping: Mapping of rule LHS node IDs to diagram node IDs (from pattern_match)
Returns: dict containing success status and modified diagram stats
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": {
"diagram_id": "<diagram_id>",
"rule_spec": "<rule_spec>",
"match_mapping": "<match_mapping>"
},
"name": "apply_rewrite_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule_spec | Yes | ||
| diagram_id | Yes | ||
| match_mapping | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||