{
  "openapi": "3.1.1",
  "info": {
    "title": "Drake Equation Explorer (Monte Carlo) API",
    "version": "1.0.0",
    "summary": "How many civilisations? The Drake equation with sourced ranges, Monte Carlo and sensitivity.",
    "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://prooflinedrake.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "How many civilisations? The Drake equation with sourced ranges, Monte Carlo and sensitivity.",
        "description": "Explore the Drake equation N = R* · fp · ne · fl · fi · fc · L with ranges instead of single guesses. The star formation rate, the fraction of stars with planets and the number of habitable-zone rocky planets default to published measurements; life, intelligence, detectability and lifetime are your assumptions. A seeded Monte Carlo gives the median N, the 90 % range, the share of draws with N \u003c 1 and which factor drives the uncertainty. Part of the Proofline math notebook.\n\nMethodology:\n- N = R* · fp · ne · fl · fi · fc · L (Drake, 1961). The lowest and highest possible N multiply the range ends; the central estimate multiplies the geometric middles (log-uniform) or the midpoints (uniform).\n- Monte Carlo: each factor is drawn independently from its range with a seeded mulberry32 generator; the median, the 5 % and 95 % quantiles and the share of draws with N \u003c 1 come from the sorted draws.\n- Sensitivity: log₁₀ N is the sum of the factors’ logarithms, so its variance is the sum of their variances; each factor’s share is exact (log-uniform: (log₁₀ high − log₁₀ low)²/12).\n- Default ranges: R* 0.68–1.65 Sun-like stars per year (Milky Way star formation of 0.68–1.45 and 1.65 ± 0.19 solar masses per year, read as one Sun-like star per solar mass), fp 0.5–1 (microlensing finds about one or more planets per star), ne 0.37–0.88 (Kepler DR25 η⊕ for Sun-like stars); fl, fi, fc and L are wide assumptions because nothing has measured them.\n\nThe Drake equation organises ignorance; it does not measure anything. With unmeasured factors spanning many orders of magnitude, every result mostly mirrors the assumptions.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "proofline_drake",
        "x-owner-app": "proofline",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProoflineDrakeInput"
              },
              "examples": {
                "example1": {
                  "summary": "Measured astronomy plus wide assumptions (defaults)",
                  "value": {}
                },
                "example2": {
                  "summary": "Drake’s own suggestion: one new civilisation a year, lasting 10,000 years",
                  "value": {
                    "rStar": "1",
                    "fp": "1",
                    "ne": "1",
                    "fl": "1",
                    "fi": "1",
                    "fc": "1",
                    "L": "10000"
                  }
                },
                "example3": {
                  "summary": "Pessimistic biology: life and intelligence are rare",
                  "value": {
                    "fl": "1e-10 - 1e-3",
                    "fi": "1e-6 - 0.01"
                  }
                },
                "example4": {
                  "summary": "Uniform instead of log-uniform sampling",
                  "value": {
                    "distribution": "uniform"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProoflineDrakeResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "ProoflineDrakeInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "rStar": {
            "title": "R*: Sun-like stars formed per year in the Milky Way",
            "description": "A value or a range “low - high” (per year). Default from Robitaille \u0026 Whitney 2010; Licquia \u0026 Newman 2015.",
            "type": "string",
            "maxLength": 60,
            "default": "0.68 - 1.65"
          },
          "fp": {
            "title": "fp: Fraction of those stars with planets",
            "description": "A value or a range “low - high”. Default from Cassan et al. 2012 (microlensing).",
            "type": "string",
            "maxLength": 60,
            "default": "0.5 - 1"
          },
          "ne": {
            "title": "ne: Habitable-zone rocky planets per planetary system",
            "description": "A value or a range “low - high”. Default from Bryson et al. 2021 (Kepler DR25).",
            "type": "string",
            "maxLength": 60,
            "default": "0.37 - 0.88"
          },
          "fl": {
            "title": "fl: Fraction of those planets where life appears",
            "description": "A value or a range “low - high”. Default from assumption (no measurement exists).",
            "type": "string",
            "maxLength": 60,
            "default": "0.001 - 1"
          },
          "fi": {
            "title": "fi: Fraction of life-bearing planets that develop intelligence",
            "description": "A value or a range “low - high”. Default from assumption (no measurement exists).",
            "type": "string",
            "maxLength": 60,
            "default": "0.001 - 1"
          },
          "fc": {
            "title": "fc: Fraction of intelligent species that become detectable",
            "description": "A value or a range “low - high”. Default from assumption (no measurement exists).",
            "type": "string",
            "maxLength": 60,
            "default": "0.01 - 1"
          },
          "L": {
            "title": "L: Years a civilisation stays detectable",
            "description": "A value or a range “low - high” (years). Default from assumption (no measurement exists).",
            "type": "string",
            "maxLength": 60,
            "default": "100 - 100000000"
          },
          "distribution": {
            "title": "Sampling of the ranges",
            "type": "string",
            "enum": [
              "loguniform",
              "uniform"
            ],
            "default": "loguniform"
          },
          "samples": {
            "title": "Monte Carlo draws",
            "type": "integer",
            "minimum": 1000,
            "maximum": 1000000,
            "default": 100000
          },
          "seed": {
            "title": "Random seed",
            "type": "integer",
            "default": 1
          }
        },
        "required": []
      },
      "ProoflineDrakeResult": {
        "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": [
              "factors",
              "distribution",
              "samples",
              "seed",
              "low",
              "high",
              "central",
              "median",
              "p5",
              "p95",
              "mean",
              "shareBelowOne",
              "sensitivity",
              "histogram"
            ],
            "properties": {
              "factors": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "factor",
                    "symbol",
                    "low",
                    "high",
                    "central",
                    "source",
                    "measured"
                  ],
                  "properties": {
                    "factor": {
                      "type": "string"
                    },
                    "symbol": {
                      "type": "string"
                    },
                    "low": {
                      "type": "number"
                    },
                    "high": {
                      "type": "number"
                    },
                    "central": {
                      "type": "number"
                    },
                    "source": {
                      "type": "string"
                    },
                    "measured": {
                      "type": "boolean"
                    }
                  }
                }
              },
              "distribution": {
                "type": "string",
                "enum": [
                  "loguniform",
                  "uniform"
                ]
              },
              "samples": {
                "type": "integer"
              },
              "seed": {
                "type": "integer"
              },
              "low": {
                "type": "number"
              },
              "high": {
                "type": "number"
              },
              "central": {
                "type": "number"
              },
              "median": {
                "type": "number"
              },
              "p5": {
                "type": "number"
              },
              "p95": {
                "type": "number"
              },
              "mean": {
                "type": "number"
              },
              "shareBelowOne": {
                "type": "number"
              },
              "sensitivity": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "factor",
                    "share"
                  ],
                  "properties": {
                    "factor": {
                      "type": "string"
                    },
                    "share": {
                      "type": "number"
                    }
                  }
                }
              },
              "histogram": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "log10From",
                    "log10To",
                    "count"
                  ],
                  "properties": {
                    "log10From": {
                      "type": "number"
                    },
                    "log10To": {
                      "type": "number"
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}