Skip to main content
Glama

Run drawing script

run_script

Execute JavaScript to procedurally draw patterns, particles, and brushwork in Atelier, creating animated art as a single undoable step.

Instructions

Run JavaScript that draws procedurally (forests of grass, hatching, particles, patterns...). The whole script is ONE undo step and is animated live in the UI. All calls are synchronous. API (same args as the tools): stroke(strokeOrArray, defaults?) shape(shapeOrArray, opts?) text(itemOrArray, opts?) fill(args) filter(filterOrArray, opts?) select(args) addLayer(args) updateLayer(args) deleteLayer(ref) duplicateLayer(args) mergeLayers(args) clearLayer(args) transformLayer(args) layerMask(args) canvasSettings(args) note(text) sample(x, y, layer?) -> {hex, alpha, hsl} layers() -> [{id,name,...}] W, H (canvas size) rand() [0,1) seeded · random(a,b) · randInt(a,b) · pick(array) · gauss() ≈N(0,1/3) clipped to [-1,1] · noise(x,y) Perlin [-1,1] · fbm(x,y,octaves) hsl(h,s,l,a?) s,l in 0..100 -> css · rgb(r,g,b,a?) · mix(colorA, colorB, t) -> hex · lighten(color, amount) · lerp · clamp · print(...) (console.log too) Example: for (let i=0;i<300;i++){ const x=random(0,W); stroke({brush:"grass", color:hsl(100+random(-15,15),45,random(25,45)), points:[[x,H-20],[x+random(-20,20),H-60-random(0,80)]], layer:"Grass"}) }

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": {
      "code": "<code>"
    },
    "name": "run_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesJavaScript source
seedNoSeed for rand()/noise (default random)
labelNoName shown in history/UI

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations present, the description carries the burden and does disclose meaningful behavior: the whole script is ONE undo step, is animated live in the UI, and all calls are synchronous. It omits error behavior, what happens if the script throws mid-run, and execution/time limits, which matters for arbitrary code execution.

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 and undo/animation behavior before the reference material. The API listing is long but each line is functional reference an agent needs to author valid code, and the closing example is a compact demonstration; only minor trimming would be possible.

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

Completeness3/5

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

For an arbitrary-code-execution tool with no output schema and no annotations, the definition never says what run_script returns, whether print output is captured, or how failures surface. The drawing API and undo semantics are well covered, but the post-invocation contract is missing.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description does add meaning by tying rand()/noise to the seed and by exposing W/H canvas size and the available drawing/layer functions, but it does not explain the label parameter or seed semantics beyond what the schema already states.

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: run JavaScript that draws procedurally, with concrete examples (grass, hatching, particles, patterns). The line 'API (same args as the tools)' makes clear this is the programmatic bulk alternative to the single-purpose drawing siblings such as stroke, shape, and text.

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?

Usage context is clear: procedural/bulk drawing via code, synchronous, one undo step. There is no explicit when-not guidance (e.g., when to prefer a direct stroke call over a script) and no stated prerequisites or execution limits, so it falls short of a full 5.

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