{
  "openapi": "3.1.1",
  "info": {
    "title": "Pinball Flipper Shot Map API",
    "version": "1.0.0",
    "summary": "Where does a pinball flipper shot go? Paths and first switches for spots along a Pinquest flipper.",
    "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://pinquestshotmap.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Where does a pinball flipper shot go? Paths and first switches for spots along a Pinquest flipper.",
        "description": "Places a resting ball at evenly spaced spots along a flipper of a Pinquest table (built-in or your own JSON), fires the flipper with the game physics and shows where each shot goes: launch speed and angle, the path over 2.5 seconds and the first switches it hits. Table designers use it to check that ramps, orbits and targets are makeable.\n\nMethodology:\n- Spot 0 is the flipper pivot, 1 its tip; the ball starts at rest on the resting flipper at spots from 0.15 to 0.95. The flipper fires for 0.25 s and is then released.\n- Launch speed and angle are measured 1/8 s after the flip (angle: 0° = right, 270° = straight up the table). The path is sampled every 1/20 s for 2.5 s or until a saucer catches the ball.\n- Same physics as the game: fixed 1/240 s steps, swept-circle collisions, the flipper’s surface speed transferred to the ball.\n\nA design aid for Pinquest tables; real flippers and balls behave differently.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "pinquest_shot_map",
        "x-owner-app": "pinquest",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PinquestShotMapInput"
              },
              "examples": {
                "example1": {
                  "summary": "Left flipper of the castle table",
                  "value": {
                    "table": "witch-castle",
                    "tableJson": "",
                    "flipper": "",
                    "spots": 8
                  }
                },
                "example2": {
                  "summary": "Right flipper on Zombie Night",
                  "value": {
                    "table": "zombie-night",
                    "tableJson": "",
                    "flipper": "flipper-right",
                    "spots": 6
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PinquestShotMapResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "PinquestShotMapInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "table": {
            "title": "Table",
            "type": "string",
            "enum": [
              "witch-castle",
              "zombie-night",
              "pirate-treasure",
              "space-station",
              "dragon-lair",
              "haunted-circus",
              "deep-sea",
              "jungle-temple",
              "steampunk-airship",
              "ninja-dojo",
              "wild-west-heist",
              "alien-invasion",
              "dinosaur-island",
              "candy-kingdom",
              "robot-factory",
              "viking-saga",
              "egyptian-tomb",
              "cyber-city",
              "fairy-forest",
              "volcano-forge",
              "arctic-expedition",
              "monster-carnival",
              "superhero-city",
              "detective-noir",
              "mad-science-lab",
              "samurai-storm",
              "moon-base",
              "wizard-school",
              "kaiju-attack",
              "atlantis",
              "sky-islands",
              "ghost-train"
            ],
            "default": "witch-castle"
          },
          "tableJson": {
            "title": "Your own table (Pinquest table JSON, optional — replaces the table above)",
            "description": "The format is described in the Pinquest table spec: elements (walls, flippers, bumpers, ramps …) in table units (20 × 40), lights and rules with missions.",
            "type": "string",
            "maxLength": 200000,
            "default": ""
          },
          "flipper": {
            "title": "Flipper id (empty = the main left flipper)",
            "type": "string",
            "maxLength": 48,
            "default": ""
          },
          "spots": {
            "title": "Spots along the flipper",
            "type": "integer",
            "minimum": 2,
            "maximum": 12,
            "default": 8
          }
        },
        "required": []
      },
      "PinquestShotMapResult": {
        "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": [
              "table",
              "flipper",
              "shots"
            ],
            "properties": {
              "table": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "id",
                  "title"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                }
              },
              "flipper": {
                "type": "string"
              },
              "shots": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "spot",
                    "speed",
                    "angle",
                    "firstSwitches",
                    "path"
                  ],
                  "properties": {
                    "spot": {
                      "type": "number"
                    },
                    "speed": {
                      "type": "number"
                    },
                    "angle": {
                      "type": "number"
                    },
                    "firstSwitches": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "path": {
                      "type": "array",
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "number"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}