Skip to main content
Glama
t0knight
by t0knight

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`.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
editsYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description provides substantial behavioral details: literal matching, failure on ambiguous match unless 'replace_all' is true, writing to both srcDoc and uncompiledSrcDoc, and per-edit result structure. It lacks disclosure about permissions or irreversibility, but covers the main behavioral traits well.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear goal, then detailed explanation. It is relatively long but every sentence adds value. A slight reduction could improve conciseness, but it remains focused.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (array of edit objects, no output schema), the description covers input format, per-edit result fields (replacements, error), and sync behavior. It does not explicitly describe the overall return structure (likely an array of results), but provides enough context for an agent to infer behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% for the single parameter, but the description fully explains the edit object structure with fields (widget_id, field, old, new, replace_all), including allowed field values, matching behavior, and effect of replace_all. This compensates completely for the missing schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Make targeted string replacements in a Custom Widget's code without rewriting it.' It uses a specific verb ('patch' vs 'rewrite') and resource, and distinguishes from siblings like 'update_custom_widget' which likely replaces the entire code.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool (targeted changes) vs alternatives like full rewrites via 'update_custom_widget'. However, it does not explicitly state when not to use it or name the alternative, leaving room for improvement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/t0knight/appsmith-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server