Skip to main content
Glama

Run JavaScript in EasyEDA (full API)

easyeda_run_script

Execute custom JavaScript in EasyEDA Pro through the extension API to handle design actions not covered by dedicated tools.

Instructions

Execute JavaScript inside EasyEDA Pro with the COMPLETE extension API (eda.*, ~95 modules, every EasyEDA feature) — use it for anything the dedicated tools do not cover. In scope: eda (API root), lib (helpers: lib.schState(), lib.pcbComponents(true), lib.findSchComponent(ref), lib.safeModifySch(c, patch), lib.clickButton(text), lib.withAutoConfirm(fn, buttons), lib.ensureDoc("schematic"|"pcb")…), args (your JSON), runtime.sleep(ms), console.log (returned as logs). Use return to send back a value; EasyEDA primitive objects are auto-serialised via their getState_* methods; Blobs/Files come back as base64. Units: schematic = 0.01 inch, Y up. PCB = mil, Y up. Use easyeda_api_search to look up exact method signatures before guessing. Warning: sch/pcb modify() replaces otherProperty wholesale — use lib.safeModifySch / lib.safeModifyPcb instead of raw modify for components.

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": "easyeda_run_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNo
codeYes
visibleNobring EasyEDA to the front while running — disturbs the user, avoid
timeoutMsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and mostly meets it: it discloses data-loss risk ('sch/pcb modify() replaces otherProperty wholesale — use lib.safeModifySch / lib.safeModifyPcb'), return serialization (getState_* auto-serialise, Blobs/Files as base64), coordinate units (0.01 inch vs mil, Y up), and that console.log is captured as logs. It omits error/timeout semantics and what happens to runtime state after a failure, which a mutation-capable script runner should state.

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 capability statement, then scope, then return semantics, then a safety warning — a sensible ordering. The inline `lib.*` enumeration is long but functional; minor trimming possible without losing meaning.

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

Completeness4/5

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

For a high-power, high-blast-radius tool with no annotations and no output schema, the description supplies scope, return-value handling, unit conventions, and a concrete mutation hazard. The remaining gap is timeout/failure behavior and confirmation of what `visible` costs (partially covered by the schema description).

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 only 25% across 4 params, so the description must compensate, and it does: it defines what `code` executes against (`eda`, `lib`, `args`, `runtime.sleep`, `console`) and how `args` is consumed as JSON input. It adds nothing for `timeoutMs`, which is undocumented in both the schema and the description.

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 ('Execute JavaScript inside EasyEDA Pro with the COMPLETE extension API') and immediately positions it against the dedicated tools: 'use it for anything the dedicated tools do not cover'. An agent can distinguish this escape-hatch tool from the ~30 domain-specific siblings without opening the 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?

Explicitly routes usage: dedicated tools first, this tool for everything they don't cover, plus a concrete prerequisite step ('Use easyeda_api_search to look up exact method signatures before guessing'). It also names the alternative for the sub-task of API discovery, which is the main failure mode for a raw-API tool.

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