Skip to main content
Glama
lucasgerads

spicelib-mcp

by lucasgerads

run_sweep

Execute multiple SPICE simulations in parallel with component value sweeps, replacing manual loops for faster multi-run analysis.

Instructions

Run multiple SPICE simulations in parallel, sweeping component values.

Uses spicelib's SimRunner to execute runs concurrently. Each run gets its own .npz file. Use this instead of calling run_ac_analysis / run_transient in a loop — it's significantly faster for multi-run sweeps.

Example — sweep capacitor C1 across three values with a transient analysis: run_sweep( netlist_path="/path/to/filter.cir", analysis_cmd=".tran 1n 1u", runs=[{"C1": "1p"}, {"C1": "10p"}, {"C1": "100p"}], ) Output files: filter_sweep_001.npz, filter_sweep_002.npz, filter_sweep_003.npz

Each dict in runs maps component reference designators or SPICE parameter names to their new values (strings with optional SPICE suffix, e.g. "4.7k").

Args: netlist_path: Absolute path to the netlist file analysis_cmd: Full SPICE analysis line, e.g. ".tran 1n 1u" or ".ac dec 20 1 1G" runs: List of dicts, one per simulation. Keys are component names or parameter names; values are the new value strings. parallel: Maximum number of simultaneous ngspice processes (default 4)

Returns: JSON list of per-run summaries, each with keys: run — 1-indexed run number data_file — path to the .npz file values — the component/parameter values used for this run traces — list of trace names in the .npz

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
netlist_pathYes
analysis_cmdYes
runsYes
parallelNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Describes internal use of SimRunner, concurrency, per-run .npz file creation, and default parallelism. Mentions output format (JSON list with run, data_file, values, traces). No annotations provided, so description fully carries the burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-organized: purpose sentence, implementation detail, usage recommendation, example, parameter descriptions, return description. Every sentence adds value; no redundancy.

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

Completeness5/5

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

Covers all inputs and output format despite having output schema. Explains output file naming and return structure. Even with good annotations, the description would be complete; without annotations, it is exemplary.

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

Parameters5/5

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

All four parameters are explained with descriptions, types, and examples. netlist_path as absolute path, analysis_cmd as full SPICE line, runs as list of dicts with key-value pairs, parallel with default. Compensates for 0% schema description coverage.

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?

Clearly states it runs multiple SPICE simulations in parallel sweeping component values. Distinguishes from siblings by explicitly advising use instead of calling run_ac_analysis/run_transient in a loop.

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 tells when to use this tool vs alternatives: 'Use this instead of calling run_ac_analysis / run_transient in a loop — it's significantly faster for multi-run sweeps.' Provides a concrete example.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lucasgerads/spicelib-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server