delete_key
Remove key-value pairs from dict-like containers in JSON, YAML, TOML, and Python files while maintaining file validity by handling adjacent commas and syntax.
Instructions
Delete a key-value pair from a dict-like container. Works for JSON/YAML/TOML AND Python module-level dict literals. For JSON, also removes the adjacent comma to keep the file valid.
For JSON/YAML/TOML: target is the dotted path to the key (e.g. 'dependencies.mcp'). For Python (.py): target is 'DictName.keyExpr' where keyExpr is the literal key as it appears in source (e.g. 'CONFIG."timeout"').
Use this when: You want to remove an entire dict entry.
Don't use this when: You want to remove an item from a list/array -> use
remove_from_array.
Example (JSON): target="dependencies.tree-sitter" Example (Python): target='CONFIG."timeout"'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| target | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |