Skip to main content
Glama
eng-toolkit

eng-toolkit

by Lin830326

Dsp Spectrum

dsp_spectrum

Compute one-sided FFT amplitude spectra and power spectral density with windowing, Welch averaging, peak detection, and ADC metrics (SNR, SINAD, THD, SFDR, ENOB) from samples or CSV files.

Instructions

One-sided spectrum of a sampled record: amplitude spectrum (an on-bin sine of amplitude A reads A, coherent-gain corrected) and power spectral density (unit^2/Hz), by FFT with a rectangular, hann, hamming, blackman or flattop window, optional Welch averaging (segment_length, overlap_percent), a peak list with parabolic interpolation of frequency and amplitude, and with adc_metrics the single-tone SNR, SINAD, THD (harmonics 2..N), SFDR and ENOB with their definitions. Samples: JSON list in 'samples' or a CSV file (value, or time,value, with an optional header line; 'column' picks one column of a wider file, e.g. the output of dsp_filter_apply) in 'samples_file'; 'unit' (e.g. 'g') is carried to the results; sample_rate with unit unless the file has a time column. Returns bin width, ENBW, leakage/resolution warnings and the spectrum table as CSV (rows bounded, max-hold decimated).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "dsp_spectrum"
  }
}

Input Schema

NameRequiredDescriptionDefault
unitNoUnit of the samples, e.g. 'g' (standard gravity), 'm/s^2', 'V'; carried to the amplitude, rms and power values; blank = dimensionless
peaksNoMaximum number of peaks to list, 0..100 (default 5)
columnNoValue column of samples_file, by header name or number (1 = first), e.g. 'output' of dsp_filter_apply; blank = the single value column
windowNorectangular, hann, hamming, blackman or flattop (default hann)hann
samplesNoSamples as JSON text, e.g. '[0.1, 0.5, -0.2]' (at most 4194304 values). Or use samples_file
harmonicsNoHighest harmonic number counted in THD (2..50, default 5)
table_rowsNoMaximum rows of the spectrum table, 16..20000 (default 2048)
adc_metricsNoCompute SNR, SINAD, THD, SFDR, ENOB assuming a single tone (default false)
remove_meanNoSubtract each segment's mean before windowing (default false)
sample_rateNoSample rate with unit, e.g. '48 kHz'; optional when the file has a time column
samples_fileNoPath of a CSV/TXT file: one column of values, or two columns time(s),value; numbers only, optional header line
segment_lengthNoWelch segment length in samples (8..N); 0 = one FFT of the whole record
overlap_percentNoWelch overlap in percent, 0 to below 100 (default 50); used with segment_length
peak_threshold_dbNoOnly peaks within this many dB below the highest one (default 60)
full_scale_amplitudeNoConverter full-scale peak amplitude in the unit of the samples, for ENOB at less than full scale; 0 = tone assumed at full scale

Output Schema

NameRequiredDescriptionDefault
okYes
dataNoNon-quantity payload (reports, listings)
errorNo
valueNoPrimary quantity result
valuesNoAll named quantity results (includes the primary)
warningsNo
artifactsNo
provenanceYesWhat produced the result and from which inputs.
review_statusNounreviewed

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.1

TDQS

A3.8/5.0
Behavior4/5

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

No annotations exist, so the description carries the full burden and mostly discharges it: it discloses normalization conventions (coherent-gain correction, amplitude-vs-PSD units), ENBW and leakage/resolution warnings, output bounding via table_rows with max-hold decimation, and the maximum sample count. It stops short of describing failure modes (non-numeric file contents, missing sample_rate) or cost characteristics.

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

Conciseness3/5

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

The content is dense but the structure is poor: the first sentence is an unpunctuated run-on stringing together windows, Welch, peaks, and ADC metrics, which makes scanning difficult. The trailing 'Returns …' sentence is well-placed, but the middle input-modality block would read far better as discrete points.

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

Completeness4/5

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

For a 15-parameter, annotation-free numerical tool with an output schema already covering return values, the description supplies the needed context: what is computed, how samples enter, how units propagate, and what warnings accompany results. The remaining gap is error/edge behavior, which matters given the file-reading surface.

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 description coverage is 100% with 15 well-documented parameters, so the schema already does the heavy lifting and the baseline is 3. The description adds a few cross-parameter relationships (sample_rate unneeded when the file has a time column, segment_length/overlap pairing, column targeting dsp_filter_apply output, unit propagation) but repeats much of what the schema states.

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?

States a concrete verb and resource — 'one-sided spectrum of a sampled record' — and enumerates the exact computations delivered (amplitude spectrum with coherent-gain correction, PSD in unit^2/Hz, windowed FFT, optional Welch averaging, peak list with parabolic interpolation, ADC metrics). An agent can tell this is the spectral-analysis tool rather than a filter, correlation, or window-design tool from the DSP siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Guidance is about input modality (JSON 'samples' vs CSV 'samples_file', with 'column' for wider files such as dsp_filter_apply output), which is useful selection logic for inputs. There is no explicit when-to-use/when-not guidance against sibling tools, and no statement of preconditions (e.g., minimum record length, evenly sampled data needed) beyond the file format note.

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

Deploy Server

Other Tools