Skip to main content
Glama
eng-toolkit

eng-toolkit

by Lin830326

Dsp Filter Apply

dsp_filter_apply

Apply designed or specified IIR/FIR filters to JSON or CSV sample data, with zero-phase filtering, delay compensation, stability checks, and output statistics in a CSV artifact.

Instructions

Apply a filter to samples. Give the filter as sos (JSON rows [b0,b1,b2,a0,a1,a2]), or b (and a; empty a = FIR), or a design (family, response, order+cutoff or passband_edge/stopband_edge, as in dsp_filter_design). IIR runs as transposed direct form II; an unstable IIR filter is refused unless allow_unstable. zero_phase=true filters forward and backward (odd-reflection edge extension, steady-state start; the result has no phase delay and the squared magnitude response). FIR delay (N-1)/2 samples is reported, and removed with compensate_delay. Samples: JSON list or CSV file. Returns input/output statistics, the stability check, the delay, and the output as a CSV artifact.

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_filter_apply"
  }
}

Input Schema

NameRequiredDescriptionDefault
aNoDenominator coefficients as JSON list, a[0] not 0; empty = FIR
bNoNumerator coefficients as JSON list (at most 4095 for FIR, 41 with a)
sosNoSecond-order sections as JSON, e.g. '[[0.2,0.4,0.2,1,-0.3,0.1]]' (rows b0,b1,b2,a0,a1,a2; at most 40 rows)
orderNoDesign: IIR prototype order 1..40, or FIR taps 3..4095; 0 = from the specification
columnNoValue column of samples_file, by header name or number (1 = first); blank = the single value column
cutoffNoDesign with order: cutoff frequency with unit ('low, high' for bands)
familyNoDesign instead of sos/b: butterworth, chebyshev1, chebyshev2, fir_rectangular, fir_hann, fir_hamming, fir_blackman, fir_kaiser
samplesNoSamples as JSON text, e.g. '[0, 1, 0, -1]' (at most 4194304). Or use samples_file
responseNoDesign: lowpass, highpass, bandpass or bandstop
zero_phaseNoForward-backward filtering (default false)
kaiser_betaNoDesign fir_kaiser: beta; 0 = from the attenuation
sample_rateNoSample rate with unit, e.g. '8 kHz'; needed for a design, otherwise only for time stamps
samples_fileNoPath of a CSV/TXT file: one column of values, or time(s),value; numbers only, optional header line
passband_edgeNoDesign specification: passband edge(s) with unit
stopband_edgeNoDesign specification: stopband edge(s) with unit
allow_unstableNoRun an unstable or marginal IIR filter anyway (default false: refused); the output is refused if it overflows
compensate_delayNoFIR, causal: advance the output by (N-1)/2 samples when that is a whole number (default false)
passband_ripple_dbNoDesign: passband ripple Rp in dB
stopband_attenuation_dbNoDesign: stopband attenuation Rs in dB

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

A4.4/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: it discloses the IIR implementation form (transposed direct form II), the refusal of unstable or marginal filters unless allow_unstable is set, the overflow refusal, the odd-reflection edge extension and steady-state start of zero_phase, and the resulting squared magnitude response. It also states the FIR group delay (N-1)/2 and how compensate_delay removes it, plus what the response returns.

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?

The description is front-loaded with the core action and then walks through filter input modes, numerical behavior, sample inputs, and outputs in a logical order. It is dense to the point of being run-on in places, but nearly every clause carries technical information that is not in the annotations.

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?

For a 19-parameter, zero-required tool with an output schema and no annotations, the description covers the mutually exclusive input paths (coefficients vs design vs samples vs samples_file), the behavioral edge cases, and the reported outputs, which is sufficient for correct invocation. The output schema handles return-value detail, so the brief mention of statistics, stability check, delay, and CSV artifact is appropriately scoped.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: zero_phase is explained as forward-backward filtering with odd-reflection extension and steady-state start, and the FIR delay interaction with compensate_delay is spelled out. It also clarifies that an empty a means FIR and that design parameters mirror dsp_filter_design, going modestly beyond the schema text.

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?

The description opens with a specific verb+resource ("Apply a filter to samples") and immediately enumerates the three accepted filter representations (sos, b/a, design), referencing dsp_filter_design to clarify that a design spec is an input here rather than the purpose. An agent can tell this tool applies coefficients to data rather than producing a filter design.

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?

Usage guidance is embedded in conditional clauses -- allow_unstable for unstable IIR, zero_phase for forward-backward, compensate_delay for FIR delay -- so it does say when to use specific behaviors. However, there is no explicit statement of when to choose this tool over dsp_filter_design, dsp_spectrum, or dsp_correlate, nor any exclusion of cases where another tool is the better pick.

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