Skip to main content
Glama

Read the code and event binding of R3 Code components

r3_code_read
Read-onlyIdempotent

Read back what a Code component actually contains — its full JavaScript source and the event it runs on. r3_code_write reports what it wrote; this reports what is there.

Use it before replacing a script, so an edit builds on the real source instead of overwriting it blind, and after a write whose reply you did not see, to confirm what landed. Call it with NO entityRefs to get every Code component in the project — that is how you find a script again when you never received the entityRef for it.

Each script comes back with its codeVersion: pass it as r3_code_write's baseVersion. The event comes back as a NAME (RENDER_BEFORE, KEY_DOWN, …), which is the same form r3_code_write takes, so you can hand it straight back. r3_component_read reports the same field as a raw number and omits any source over 2000 characters; this is the tool for reading code.

A body too large to return is left out WHOLE and reported with its size — never truncated, because a partial script written back would delete the rest of it. An entityRef that does not exist is named and the others are still read.

Input Schema

NameRequiredDescriptionDefault
projectIdYesThe project to read from, from r3_project_create or r3_project_load.
entityRefsNoWhich Code components to read, e.g. ["spin"]. Omit for ALL of them. Up to 50 per call.

Output Schema

NameRequiredDescriptionDefault
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.
projectIdYes
componentsYes
unreadableYes
projectNameYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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",
      -  "projectName",
      -  "components",
      -  "unreadable"
      -]New value: +[
      +  "projectId",
      +  "projectName",
      +  "components",
      +  "unreadable",
      +  "answer"
      +]
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare the safe read-only, idempotent profile, but the description adds real behavioral detail beyond them: oversized bodies are omitted WHOLE with their size reported and never truncated, with the reason given (a partial write-back would delete the rest). It also specifies that an invalid entityRef is named while the other refs are still read — non-obvious partial-failure semantics.

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?

Front-loaded with the core purpose, then usage, then edge-case behavior; every sentence carries operational information and none is filler. The four-paragraph shape is slightly longer than strictly required for a two-parameter tool, which keeps it just short of top marks.

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?

An output schema exists so return values need no restatement, yet the description still supplies the two things the schema cannot: how to chain codeVersion back into r3_code_write and why truncated bodies are impossible. Combined with the fallback enumeration path and partial-failure behavior, an agent has everything needed to call this 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 the schema lacks: omitting entityRefs is framed as the way to enumerate every Code component and to recover a missing ref. It also explains that the returned codeVersion feeds r3_code_write's baseVersion and that the event returns as a NAME in write-compatible form.

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 and resource ('Read back what a Code component actually contains — its full JavaScript source and the event it runs on') and immediately contrasts itself with r3_code_write ('reports what it wrote; this reports what is there'). It also draws a firm line against the same-purpose sibling r3_component_read, so an agent can select correctly without opening any schema.

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?

Gives explicit when-to-use cases: before replacing a script so an edit builds on the real source, and after a write whose reply was not seen, to confirm what landed. It names alternatives (r3_code_write for writing, r3_component_read for shallow reads) and states the no-entityRefs fallback for recovering a lost entityRef.

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