patch_widget_code
Apply targeted string replacements to specific fields (html, css, js) in custom widget code, with options for single or global replacement.
Instructions
Make targeted string replacements in a Custom Widget's code without rewriting it.
Each edit is `{"widget_id", "field", "old", "new", "replace_all"?}` where
`field` is one of `html`, `css`, or `js`. `old` is matched literally; if it
occurs more than once the edit fails unless `replace_all` is true (then every
occurrence is replaced).
Per-edit result reports `replacements` (count) or an `error` (widget not
found / wrong type / bad field / `old` not found / ambiguous match). The change is
written to both `srcDoc` and `uncompiledSrcDoc` so a reload can't revert it;
successful edits report `synced: true`.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": {
"edits": "<edits>"
},
"name": "patch_widget_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| edits | Yes |