microcap-mcp
v0.1.1Simulate, generate and draw analog circuits in Micro-Cap 12: SPICE analyses, sweeps and schematics
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
simulate
Run a SPICE netlist through Micro-Cap and return the waveform data. The netlist is plain SPICE. Rules that will bite you if ignored: * Node ``0`` is ground and must exist. Every node needs a DC path to it, or the run fails to converge. * A ``.PRINT`` line is mandatory — it names the outputs you want. Without it Micro-Cap emits only an operating-point dump and no waveforms. * Match the analysis to the question: ``ac`` for frequency response and gain/phase, ``transient`` for time-domain behaviour and start-up, ``dc`` for bias points and transfer curves…
| Parameter | Type | Description |
|---|---|---|
netlist * | string | |
analysis | string | |
defines | ||
max_points | integer |
generate_amplifier
Draw a ``.CIR`` op-amp amplifier with a near-ideal op-amp. ``inverting`` gives gain ``-Rf/Rin``; ``non-inverting`` gives ``1 + Rf/Rg``. The feedback resistor is sized from ``gain`` and ``rin``. Produces a drawn schematic; feed it to ``simulate_schematic`` or hand the ``.CIR`` to the user. Args: gain: magnitude of the closed-loop gain (> 0; non-inverting needs >= 1). kind: ``inverting`` or ``non-inverting``. rin: input resistor (inverting) or gain resistor to ground (non-inverting); sets the feedback resistor from the gain. source: s…
| Parameter | Type | Description |
|---|---|---|
gain * | number | |
analysis | string | |
kind | string | |
output_node | string | |
rin | string | |
source | string |
generate_transistor_amplifier
Draw a ``.CIR`` common-emitter BJT gain stage (NPN primitive). Divider bias, unbypassed emitter degeneration, AC-coupled input. The midband gain magnitude is ``Rc/(Re+re')`` — roughly ``Rc/Re`` when ``Re`` is well above the intrinsic ``re'``. By default the ``R1``/``R2`` divider is computed to bias the collector at mid-supply, so the stage stays in the active region for any ``Rc``/``Re`` and the gain is real (a fixed divider would silently saturate as ``Rc`` grows). ``Rc`` must exceed ``Re``. Feed the result to ``simulate_schematic``. Args: rc, re: c…
| Parameter | Type | Description |
|---|---|---|
analysis | string | |
cin | string | |
output_node | string | |
r1 | ||
r2 | ||
rc | string | |
re | string | |
source | string | |
vcc | string |
generate_emitter_follower
Draw a ``.CIR`` emitter follower (common-collector BJT buffer). Collector straight to the supply, output at the emitter. Voltage gain is just under 1 (``Re/(Re+re')``); the value is current gain and low output impedance — a buffer that drives a heavy load without loading the source. The divider auto-biases the emitter at mid-supply so it can swing both ways. Feed the result to ``simulate_schematic``. Args: re: emitter resistor (sets the bias current ``Vcc/2 / Re``). r1, r2: base bias divider; leave unset to auto-bias, or give both. vcc: suppl…
| Parameter | Type | Description |
|---|---|---|
analysis | string | |
cin | string | |
output_node | string | |
r1 | ||
r2 | ||
re | string | |
source | string | |
vcc | string |
generate_mosfet_amplifier
Draw a ``.CIR`` common-source MOSFET gain stage (NMOS primitive). Gate divider bias, source degeneration, AC-coupled input, body tied to source. Midband gain is ``-gm*Rd/(1+gm*Rs)`` — roughly ``-Rd/Rs`` when ``gm*Rs`` is large. By default the gate divider is computed from the model's ``VTO``/``KP`` to bias the drain at mid-supply, so the device stays in saturation and actually amplifies (a mis-biased MOSFET drops out of saturation and the gain collapses). Feed the result to ``simulate_schematic``. Args: rd, rs: drain and (degeneration) source resistors.…
| Parameter | Type | Description |
|---|---|---|
analysis | string | |
cin | string | |
output_node | string | |
r1 | ||
r2 | ||
rd | string | |
rs | string | |
source | string | |
vdd | string |
generate_differential_pair
Draw a ``.CIR`` BJT long-tailed (differential) pair. Two matched NPN sharing an emitter tail resistor to ground, each collector loaded by ``Rc``. Single-ended drive on one base; the collectors ``OUTP`` and ``OUTN`` swing in antiphase, each with magnitude ``Rc/(2*re')``. The common-mode base voltage and tail resistor are auto-sized to bias both collectors near mid-supply, so the pair is balanced and in the active region — the differential gain then works out near ``Vcc/(4*Vt)``, set by the supply rather than by ``Rc``. Both collectors are labelled; the default…
| Parameter | Type | Description |
|---|---|---|
analysis | string | |
output_node | string | |
rc | string | |
rt | ||
source | string | |
vb | ||
vcc | string |
generate_current_mirror
Draw a ``.CIR`` BJT current mirror. A diode-connected NPN sets a reference current ``Iref = (Vcc - Vbe)/Rref``; a matched NPN copies it into ``Rload``. The mirrored current is ``Iout ≈ Iref`` (a few % high from the Early effect). It is a DC bias block, so run a transient/DC and read ``V(OUTC)``: the mirrored current is ``(Vcc - V(OUTC)) / Rload``. Args: rref: reference-leg resistor; sets ``Iref``. rload: load on the output transistor's collector. vcc: supply voltage. analysis: transient or dc (it is a bias block, not an AC stage).…
| Parameter | Type | Description |
|---|---|---|
analysis | string | |
output_node | string | |
rload | string | |
rref | string | |
vcc | string |
generate_cascode
Draw a ``.CIR`` cascode amplifier (common-emitter under common-base). A common-emitter transistor stacked under a common-base transistor. The midband gain is the common-emitter's, ``-Rc/(Re+re')``, but the upper transistor shields the lower one's collector from the output swing, so the Miller capacitance nearly vanishes and both output impedance and bandwidth rise — the reason to use a cascode over a plain common-emitter. All bias points are computed for a mid-supply output with active-region headroom, and both bases are driven by sources carrying their DC bias d…
| Parameter | Type | Description |
|---|---|---|
analysis | string | |
output_node | string | |
rc | string | |
re | string | |
source | string | |
vcc | string |
generate_schematic
Draw a ``.CIR`` schematic: a voltage source driving parts in series to ground, optionally with parallel branches from the output node to ground. Unlike a netlist, this produces a *drawn* schematic you can open in Micro-Cap. Feed the result to ``simulate_schematic`` to run it, or hand the ``.CIR`` text to the user. Bounded on purpose — a source, a series chain of two-terminal passives (R, C, L), and optional parallel shunt branches. That covers RC/RL/RLC, dividers, and resonant tanks. Every pin position is taken from Micro-Cap's own component library, so the…
| Parameter | Type | Description |
|---|---|---|
parts * | array | |
analysis | string | |
output_node | string | |
shunt | ||
source | string |
simulate_schematic
Run a Micro-Cap ``.CIR`` schematic and return its data. Use this to adapt a reference: fetch one with ``get_example`` (its ``format`` will be ``microcap_schematic``), change a component value or two in the text, and run the modified schematic here. ``simulate`` is for plain SPICE netlists; this is for the coordinate-carrying ``.CIR`` format. Numeric export is switched on automatically, ``NPts`` is overridden to ``points`` (the shipped setting is often ``0``, which exports one row), and the symbolic transient bound ``TMIN`` is repaired for batch mode — all the…
| Parameter | Type | Description |
|---|---|---|
schematic * | string | |
analysis | string | |
defines | ||
max_points | integer | |
points | integer |
sweep
Run one netlist repeatedly, varying a ``.DEFINE`` parameter. The deck must declare the symbol, e.g. ``.DEFINE RLOAD 1K``, and use it in a component value. Each value is a separate Micro-Cap run. Args: netlist: SPICE deck containing a ``.DEFINE`` for ``parameter``. parameter: the symbol to vary. values: values to substitute, e.g. ``["1K", "10K", "100K"]``. analysis: analysis to run for every value. max_points: cap on returned samples per run.
| Parameter | Type | Description |
|---|---|---|
netlist * | string | |
parameter * | string | |
values * | array | |
analysis | string | |
max_points | integer |
plot
Run a netlist and return Micro-Cap's own rendered plot as a JPEG image. Use this to *look* at a waveform. For numbers to reason about, use ``simulate`` — reading values off a picture is guesswork.
| Parameter | Type | Description |
|---|---|---|
netlist * | string | |
analysis | string | |
defines |
draw_schematic
Render a ``.CIR`` schematic as an SVG picture — the *drawing*, not a plot. Micro-Cap's own schematic-image command does not work in batch, so this draws the circuit directly from the ``.CIR`` (the same placements, wires and node labels), giving recognisable symbols for R/C/L, sources, ground, BJT/MOSFET and op-amp. Use it to *see* a circuit — a reference you fetched or one drawn by the generators — without opening Micro-Cap. No simulation runs. Returns SVG (vector, self-contained); save it as ``.svg`` or embed it.
| Parameter | Type | Description |
|---|---|---|
cir * | string |
annotate_schematic
Render the schematic as SVG with each labelled node's DC operating-point voltage written beside it — a marked-up drawing you can read the bias off. Runs the DC operating point (a short transient at t=0), reads the voltage at every ``[Grid Text]`` node the schematic labels (``IN``, ``OUT``, ``OUTP``…), and overlays them on the drawing. Best on the generated stages and other circuits that hold a stable operating point.
| Parameter | Type | Description |
|---|---|---|
cir * | string |
plot_schematic
Run a ``.CIR`` schematic and return Micro-Cap's rendered plot as a JPEG. The picture companion to ``simulate_schematic``: use it to *look* at the response of a schematic — a reference circuit you edited, or one drawn by ``generate_transistor_amplifier`` / ``generate_differential_pair`` / the other generators. For numbers to reason about, use ``simulate_schematic``.
| Parameter | Type | Description |
|---|---|---|
cir * | string | |
analysis | string | |
points |
simulate_example
Run one of Micro-Cap's own reference circuits and return its data. These are worked designs by the tool's authors, so this is the cheapest way to get a trustworthy baseline before modifying anything. Use ``describe_example`` first to see which analyses a circuit supports and what it plots — asking for an analysis it was not built for returns nothing useful. Numeric export is enabled automatically; the shipped circuits have it off. Args: name: reference circuit name. analysis: which analysis to run. max_points: cap on returned samples.…
| Parameter | Type | Description |
|---|---|---|
name * | string | |
analysis | string | |
max_points | integer | |
points | integer |
describe_example
Report what a reference circuit is set up to do, without running it. Returns the analyses it defines and the expressions it plots. Read this before ``simulate_example`` so you ask for an analysis that exists.
| Parameter | Type | Description |
|---|---|---|
name * | string |
list_domains
List the circuit-design domains Micro-Cap ships reference circuits for. Returns domain name -> circuit count. Start here before designing from scratch: a working reference beats an invented topology.
search_examples
Search the ~470 reference circuits by name or domain.
| Parameter | Type | Description |
|---|---|---|
query * | string | |
limit | integer |
get_example
Fetch one reference circuit's source text. ``.CKT`` files are plain SPICE and can be fed straight to ``simulate``. ``.CIR`` files are Micro-Cap schematics: text, but carrying component coordinates and analysis settings as well as the netlist.
| Parameter | Type | Description |
|---|---|---|
name * | string |