Skip to main content
Glama

Edit a component

patch_component

Apply exact source replacements to an existing component in one compile. Each replacement needs find, replace, all (false for a unique match). Empty replace deletes a span. Returns the Asset ID. Build and type-check failures reject the write before committing. The previous source and revision remain intact. Warnings do not block the build. Fix errors; do not chase warnings unrelated to visible defects. Visual check: right after writing or patching a component, inspect it visually with preview_component (before placing, to verify entrance, layout, readability and animation across its own time) and/or preview_frame and preview_range (once placed in the film with patch_film, over the real footage, using region or loupes for small detail). branchId null (or left out) means the current version; a version id from list_branches writes that version without switching the editor to it. Skills: read builtin-vidova-basics before the first component write, builtin-fonts before the first fontFamily, builtin-data-files before the first DataSrc prop (a map or chart from an uploaded data file), builtin-layout-flexbox before the first flex layout (a row of chips or pills, a card around text), and builtin-film-custom-components before the first placement with patch_film. A skill read once stays in the conversation: never read it again. Import @vidova/2d, @vidova/core and the packages in builtin-component-libraries; for a 3D scene also @vidova/components (View3D), three/webgpu and three/tsl, after reading builtin-3d. Export the named class and write atTime(time, duration), the only animation API: it sets every animated property from time and never yields or awaits. A source that declares an animate(), animateIn() or animateOut() generator is refused. Media signals use VideoSrc or AssetSrc, never string. Never shadow Node methods such as draw, scale or position. Use import_element for an unchanged library element and scaffold_component for a skeleton. name shared/ writes a shared module instead: plain TypeScript exports (functions, constants, types; no class, no Asset ID) at src/components/custom/shared/.ts that components import as ./shared/. The whole project is compiled and the write is rejected when a component that imports it breaks. Components import each other as ./Name; the parent calls child.atTime(time, duration) itself.

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": {
      "replacements": "<replacements>",
      "name": "<name>",
      "branchId": "<branchId>",
      "projectId": "<projectId>"
    },
    "name": "patch_component"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesComponent class name, a JavaScript identifier, or shared/<name> for a shared module that components import as ./shared/<name>.
branchIdYesVersion id from list_branches to write to, without switching the editor to it. null, or leaving it out, means the current version.
projectIdYesThe project this call runs on without changing the open project. null (or leaving it out) uses the open project. wait_for_jobs takes the projectId of the calls that started the jobs.
replacementsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Goes well beyond the annotations (readOnlyHint=false, destructiveHint=false, idempotentHint=false) by disclosing that build/type-check failures reject the write before committing, that the previous source and revision remain intact, that warnings do not block the build, that a source declaring animate()/animateIn()/animateOut() is refused, and that the whole project compiles so writes are rejected when an importing component breaks. These are exactly the mutation-safety facts an agent needs. It stops short of describing batch limits, conflict behavior on concurrent edits, or how long a full-project compile takes.

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

Conciseness3/5

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

The first sentence is a strong lead, but the body becomes a dense wall that mixes unrelated material: skill-read bookkeeping, import package rules, the atTime contract, media signal types, method-shadowing prohibitions, and shared-module semantics. Most items are individually useful, but they are ungrouped and unprioritized, making the core 'how to patch' guidance harder to extract.

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

Completeness5/5

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

For a high-stakes source-mutation tool with no output schema, the description covers the return value (Asset ID), failure modes, reversibility, the animation API contract, module imports, shared modules, and post-write verification. An agent has enough to call it correctly without consulting another source.

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

Parameters4/5

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

With 75% schema coverage the schema already documents each parameter, but the description adds real semantics: `all=false` means a unique match is required, an empty `replace` deletes a span, `branchId` null means the current version while a version id from list_branches writes that version without switching the editor, and `name` can be `shared/<name>` to emit a shared module with no Asset ID. Only `projectId` is left entirely to the schema.

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?

Opens with a specific verb and resource: 'Apply exact source replacements to an existing component in one compile.' This clearly separates it from replace_component, scaffold_component, and import_element, which are named later with their own distinct roles.

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

Usage Guidelines5/5

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

Explicitly routes the agent: 'Use import_element for an unchanged library element and scaffold_component for a skeleton,' and prescribes the follow-up workflow (preview_component before placing, preview_frame/preview_range once placed in the film). It also names prerequisites via the Skills list, so the agent knows what to read before the first write.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.