Skip to main content
Glama
ossenna-hq

ltspice-mcp

by ossenna-hq

stability_metrics

Read-onlyIdempotent

Find every unity-gain and -180° phase crossover in a loop-gain AC sweep, reporting phase/gain margins at each crossing to correctly classify stability, including conditional systems.

Instructions

Find EVERY unity-gain and -180° phase crossover in a loop-gain AC sweep, report phase margin at each unity-gain crossing and gain margin at each -180° crossing. Replaces the single-crossing approximation in simulation_summary, which returns wrong margins on conditionally-stable systems.

Run this on a LOOP-GAIN signal (typically a dedicated middlebrook probe or .AC of the open loop). Running on a closed-loop output gives meaningless margins — if the DC phase starts near ±180° (a closed-loop / inverting output rather than a loop probe, which starts near 0°), a warning says so in warnings.

Returns: dc_gain_db, high_freq_gain_db, stability classification (stable / unstable / conditional / unconditional / always_below_unity), all crossings, per-crossing margins, and the worst-case values.

Nuances:

  • Phase is UNWRAPPED first, so systems whose phase drops past -360° are handled correctly (otherwise the raw wrap hides the crossing).

  • If phase NEVER crosses -180°, gain margin is 'infinite' (returned as null with stability='unconditional'). That's stable, not an error.

  • If gain NEVER reaches unity, phase margin is undefined (returned as null with stability='always_below_unity').

  • Multiple crossovers trigger stability='conditional' and a warning — each one needs its own review.

For -3 dB filter cutoffs use bode_metrics(mode='filter'); for custom crossings use bode_metrics(mode='crossing').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stepNoStep index for .step sweeps
formatNo
job_idNoAnalyze a completed job run by id instead of a raw_file path; pair with ``run_index``. Lets you read a sweep / Monte-Carlo run's margins.
signalYesLoop-gain signal (e.g. 'V(loop)')
raw_fileNoPath to loop-gain AC analysis .raw file. Pass this OR ``job_id`` (a job run), not both.
run_indexNo0-based run to analyze when ``job_id`` is given (default 0).
min_separation_decadesNoMerge near-duplicate crossovers closer than this many decades.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
signalYes
warningsYes
stabilityYes
dc_gain_dbYes
gain_marginsYes
phase_marginsYes
high_freq_gain_dbYes
gain_margin_worst_dbNo
phase_180_crossoversYes
unity_gain_crossoversYes
phase_margin_worst_degNo
Behavior5/5

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

Annotations already declare readOnly/idempotent/destructive hints, and the description goes further: explains phase unwrapping, null margin handling (infinite/undefined), conditional stability warnings, and multi-crossing behavior. No contradictions with annotations.

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?

Well-structured with clear sections: purpose, usage, returns, nuances. Front-loaded with core function, then edge cases. A bit long but every sentence adds value; could be slightly trimmed but remains efficient for a complex tool.

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?

Given the tool's complexity and existing output schema, the description covers all key aspects: return values, edge cases (never-crossing phase/gain), multi-crossing behavior, and disambiguation from siblings. Comprehensive without needing the output schema details.

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

Parameters3/5

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

Schema coverage is high (86%) and parameters like signal, raw_file, job_id, run_index, min_separation_decades already have clear descriptions. The tool description adds minimal new parameter semantics, mostly contextual (e.g., loop-gain requirement) but does not exceed baseline for well-documented schema.

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?

Description explicitly states it finds all unity-gain and -180° phase crossings, reports phase/gain margins, and replaces a flawed approximation in simulation_summary. It clearly distinguishes from bode_metrics and simulation_summary, making the purpose unambiguous.

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?

Provides explicit when-to-use instructions: run on LOOP-GAIN signals, warns against closed-loop outputs, and names alternatives for other cases (bode_metrics for filter cutoffs and custom crossings). Includes warning detection and clear exclusions.

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/ossenna-hq/MCP_LTSpice'

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