{
  "openapi": "3.1.1",
  "info": {
    "title": "Ohmforge Passive Filter Designer API",
    "version": "1.0.0",
    "summary": "RC, RL and RLC low/high/band-pass filters: cutoff, Q, bandwidth, Bode plot, E-series parts.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://ohmforgefilterdesigner.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "RC, RL and RLC low/high/band-pass filters: cutoff, Q, bandwidth, Bode plot, E-series parts.",
        "description": "Analyses or designs passive filters: first-order RC and RL low- and high-pass, the two-stage RC ladder and series RLC low-pass, high-pass, band-pass and notch. Gives the cutoff or centre frequency, Q, bandwidth and exact −3 dB points (also with a load), Bode magnitude and phase from the transfer function, suggested standard parts – and checks the curve against Ohmforge's AC simulator.\n\nMethodology:\n- Each filter is a ladder of series and shunt impedances (R, jωL, 1/(jωC)). The transfer function H(jω) = Vout / Vin is the product of the sections' ABCD matrices; with a load RL, H = 1 / (A + B / RL). Magnitude is 20·log10|H|, phase is unwrapped.\n- Formula values: fc = 1/(2πRC) or R/(2πL) for first order; f0 = 1/(2π√(LC)) and Q = √(L/C)/R for the series RLC filters (band-pass bandwidth f0/Q); f0 and Q of the two-stage RC ladder from its denominator 1 + s(R1C1 + R2C2 + R1C2) + s²R1C1R2C2.\n- The −3 dB points are solved by bisection on |H| relative to the passband gain (DC for low-pass and notch, high-frequency gain for high-pass, the peak for band-pass), so they stay correct with a load or a resonant peak.\n- Design keeps the part you choose and computes the rest (RC: R = 1/(2πfC); RL: L = R/(2πf); RLC: L = 1/((2πf0)²C), R = √(L/C)/Q; equal-value RC ladder: ωRC = 0.3742 for low-pass). Every computed part is tried at the series value below and above, and the combination closest to the target frequency (then Q) is suggested.\n- Cross-check: the equivalent SPICE netlist is solved with Ohmforge's AC analysis over ±2 decades and the largest magnitude difference is reported.\n\nIdeal components: no inductor winding resistance, no capacitor ESR, no source resistance. Real inductors limit the achievable Q, and component tolerances shift the corner (5 % parts move fc by about 5 %).",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "ohmforge_filter_designer",
        "x-owner-app": "ohmforge",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OhmforgeFilterDesignerInput"
              },
              "examples": {
                "example1": {
                  "summary": "RC low-pass 1 kΩ / 100 nF",
                  "value": {
                    "topology": "rc-lowpass",
                    "mode": "analyze",
                    "r": "1k",
                    "c": "100n"
                  }
                },
                "example2": {
                  "summary": "Design a 1 kHz RLC band-pass, Q = 5, C = 100 nF",
                  "value": {
                    "topology": "rlc-bandpass",
                    "mode": "design",
                    "frequency": 1000,
                    "q": 5,
                    "anchor": "100n",
                    "series": "E24"
                  }
                },
                "example3": {
                  "summary": "50 Hz notch (series RLC band-stop)",
                  "value": {
                    "topology": "rlc-bandstop",
                    "mode": "analyze",
                    "r": "100",
                    "l": "1",
                    "c": "10.13u"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OhmforgeFilterDesignerResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "OhmforgeFilterDesignerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "topology": {
            "title": "Filter",
            "type": "string",
            "enum": [
              "rc-lowpass",
              "rc-highpass",
              "rl-lowpass",
              "rl-highpass",
              "rc2-lowpass",
              "rc2-highpass",
              "rlc-lowpass",
              "rlc-highpass",
              "rlc-bandpass",
              "rlc-bandstop"
            ],
            "default": "rc-lowpass"
          },
          "mode": {
            "title": "Task",
            "type": "string",
            "enum": [
              "analyze",
              "design"
            ],
            "default": "analyze"
          },
          "r": {
            "title": "R / R1",
            "description": "Analyse: the resistor (first resistor of the RC ladder). Engineering notation: 1k, 4k7.",
            "type": "string",
            "maxLength": 32,
            "default": "1k"
          },
          "l": {
            "title": "L",
            "description": "Inductance for RL and RLC filters, e.g. 10m = 10 mH.",
            "type": "string",
            "maxLength": 32,
            "default": "10m"
          },
          "c": {
            "title": "C / C1",
            "description": "Capacitance, e.g. 100n = 100 nF.",
            "type": "string",
            "maxLength": 32,
            "default": "100n"
          },
          "r2": {
            "title": "R2 (RC ladder only)",
            "type": "string",
            "maxLength": 32,
            "default": "10k"
          },
          "c2": {
            "title": "C2 (RC ladder only)",
            "type": "string",
            "maxLength": 32,
            "default": "10n"
          },
          "frequency": {
            "title": "Target frequency (design)",
            "description": "Cutoff (−3 dB) for first-order filters and the RC ladder, centre/resonant frequency f0 for RLC.",
            "type": "number",
            "minimum": 0.001,
            "maximum": 10000000000,
            "default": 1000,
            "x-unit": "Hz"
          },
          "q": {
            "title": "Quality factor Q (design, RLC)",
            "description": "0.7071 gives the flattest (Butterworth) low/high-pass; higher Q = narrower band-pass/notch.",
            "type": "number",
            "minimum": 0.01,
            "maximum": 1000,
            "default": 0.7071
          },
          "anchor": {
            "title": "Part you choose (design)",
            "description": "Design keeps this value and computes the rest: the capacitor for RC, RC ladder and RLC filters, the resistor for RL filters.",
            "type": "string",
            "maxLength": 32,
            "default": "100n"
          },
          "rload": {
            "title": "Load resistance (optional)",
            "description": "Resistance across the output; changes the −3 dB points. Empty = unloaded.",
            "type": "string",
            "maxLength": 32
          },
          "series": {
            "title": "Standard resistor series",
            "description": "Resistors are rounded to this series; capacitors and inductors to E12.",
            "type": "string",
            "enum": [
              "E6",
              "E12",
              "E24",
              "E48",
              "E96",
              "E192"
            ],
            "default": "E24"
          }
        },
        "required": []
      },
      "OhmforgeFilterDesignerResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "topology",
              "response",
              "values",
              "characteristicFrequency",
              "frequencies",
              "magnitudeDb",
              "phaseDeg",
              "simulatorCheck"
            ],
            "additionalProperties": false,
            "properties": {
              "topology": {
                "type": "string"
              },
              "response": {
                "type": "string"
              },
              "order": {
                "type": "integer"
              },
              "mode": {
                "type": "string"
              },
              "values": {
                "type": "object",
                "additionalProperties": {
                  "type": "number"
                },
                "description": "Component values the response was computed for (Ω, H, F)."
              },
              "exactValues": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": {
                  "type": "number"
                }
              },
              "designErrorPercent": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "rload": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "characteristicFrequency": {
                "type": "number"
              },
              "q": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "lower3dB": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "upper3dB": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "bandwidth": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "peakGainDb": {
                "type": "number"
              },
              "peakFrequency": {
                "type": "number"
              },
              "frequencies": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              },
              "magnitudeDb": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              },
              "phaseDeg": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              },
              "simulatorCheck": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "maxDeviationDb": {
                    "type": "number"
                  },
                  "points": {
                    "type": "integer"
                  }
                }
              },
              "netlist": {
                "type": "string"
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}