ec-sim-mcp

v0.3.0
ec-sim-mcp Checked 1 day ago Published 16 days ago

MCP server that lets an AI agent drive the Ec-Sim circuit simulator in an open browser tab

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

open_editor

Connect to the Ec-Sim editor in the user's browser. Call this first. Returns whether a tab is linked and, if not, the pairing link; by default it also opens the link in the default browser and waits for the user to press Connect. The user watches every change you make in that tab.

ParameterTypeDescription
launchbooleanOpen the pairing link in the default browser when no tab is linked (default true).
wait_snumberSeconds to wait for the tab to link (default 60, max 300).

export_waveforms

Write the data of the last simulation to a CSV file on this computer and return its path: one row per solver time point (no resampling), first column time in seconds (or frequency in Hz), one column per signal. Use it when you need the full data, for a script or a spreadsheet; read the file with your own tools. signals may be recorded signals or math expressions; left out, every recorded V, I, P and Ploss signal is written (at most 64). from/to limit the rows to a part of the run. Without "path" the file goes to a new file in the system temp folder.

ParameterTypeDescription
fromnumber
overwritebooleanReplace the file at "path" if it exists (default false).
pathstringAbsolute path of the file to write; must end in .csv.
signalsarray
tonumber

list_component_types

Part types the simulator has, with their pin names, where each pin is relative to the part's centre for every rotation (pin_offsets, in grid steps), the room the part takes (outline), where its text is written, how much space parts need between them (spacing), the unit of their main value, and their parameters (SI units and defaults).

list_parts

