{
  "openapi": "3.1.1",
  "info": {
    "title": "Ohmforge Microstrip & Stripline Impedance Calculator API",
    "version": "1.0.0",
    "summary": "PCB trace impedance Z0, εeff and delay (Hammerstad–Jensen, Wheeler), or the width for 50 Ω.",
    "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://ohmforgemicrostripimpedance.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "PCB trace impedance Z0, εeff and delay (Hammerstad–Jensen, Wheeler), or the width for 50 Ω.",
        "description": "Characteristic impedance of a PCB trace: surface microstrip with the Hammerstad–Jensen equations (thickness correction included) or a centred stripline with Wheeler's formula, plus effective permittivity, propagation delay and guided wavelength. Synthesis mode solves the trace width for a target impedance such as 50 Ω with Brent's root finder; every result is cross-checked against an independent formula and the IPC-2141 rule of thumb.\n\nMethodology:\n- Microstrip: Hammerstad–Jensen (1980) closed-form equations — Z0 of the air line Z01(u) with u = W/h, effective permittivity εe(u, εr) with their a(u) and b(εr) fits (accuracy better than 0.2 % for 0.01 ≤ u ≤ 100), and the strip-thickness correction Δu (Wheeler's) applied separately to the air line and the dielectric. Z0 = Z01(ur)/√εe(ur).\n- Stripline (strip centred between two planes, spacing b): Wheeler's 1978 formula with the thickness correction (about 0.5 % accuracy for W/(b − t) < 10); for t = 0 it is compared with Cohn's exact conformal-mapping result η0/(4√εr)·K(k)/K(k′), k = sech(πW/2b), evaluated with the arithmetic–geometric mean.\n- Synthesis solves Z0(W) = target with Brent's method (Proofline numerical engine) over W/h from 0.01 to 100 (stripline: up to 20) on a logarithmic width axis.\n- Delay = √εeff / c, guided wavelength = c / (f·√εeff). The IPC-2141 rule-of-thumb formulas are shown for comparison only; they are less accurate, especially outside their range.\n\nQuasi-static, lossless model: no dispersion (microstrip Z0 and εeff rise at high frequency), no solder mask, no roughness, no etch trapezoid and no nearby copper pour. Ask your PCB maker for their stack-up and impedance-controlled width; manufacturing tolerances are typically ±10 %.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "ohmforge_microstrip_impedance",
        "x-owner-app": "ohmforge",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OhmforgeMicrostripImpedanceInput"
              },
              "examples": {
                "example1": {
                  "summary": "FR-4: 0.3 mm trace on 0.17 mm prepreg",
                  "value": {
                    "structure": "microstrip",
                    "task": "analyze",
                    "widthMm": 0.3,
                    "heightMm": 0.17,
                    "thicknessUm": 35,
                    "er": 4.3,
                    "frequencyMHz": 1000
                  }
                },
                "example2": {
                  "summary": "Width for 50 Ω on PTFE (εr 2.2, h 1.27 mm) — Pozar example 3.7",
                  "value": {
                    "structure": "microstrip",
                    "task": "synthesize",
                    "heightMm": 1.27,
                    "thicknessUm": 0,
                    "er": 2.2,
                    "targetZ0": 50,
                    "frequencyMHz": 10000
                  }
                },
                "example3": {
                  "summary": "50 Ω stripline, planes 3.2 mm apart (εr 2.2) — Pozar example 3.5",
                  "value": {
                    "structure": "stripline",
                    "task": "synthesize",
                    "heightMm": 3.2,
                    "thicknessUm": 0,
                    "er": 2.2,
                    "targetZ0": 50
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OhmforgeMicrostripImpedanceResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "OhmforgeMicrostripImpedanceInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "structure": {
            "title": "Line",
            "type": "string",
            "enum": [
              "microstrip",
              "stripline"
            ],
            "default": "microstrip"
          },
          "task": {
            "title": "Task",
            "type": "string",
            "enum": [
              "analyze",
              "synthesize"
            ],
            "default": "analyze"
          },
          "widthMm": {
            "title": "Trace width W",
            "description": "Analysis only.",
            "type": "number",
            "minimum": 0.0001,
            "maximum": 10000,
            "default": 0.3,
            "x-unit": "mm"
          },
          "heightMm": {
            "title": "Dielectric height h (microstrip) or plane spacing b (stripline)",
            "description": "Microstrip: from the trace to its reference plane. Stripline: total distance between the two planes.",
            "type": "number",
            "minimum": 0.0001,
            "maximum": 1000,
            "default": 0.17,
            "x-unit": "mm"
          },
          "thicknessUm": {
            "title": "Copper thickness t",
            "description": "35 µm = 1 oz/ft², 18 µm = ½ oz; 0 = ideal thin strip.",
            "type": "number",
            "minimum": 0,
            "maximum": 10000,
            "default": 35,
            "x-unit": "µm"
          },
          "er": {
            "title": "Relative permittivity εr",
            "description": "FR-4 about 4.2–4.6 (falls with frequency), Rogers RO4350B 3.66, PTFE 2.2. Use the laminate maker's value at your frequency.",
            "type": "number",
            "minimum": 1,
            "maximum": 128,
            "default": 4.3
          },
          "targetZ0": {
            "title": "Target impedance",
            "description": "Synthesis only.",
            "type": "number",
            "minimum": 1,
            "maximum": 1000,
            "default": 50,
            "x-unit": "Ω"
          },
          "frequencyMHz": {
            "title": "Frequency (optional)",
            "description": "For the guided wavelength; 0 = skip.",
            "type": "number",
            "minimum": 0,
            "maximum": 1000000,
            "default": 0,
            "x-unit": "MHz"
          }
        },
        "required": []
      },
      "OhmforgeMicrostripImpedanceResult": {
        "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": [
              "structure",
              "task",
              "widthMm",
              "z0",
              "epsEff"
            ],
            "additionalProperties": false,
            "properties": {
              "structure": {
                "type": "string"
              },
              "task": {
                "type": "string"
              },
              "widthMm": {
                "type": "number"
              },
              "heightMm": {
                "type": "number"
              },
              "thicknessUm": {
                "type": "number"
              },
              "er": {
                "type": "number"
              },
              "widthOverHeight": {
                "type": "number"
              },
              "z0": {
                "type": "number",
                "description": "Characteristic impedance (Ω)."
              },
              "epsEff": {
                "type": "number"
              },
              "delayPsPerMm": {
                "type": "number"
              },
              "velocityFraction": {
                "type": "number",
                "description": "Phase velocity as a fraction of c."
              },
              "guidedWavelengthMm": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "frequencyHz": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "zeroThicknessZ0": {
                "type": "number",
                "description": "The same formula with t = 0 (Ω)."
              },
              "check": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "formula": {
                    "type": "string"
                  },
                  "z0": {
                    "type": "number"
                  },
                  "differencePercent": {
                    "type": "number",
                    "description": "Independent formula vs. zeroThicknessZ0 (%)."
                  }
                }
              },
              "ipc2141": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "z0": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "inRange": {
                    "type": "boolean"
                  }
                }
              },
              "iterations": {
                "type": "integer"
              },
              "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"
              }
            }
          }
        }
      }
    }
  }
}