Spice Simulate
spice_simulateSimulate a circuit with ngspice to get numeric results for operating point, DC sweep, AC frequency sweep, or transient analysis from a netlist.
Instructions
Simulate a circuit with ngspice and return numbers. Give the netlist as text ('netlist') or a file ('netlist_file'), choose 'analysis' op (DC operating point), dc (sweep one source), ac (small-signal frequency sweep) or tran (transient), and list 'outputs' such as 'v(out),i(v1)'. op returns every output as a value; sweeps return min/max/final of each output (ac: of the magnitude) and write the full table to result.csv. The first line of a netlist is its title. The netlist is parsed against an allow-list: .control, .include, .lib, .write, code models (A, N devices) and the like are refused; analyses come from these parameters, not from the netlist. ngspice must be installed (see toolkit_doctor). Current sign: i(v1) is positive into the + terminal, so a source driving a load shows a negative current.
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": {
"analysis": "<analysis>"
},
"name": "spice_simulate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| step | No | dc: increment with unit ('0.1 V'); tran: output step and largest internal step ('10 us'); at most 100000 points | |
| stop | No | dc: last value ('5 V'); ac: last frequency ('1 MHz'); tran: end time ('1 ms') | |
| start | No | dc: first value with unit ('0 V'); ac: first frequency ('10 Hz'); tran: first time kept (default '0 s') | |
| sweep | No | ac only: spacing 'dec' (default), 'oct' or 'lin' | dec |
| points | No | ac only: points per decade/octave (e.g. 20), or the total number of points for sweep 'lin' | |
| netlist | No | The netlist text (first line = title). Give this OR netlist_file. | |
| outputs | No | Comma-separated, e.g. 'v(out),i(v1)': v(node) of a node, i(name) of a voltage source or inductor. Empty = every node voltage (at most 16 nodes). | |
| analysis | Yes | One of: op, dc, ac, tran | |
| netlist_file | No | Path to a netlist file (.cir .sp .spice .net .ckt .txt). Give this OR netlist. | |
| sweep_source | No | dc only: the name of the voltage or current source to sweep, e.g. 'V1' | |
| use_initial_conditions | No | tran only: start from the .ic / ic= values instead of a DC operating point (SPICE 'uic') |