Skip to main content
Glama

Run new code LIVE in the user's open R3 editor

r3_editor_code
Destructive

The same tool as r3_code_write (this is its older name): replace a Code component's code, kept at once in the project's live copy: every R3 tab with the project open runs the new code now, no editor needed and nothing to save. Name it with componentId or entityRef and pass baseVersion, the codeVersion r3_code_read answered: code is never merged, so on an older version it is refused with the current code and version (apply your change to that and call again). The code is a FUNCTION BODY (a top-level return {start, update};); read r3_docs_read("CODE_PATTERNS.md") for the R3 APIs. A syntax error or an R3 API that does not exist is refused before anything is kept.

Input Schema

NameRequiredDescriptionDefault
codeYesThe whole new code (a function body).
entityRefNoOr its entityRef, e.g. "code_spin".
projectIdYesThe project (r3_project_list).
baseVersionNoREQUIRED: the codeVersion r3_editor_inspect gave for this Code component (the version your code builds on); null for one never saved (codeVersion null).
componentIdNoThe Code component's id.

Output Schema

NameRequiredDescriptionDefault
seqNo
liveYes
nameYes
errorYes
savedYes
answerYesThis answer in words: what was done, what R3 measured, decided or refused, and what to do next. The same text as the result's text block. Read it: the fields beside it are the data, this is the guidance.
editorYes
compiledYes
warningsYes
entityRefYes
projectIdYes
codeVersionYes
componentIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / editor / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "lastActiveAgoMs": {
      -        "type": "number"
      -      },
      -      "lastActiveAt": {
      -        "type": "string"
      -      },
      -      "openProjects": {
      -        "anyOf": [
      -          {
      -            "items": {
      -              "additionalProperties": false,
      -              "properties": {
      -                "id": {
      -                  "type": "string"
      -                },
      -                "name": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                }
      -              },
      -              "required": [
      -                "id",
      -                "name"
      -              ],
      -              "type": "object"
      -            },
      -            "type": "array"
      -          },
      -          {
      -            "type": "null"
      -          }
      -        ]
      -      },
      -      "openedAt": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      }
      -    },
      -    "required": [
      -      "openedAt",
      -      "lastActiveAt",
      -      "lastActiveAgoMs",
      -      "openProjects"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "frames": {
      +        "anyOf": [
      +          {
      +            "additionalProperties": false,
      +            "properties": {
      +              "advancing": {
      +                "type": "boolean"
      +              },
      +              "frameSeen": {
      +                "type": "boolean"
      +              },
      +              "sceneShown": {
      +                "type": "boolean"
      +              },
      +              "visible": {
      +                "type": "boolean"
      +              }
      +            },
      +            "required": [
      +              "advancing",
      +              "visible",
      +              "sceneShown",
      +              "frameSeen"
      +            ],
      +            "type": "object"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ]
      +      },
      +      "lastActiveAgoMs": {
      +        "type": "number"
      +      },
      +      "lastActiveAt": {
      +        "type": "string"
      +      },
      +      "openProjects": {
      +        "anyOf": [
      +          {
      +            "items": {
      +              "additionalProperties": false,
      +              "properties": {
      +                "id": {
      +                  "type": "string"
      +                },
      +                "name": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                }
      +              },
      +              "required": [
      +                "id",
      +                "name"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ]
      +      },
      +      "openedAt": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      }
      +    },
      +    "required": [
      +      "openedAt",
      +      "lastActiveAt",
      +      "lastActiveAgoMs",
      +      "openProjects"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  2. Changed2 schema fields changed
    • addedOutput schema / properties / answer
      Added value: +{
      +  "description": "This answer in words: what was done, what R3 measured, decided or refused, and what to do next. The same text as the result's text block. Read it: the fields beside it are the data, this is the guidance.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "projectId",
      -  "componentId",
      -  "entityRef",
      -  "name",
      -  "compiled",
      -  "error",
      -  "warnings",
      -  "live",
      -  "saved",
      -  "codeVersion",
      -  "editor"
      -]New value: +[
      +  "projectId",
      +  "componentId",
      +  "entityRef",
      +  "name",
      +  "compiled",
      +  "error",
      +  "warnings",
      +  "live",
      +  "saved",
      +  "codeVersion",
      +  "editor",
      +  "answer"
      +]
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already flag destructive/openWorld, and the description adds substantial context beyond them: changes apply immediately to all open tabs, code is never merged, a stale baseVersion is refused with the current code and version, and syntax/unknown-API errors are rejected before anything is persisted. This atomicity and conflict-handling detail is exactly the behavioral disclosure the annotations cannot convey.

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?

Purpose is front-loaded and most clauses earn their place (conflict handling, function-body format, doc reference). It is a dense run-on sentence with some parenthetical redundancy around the r3_code_write alias, but no filler.

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?

With an output schema present, return values need no explanation, and the description still covers naming, versioning, code format, error/refusal behavior, and live semantics. An agent has everything needed to invoke it correctly.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds meaning: it explains the componentId/entityRef alternative naming, why baseVersion is required (the version the code builds on), and null for never-saved components. Minor inconsistency: it attributes the codeVersion to r3_code_read while the schema cites r3_editor_inspect.

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?

States a specific verb (replace a Code component's code) and resource, plus the exact effect (runs live in every open R3 tab). It explicitly names r3_code_write as the same/older name and r3_code_read as the version source, so an agent can disambiguate from siblings.

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?

Gives clear context (live application, no editor/save needed) and routes to r3_code_read for the version and r3_docs_read("CODE_PATTERNS.md") for APIs. It does not, however, state when *not* to use it versus r3_code_write or the non-live code path.

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.

Resources