put_component
Create or replace a project component's source and props schema; validate and build it first, keeping the existing version if anything fails.
Instructions
Create or replace a project component's source and/or props schema (components//component., schema.json). code: an ES module whose default export is the element class, in JavaScript, TypeScript or JSX (file: component.js, .ts, .tsx, .jsx; default: the one there, else .js). Anything but a plain component.js is bundled into one module by MOGA (esbuild): it may import its own files in the folder and packages from the project's node_modules; JSX makes real DOM elements (SVG inside ) unless the file asks for React (/** @jsxRuntime automatic / /* @jsxImportSource react */). MOGA defines the tag and calls renderAt(t, props, ctx) every frame with t in seconds from the scene's start, props typed and filled from the schema's defaults (colour tokens resolved for the theme), ctx { fps, frame, width, height, theme, seed, colors }. Draw only from t and props (no timers, Date or Math.random), so any frame renders the same in any order. schema: { title, description, properties }. Both are checked first, and the source must build: a failure leaves the component as it was. Look at it with preview_component.
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": {
"tag": "<tag>"
},
"name": "put_component"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag | Yes | ||
| code | No | The whole source file | |
| file | No | Which source file code is (its language); a different one replaces the one there | |
| basis | No | What you read and followed to make this change, as refs from search or lookup: rule:<lint or taste rule>, taste, feedback:<id> (earlier feedback this follows; what it answers goes in feedback), commit:<id> (an earlier change it builds on), asset:, template:, skill:… The person sees them under the change, so they know why it is this way. Name only what shaped it. | |
| schema | No | { title, description, properties: { <prop>: { type, default, description, enum?, minimum?, maximum?, x-m3e-animatable?, x-m3e-text? } } } | |
| message | No | One line saying why, kept with the change in the history | |
| feedback | No | Ids of the feedback this change answers (notes and marks from list_notes, list_examples or the conversation). When the person keeps the change it joins the record of that feedback, and when they then mark the feedback resolved it is the fix; when they take it back, the feedback opens again. | |
| confidence | No | How sure you are this change is what the person wants. high: they asked for exactly this, or you measured it against a reference. medium: you inferred it from the taste, a rule or earlier feedback. low: you are guessing, or it changes something they did not ask about. The person's threshold decides which changes stand by themselves and which wait for them to keep; say it honestly on every change. |