{
  "openapi": "3.1.1",
  "info": {
    "title": "Schematic Output Conflict Review API",
    "version": "1.0.0",
    "summary": "Find classified outputs sharing a schematic net",
    "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://ohmforgeoutputconflictreview.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Find classified outputs sharing a schematic net",
        "description": "Review a native Ohmforge schematic for pairs of catalogued push-pull outputs connected to the same net and show unclassified pin coverage.\n\nMethodology:\n- Uses the same bounded native-project validation, pin positions and net connectivity as the Ohmforge workspace.\n- Classifies pins on the built-in AND, OR, NAND, NOR, XOR, NOT and comparator simulation symbols; other component pins are counted as unknown.\n- Reports unordered pairs of classified push-pull outputs on the same resolved net, up to 100 pairs. Ground and net labels connect nets but are not treated as drivers.\n- The count includes all pairs on a net, even if the displayed list is truncated. Pin roles describe the built-in simulation symbols and may not match a physical component.\n\nThis limited check does not establish circuit correctness or safety. It does not check power, voltage compatibility, ratings, undriven inputs, or physical design rules.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "ohmforge_output_conflict_review",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OhmforgeOutputConflictReviewInput"
              },
              "examples": {
                "example1": {
                  "summary": "Review two connected outputs",
                  "value": {
                    "project": "{\n  \"format\": \"ohmforge\",\n  \"version\": 1,\n  \"name\": \"Output conflict\",\n  \"parts\": [\n    {\n      \"id\": \"U1\",\n      \"kind\": \"not\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    {\n      \"id\": \"U2\",\n      \"kind\": \"not\",\n      \"x\": 10,\n      \"y\": 4\n    }\n  ],\n  \"wires\": [\n    {\n      \"id\": \"W1\",\n      \"pts\": [\n        [\n          3,\n          0\n        ],\n        [\n          13,\n          0\n        ],\n        [\n          13,\n          4\n        ]\n      ]\n    }\n  ]\n}"
                  }
                },
                "example2": {
                  "summary": "Review a gate and a comparator joined by a net label",
                  "value": {
                    "project": "{\n  \"format\": \"ohmforge\",\n  \"version\": 1,\n  \"name\": \"Gate and comparator on one label\",\n  \"parts\": [\n    {\n      \"id\": \"U1\",\n      \"kind\": \"nand\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    {\n      \"id\": \"U2\",\n      \"kind\": \"comparator\",\n      \"x\": 0,\n      \"y\": 12\n    },\n    {\n      \"id\": \"R1\",\n      \"kind\": \"resistor\",\n      \"x\": 12,\n      \"y\": 0\n    },\n    {\n      \"id\": \"L1\",\n      \"kind\": \"netlabel\",\n      \"x\": 3,\n      \"y\": 0,\n      \"props\": {\n        \"name\": \"SIG\"\n      }\n    },\n    {\n      \"id\": \"L2\",\n      \"kind\": \"netlabel\",\n      \"x\": 3,\n      \"y\": 12,\n      \"props\": {\n        \"name\": \"SIG\"\n      }\n    }\n  ],\n  \"wires\": [\n    {\n      \"id\": \"W1\",\n      \"pts\": [\n        [\n          3,\n          0\n        ],\n        [\n          10,\n          0\n        ]\n      ]\n    }\n  ]\n}"
                  }
                },
                "example3": {
                  "summary": "Review an empty schematic",
                  "value": {
                    "project": "{\"format\":\"ohmforge\",\"version\":1,\"name\":\"Empty\",\"parts\":[],\"wires\":[]}"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OhmforgeOutputConflictReviewResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "OhmforgeOutputConflictReviewInput": {
        "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\": \"Output conflict\",\n  \"parts\": [\n    {\n      \"id\": \"U1\",\n      \"kind\": \"not\",\n      \"x\": 0,\n      \"y\": 0\n    },\n    {\n      \"id\": \"U2\",\n      \"kind\": \"not\",\n      \"x\": 10,\n      \"y\": 4\n    }\n  ],\n  \"wires\": [\n    {\n      \"id\": \"W1\",\n      \"pts\": [\n        [\n          3,\n          0\n        ],\n        [\n          13,\n          0\n        ],\n        [\n          13,\n          4\n        ]\n      ]\n    }\n  ]\n}"
          }
        },
        "required": []
      },
      "OhmforgeOutputConflictReviewResult": {
        "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",
              "version",
              "classifiedPins",
              "unknownPins",
              "outputPins",
              "conflicts",
              "totalConflicts",
              "omittedConflicts"
            ],
            "properties": {
              "projectName": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              },
              "classifiedPins": {
                "type": "integer",
                "minimum": 0
              },
              "unknownPins": {
                "type": "integer",
                "minimum": 0
              },
              "outputPins": {
                "type": "integer",
                "minimum": 0
              },
              "totalConflicts": {
                "type": "integer",
                "minimum": 0
              },
              "omittedConflicts": {
                "type": "integer",
                "minimum": 0
              },
              "conflicts": {
                "type": "array",
                "maxItems": 100,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "first",
                    "second",
                    "net"
                  ],
                  "properties": {
                    "first": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "partId",
                        "pin",
                        "point"
                      ],
                      "properties": {
                        "partId": {
                          "type": "string"
                        },
                        "pin": {
                          "type": "string"
                        },
                        "point": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          },
                          "minItems": 2,
                          "maxItems": 2
                        }
                      }
                    },
                    "second": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "partId",
                        "pin",
                        "point"
                      ],
                      "properties": {
                        "partId": {
                          "type": "string"
                        },
                        "pin": {
                          "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"
              }
            }
          }
        }
      }
    }
  }
}