The parts library of the editor (real diodes, zeners, LEDs, BJTs, MOSFETs, JFETs, op-amps) as a table in SI units. Without "type": the categories and how many parts each has. With "type": the table of that category. Narrow it with "where" (limits on any column, in SI: {"bv": {"min": 60}, "rdsOn": {"max": 0.02}}), order it with "sort" (a column name; "-rdsOn" for high to low), and filter by words with "search" (must appear in the part number, description or technology, e.g. "schottky" or "logic-level"). Example: the lowest-resistance N-channel MOSFETs for at least 60 V and 20 A: {"type": "nmos"…

ParameterTypeDescription
limitintegerRows to return (default 50, max 200).
offsetintegerRows to skip (for the next page).
searchstring
sortstringColumn to sort by, low to high; put "-" in front for high to low.
typestringPart type, e.g. nmos, diode, opamp.
whereobjectColumn name -> {"min": number, "max": number} (either or both), in the SI unit of the column. A part without a value for a limited column is left out.

list_examples

Built-in example circuits (keys for load_example).

load_example

Replace the circuit in the editor with a built-in example and return it.

ParameterTypeDescription
key *string

get_circuit

The circuit currently in the editor as a netlist: parts with values, parameters, bindings to variables and the net on each pin, the variables, the simulation settings, the probes, the math waveforms, the design notes, the result of the electrical rule check, and the revision. Works for circuits the user drew by hand too.

set_circuit

Replace the circuit in the editor. Give either "parts" (structured netlist) or "spice" (a SPICE deck). The editor draws it as a schematic: you choose where each part goes ("at" for the first part of a block, "next_to" for the parts around it, "rotation") and the editor draws the wires, falling back to net labels only where parts are far apart or the way is blocked. Every net keeps the name you give it (V(name) refers to it), carried on its wires without being shown; "labels" chooses the few names to show. Parts placed too close for their wires are refused with the reason and the room each one…

edit_circuit

Change the circuit in place; all operations succeed or none is applied. Operations: {"op":"set_value","part":"R1","value":"2.2k"}, {"op":"set_params","part":"M1","params":{"rdsOn":0.02}} (null removes a parameter; a function block's numInputs (0 to 8) or numOutputs (1 to 8) gives it the pins for the new count and draws it again, the pins it keeps stay on their nets, and the reply names any pin that went with its net), {"op":"set_model","part":"M1","model":"IRLZ44N"} (a library part from list_parts), {"op":"bind","part":"R1","bindings":{"value":"Rfb","tcr":null}} (the field follows a circuit va…

ParameterTypeDescription
operations *array
revision *numberRevision of the circuit this call is based on (from get_circuit or the previous reply). The call fails if the circuit changed since.

get_variables

The variable table of the circuit: every variable with its value as written ("value": a number or a formula), the number it resolves to in SI ("result"), its unit and note, and who uses it ("used_by": part fields such as "R1.value" or "M1.rdsOn", "U1.expressions" for a function block, "simulation.tStop", "math <name>", "variable <name>" for another variable's formula). A variable without a value has "error" instead of "result"; "problems" lists every variable and bound field that has no value.

set_variables

Create variables or change existing ones; a name that exists is overwritten, and fields left out keep what they were. One variable can drive any number of parts: let a field follow it with edit_circuit {"op":"bind","part":"R1","bindings":{"value":"Rfb"}} or "bindings" of a part. Changing a variable moves every part field and setting that follows it, directly or through another variable's formula, in the same step: the reply lists them in "moved" with the old and the new number, and returns the table. Variable names can also be written in function-block expressions and math waveforms, where the…

ParameterTypeDescription
variables *array
revisionnumberOptional: the revision this call is based on; the call then fails if the user changed the circuit since.

delete_variables

Delete variables by name. A variable that is still used (see "used_by" of get_variables) is not deleted and the call says who uses it, unless "detach" is true: then everything that used it keeps its present value. A field that followed only this variable becomes a plain number; a formula that also uses other variables gets the number written into it.

ParameterTypeDescription
names *array
detachboolean
revisionnumberOptional: the revision this call is based on; the call then fails if the user changed the circuit since.

set_probes

Choose the signals shown in the editor's waveform viewer (replaces the current probes). run_simulation reports numbers for these.

ParameterTypeDescription
signals *arraySignals to show in the waveform viewer: V(net), I(part), P(part), Ploss(part).

get_drawing

The drawing with positions, for wiring by hand and for judging the layout: every part with its centre, rotation, and each pin's position and net (null = nothing drawn on the pin yet); every ground symbol and net label; every probe; every wire with its id, its corner points, its net and "name_shown" when the net name is written on it; and "layout": the size of the drawing, area and wire length per part, crossings and text overlaps, with the values to aim for. Positions are in grid steps of 20 px; x grows to the right, y downwards. Use get_circuit for the netlist itself.

place_part

Place one part on the schematic without wires, to wire it yourself with draw_wire (for adding to a circuit; a new circuit starts with set_circuit). Give "at" (centre in grid steps) or "next_to" (a pin of it a stated number of steps from a pin of another part) and, where needed, "rotation", "mirrorX" or "mirrorY"; the reply lists where its pins are, in grid steps, ready for draw_wire. "part" is as in set_circuit but without "nets". A part placed bare only needs 1 free grid step to the bodies around it, so parts you wire yourself can sit closer than parts the editor wires. Left-out place: the ne…

ParameterTypeDescription
part *objectThe part to place: id, type, value or model, params, and where ("at" or "next_to", "rotation"). No "nets".
revisionnumberOptional: the revision this call is based on; the call then fails if the user changed the circuit since.

draw_wire

Draw one wire, exactly where you say: to replace an automatic wire you removed, or to connect a part you placed. "from" and "to" are pins ("R1.p2") or points in grid steps; "via" adds corner points in between. Two consecutive points that are not in line get one corner between them: the horizontal part first, or the vertical part with "first": "vertical". A wire connects at its two ends (to a pin, to another wire's end, or to the middle of another wire, which makes a junction dot) and at a pin you give as a "via" point; wires that only cross are not connected. Nothing is snapped: a wire through…

ParameterTypeDescription
from *A pin, written "R1.p2", or a point {"x": ..., "y": ...} in grid steps.
to *A pin, written "R1.p2", or a point {"x": ..., "y": ...} in grid steps.
firststringWhich way to leave a point when the next one is not in line (default horizontal).
revisionnumberOptional: the revision this call is based on; the call then fails if the user changed the circuit since.
viaarrayCorner points between from and to, in order.

remove_wire

Remove a wire by its id (from draw_wire or get_drawing), or only one of its segments: "segment" 0 is the one that starts at its first point. Removing a middle segment leaves two shorter wires. The reply lists what is left and says if a net fell apart.

ParameterTypeDescription
wire *string
revisionnumberOptional: the revision this call is based on; the call then fails if the user changed the circuit since.
segmentinteger

place_symbol

Place a ground symbol or a net label with its connection point exactly at "at" (a pin, or a point in grid steps; usually the end of a wire). A ground symbol hangs down from the point and makes the net ground ("0"). A net label shows the name of the net ("name") and V(name) refers to it; nets that show the same name (by a label, or by a name written on a wire) are one net without a wire between them. "side" puts a label's text left or right of the point.

ParameterTypeDescription
at *A pin, written "R1.p2", or a point {"x": ..., "y": ...} in grid steps.
type *string
namestringNet name (net_label only).
revisionnumberOptional: the revision this call is based on; the call then fails if the user changed the circuit since.
sidestring

move_label

Move a piece of text so the drawing reads cleanly. Name exactly one of: "part" (the designator and value text of a part: give "offset" in grid steps from where the editor puts it, x to the right and y downwards, fractions allowed; {"x": 0, "y": 0} puts it back), "probe" (the badge of a probe such as "V(out)": give "offset" the same way), or "symbol" (a net label or ground symbol, by its id: give "at", the pin or point its connection point moves to, and for a label optionally "side" to put the text left or right). Moving text never changes the circuit. Moving a net label or ground symbol can, b…

ParameterTypeDescription
atA pin, written "R1.p2", or a point {"x": ..., "y": ...} in grid steps.
offsetobject
partstring
probestring
revisionnumberOptional: the revision this call is based on; the call then fails if the user changed the circuit since.
sidestring
symbolstring

remove_symbol

Remove a ground symbol or net label by its id (from place_symbol or get_drawing).

ParameterTypeDescription
symbol *string
revisionnumberOptional: the revision this call is based on; the call then fails if the user changed the circuit since.

set_measurements

Save the measurements of the circuit: named numbers taken from a signal of every run, with optional limits. They are kept with the circuit (the user sees them under Measure in the waveform viewer, get_circuit returns them) and replace the list that was there. Each is {"name": "ripple", "signal": "V(out)", "measure": "peak_to_peak", "from": 0.002, "lower": 0, "upper": 0.05}: "measure" is one of min, max, peak_to_peak, average, rms, initial, final, value_at, rise_time, fall_time, frequency, period, duty_cycle, overshoot, settling_time, cutoff_low, cutoff_high, phase_at (as in the measure tool; a…

ParameterTypeDescription
measurements *array

keep_reference

Keep a recorded signal of the last result as a reference trace: a curve that stays in the viewer and in the project while the circuit changes, so the next run can be compared with it. Keep the signals you care about BEFORE changing the circuit, change it, run again, then measure the difference: the reference is a signal of its own, so "V(out) - ref_V_out" works in measure, get_waveform and math waveforms. "signal" or "signals" name recorded signals; "name" names a single reference (default ref_<signal>); "run" picks a run of a stepped result. "limit": "upper" or "lower" makes the reference a l…

ParameterTypeDescription
limitstring
limit_forstring
namestring
runnumber | string
signalstring
signalsarray

list_references

The reference traces of the project: name, the signal each was taken from, its range and number of points, when it was taken, and whether it is a limit. With a result present, also the runs that go beyond a limit.

remove_reference

Remove reference traces by name ("name" or "names").

ParameterTypeDescription
namestring
namesarray

set_design_notes

Write the design notes of the project: free text the user reads under Edit > Design Notes and that is saved with the project (get_circuit returns it as "notes"). Use it to record the requirements, the decisions you took and why, and the measured results, so the reasoning stays with the design. "append": true adds a paragraph to what is there, which keeps what the user wrote; without it the text is replaced. At most 20000 characters.

ParameterTypeDescription
text *string
appendboolean

set_math_waveforms

Choose the math waveforms shown in the editor's waveform viewer (replaces the current ones; an empty list removes them). Each is a named expression over the signals of a transient result, drawn as its own trace. Returns min/max/average/rms/final of each when a result exists. The same expressions work as "signal" in measure and get_waveform. Syntax: signals V(net), I(part), P(part), Ploss(part), used with or without a probe; t is time in seconds. Write a signal as the result names it (run_simulation lists them): other spellings are not matched, only a difference in upper and lower case when tha…

ParameterTypeDescription
waveforms *array

run_simulation

Run the simulation in the editor (the user sees the waveforms) and return its status, warnings, errors with the node or device at fault, the list of recorded signals, and min/max/average/rms/final for each probed signal. Optionally change the simulation settings first. Waveforms are not returned; use measure or get_waveform.

ParameterTypeDescription
simulationobjectSimulation settings in SI. transient: tStop, tStepMax (default tStop/500), outputStart, zeroStart, accuracy. ac: fStart, fStop, pointsPerDecade (a source needs acMag). dc_op: none. dc_sweep: sweepSour…
timeout_snumberStop the run after this many seconds (default 120, max 600).

measure

Numbers from the last simulation result. signal is a recorded signal such as V(out) or I(L1), or (transient) a math expression such as "V(out)*I(R1)". Measurements: min, max, peak_to_peak, average, rms, initial, final, value_at (needs at), rise_time, fall_time (10-90%), frequency, period, duty_cycle, overshoot, settling_time (band, default 0.02), and for AC results cutoff_3db (both −3 dB frequencies around the peak), cutoff_low (the one below the peak), cutoff_high (the one above it) and phase_at (needs at, in Hz). AC magnitudes are in dB. from/to limit the window (seconds, or Hz for AC). A…

ParameterTypeDescription
signal *string
atnumber
bandnumber
fromnumber
measurementsarray
runnumber | stringAfter a stepped run: which run, 0 for the first value (default) or its label such as "Rfb=2.2k".
tonumber

get_waveform

The plotted data: points of up to 8 signals from the last result, resampled to at most max_points (default 200, max 2000). from/to return only that part of the run (seconds, or Hz for AC), at full detail within the window. Prefer measure when a number answers the question.

ParameterTypeDescription
signals *array
fromnumber
max_pointsnumber
runnumber | stringAfter a stepped run: which run, 0 for the first value (default) or its label.
tonumber

screenshot

A PNG picture of what the user sees. view "schematic" (default): the whole drawing with its probes, always fitted to the picture whatever the user's zoom; give "parts" to get a close-up of the area around those parts instead. When the whole drawing would be too small to read, the reply says so in "note": then take close-ups, one block at a time. view "waveforms": the plot panes of the waveform viewer as shown now, with their zoom and cursors (needs a simulation result). Look at the schematic after every set_circuit and after adding parts: check that parts and labels do not overlap, that wires…

ParameterTypeDescription
max_widthintegerLargest width of the picture in pixels (default 1400, max 2400).
partsarraySchematic only: part ids to zoom in on, e.g. ["M1", "D1"].
viewstring

export

Export the circuit: "spice" (netlist text), "bom" (CSV), or "share_link" (a URL that opens a copy of the circuit in the editor).

ParameterTypeDescription
format *string