{
  "openapi": "3.1.1",
  "info": {
    "title": "Schematic Connectivity Review API",
    "version": "1.0.0",
    "summary": "Find common schematic connection issues",
    "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://ohmforgeconnectivityreview.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Find common schematic connection issues",
        "description": "Review an Ohmforge schematic for isolated pins, dangling wires, missing ground references, duplicate designators, and net-label conflicts.\n\nMethodology:\n- Validates a bounded native Ohmforge project and evaluates the same connectivity model used in the schematic workspace.\n- Reports isolated component pins, free wire endpoints, a missing ground reference, duplicate reference designators ignoring case, and merged net-label warnings.\n- Pins on wire segments, common vertices and wire endpoints on other segments connect; crossing segment interiors alone do not. Ground and matching net labels are global connections.\n- A wire on a pin suppresses the isolated-pin warning even if its other end is free; inspect dangling-wire findings as well.\n\nThis is a connectivity review, not a complete electrical rules check, physical safety assessment, or PCB design-rule check. A quiet report does not establish that a circuit is correct or safe.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "ohmforge_connectivity_review",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OhmforgeConnectivityReviewInput"
              },
              "examples": {
                "example1": {
                  "summary": "Review an unconnected resistor",
                  "value": {
                    "project": "{\n  \"format\": \"ohmforge\",\n  \"version\": 1,\n  \"name\": \"Unconnected resistor\",\n  \"parts\": [\n    {\n      \"id\": \"R1\",\n      \"kind\": \"resistor\",\n      \"x\": 0,\n      \"y\": 0\n    }\n  ],\n  \"wires\": []\n}"
                  }
                },
                "example2": {
                  "summary": "Review an empty schematic",
                  "value": {
                    "project": "{\"format\":\"ohmforge\",\"version\":1,\"name\":\"Empty circuit\",\"parts\":[],\"wires\":[]}"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OhmforgeConnectivityReviewResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "OhmforgeConnectivityReviewInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "project": {
            "title": "Ohmforge project JSON",
            "description": "Paste an exported .ohmforge.json project. This tool does not accept KiCad files.",
            "type": "string",
            "maxLength": 200000,
            "default": "{\n  \"format\": \"ohmforge\",\n  \"version\": 1,\n  \"name\": \"Unconnected resistor\",\n  \"parts\": [\n    {\n      \"id\": \"R1\",\n      \"kind\": \"resistor\",\n      \"x\": 0,\n      \"y\": 0\n    }\n  ],\n  \"wires\": []\n}"
          }
        },
        "required": []
      },
      "OhmforgeConnectivityReviewResult": {
        "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",
            "additionalProperties": false,
            "required": [
              "projectName",
              "partCount",
              "wireCount",
              "netCount",
              "hasGround",
              "groundedPins",
              "warningCount",
              "infoCount",
              "issues"
            ],
            "properties": {
              "projectName": {
                "type": "string"
              },
              "partCount": {
                "type": "integer"
              },
              "wireCount": {
                "type": "integer"
              },
              "netCount": {
                "type": "integer"
              },
              "hasGround": {
                "type": "boolean"
              },
              "groundedPins": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "warningCount": {
                "type": "integer"
              },
              "infoCount": {
                "type": "integer"
              },
              "issues": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "code",
                    "severity",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": [
                        "disconnected-pin",
                        "dangling-wire",
                        "missing-ground",
                        "duplicate-reference",
                        "net-label"
                      ]
                    },
                    "severity": {
                      "type": "string",
                      "enum": [
                        "warning",
                        "info"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "partId": {
                      "type": "string"
                    },
                    "pin": {
                      "type": "string"
                    },
                    "wireId": {
                      "type": "string"
                    },
                    "point": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      },
                      "minItems": 2,
                      "maxItems": 2
                    },
                    "net": {
                      "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"
              }
            }
          }
        }
      }
    }
  }
}