{
  "openapi": "3.1.1",
  "info": {
    "title": "Doppelkopf Score Calculator API",
    "version": "1.0.0",
    "summary": "Doppelkopf game points from card points, announcements and special points (DDV rules).",
    "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://playcardsdoppelkopfscore.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Doppelkopf game points from card points, announcements and special points (DDV rules).",
        "description": "Scores one game of Doppelkopf by the tournament rules of the Deutscher Doppelkopf-Verband: who won (121 for Re, 120 for Kontra, shifted by announcements and Absagen), the plus-minus points for winning, against the Queens of Clubs, under 90/60/30, Schwarz, Re/Kontra (+2 each), every Absage, reaching 120/90/60/30 against an Absage, and the special points Fox caught, Karlchen and Doppelkopf in normal games. A soloist scores three times. The Playcards app scores every game with the same function.\n\nMethodology:\n- Winner (DDV 7.1): Re needs 121 card points, Kontra 120; if only Kontra was announced, Re wins with 120 and Kontra needs 121. A party that said keine 90/60/30 needs 151/181/211, after Schwarz every trick; the other party then wins with 90/60/30 or one trick. If both parties fail their Absagen, nobody wins.\n- Points (DDV 7.2): won 1, against the Queens of Clubs 1 (Kontra wins a normal game), under 90/60/30 and Schwarz 1 each, Re and Kontra announced 2 each, every Absage 1, reaching 120/90/60/30 against an Absage 1 each (also without a winner). Special points (normal games only): every fox caught, Karlchen and every Doppelkopf 1 for the party that made it; they are set off against each other.\n- Plus-minus scoring: each Re player gets the value, each Kontra player its negative; a soloist gets three times the value.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "playcards_doppelkopf_score",
        "x-owner-app": "playcards",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlaycardsDoppelkopfScoreInput"
              },
              "examples": {
                "example1": {
                  "summary": "Re wins with 150, Re announced, one fox caught",
                  "value": {
                    "reAugen": 150,
                    "reTricks": 8,
                    "kontraTricks": 4,
                    "reAnnounce": "1",
                    "reFox": 1
                  }
                },
                "example2": {
                  "summary": "Kontra wins against the Queens with 125",
                  "value": {
                    "reAugen": 115,
                    "reTricks": 5,
                    "kontraTricks": 7,
                    "kontraAnnounce": "1",
                    "kontraDoppelkopf": 1
                  }
                },
                "example3": {
                  "summary": "Re said keine 90 but got only 140",
                  "value": {
                    "reAugen": 140,
                    "reTricks": 7,
                    "kontraTricks": 5,
                    "reAnnounce": "2"
                  }
                },
                "example4": {
                  "summary": "Queens solo won keine 60",
                  "value": {
                    "solo": true,
                    "reAugen": 185,
                    "reTricks": 10,
                    "kontraTricks": 2,
                    "reAnnounce": "1"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaycardsDoppelkopfScoreResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "PlaycardsDoppelkopfScoreInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "solo": {
            "title": "Solo (Re is one player)",
            "type": "boolean",
            "default": false
          },
          "reAugen": {
            "title": "Card points of the Re party",
            "description": "Kontra has 240 minus this.",
            "type": "integer",
            "minimum": 0,
            "maximum": 240,
            "default": 121
          },
          "reTricks": {
            "title": "Tricks won by Re",
            "type": "integer",
            "minimum": 0,
            "maximum": 12,
            "default": 6
          },
          "kontraTricks": {
            "title": "Tricks won by Kontra",
            "type": "integer",
            "minimum": 0,
            "maximum": 12,
            "default": 6
          },
          "reAnnounce": {
            "title": "Highest announcement of Re",
            "type": "string",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4",
              "5"
            ],
            "default": "0"
          },
          "kontraAnnounce": {
            "title": "Highest announcement of Kontra",
            "type": "string",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4",
              "5"
            ],
            "default": "0"
          },
          "reFox": {
            "title": "Foxes caught by Re",
            "type": "integer",
            "minimum": 0,
            "maximum": 2,
            "default": 0
          },
          "reKarlchen": {
            "title": "Karlchen for Re (last trick won with the Jack of Clubs)",
            "type": "integer",
            "minimum": 0,
            "maximum": 1,
            "default": 0
          },
          "reDoppelkopf": {
            "title": "Doppelköpfe won by Re (tricks with 40+ points)",
            "type": "integer",
            "minimum": 0,
            "maximum": 6,
            "default": 0
          },
          "kontraFox": {
            "title": "Foxes caught by Kontra",
            "type": "integer",
            "minimum": 0,
            "maximum": 2,
            "default": 0
          },
          "kontraKarlchen": {
            "title": "Karlchen for Kontra",
            "type": "integer",
            "minimum": 0,
            "maximum": 1,
            "default": 0
          },
          "kontraDoppelkopf": {
            "title": "Doppelköpfe won by Kontra",
            "type": "integer",
            "minimum": 0,
            "maximum": 6,
            "default": 0
          }
        },
        "required": []
      },
      "PlaycardsDoppelkopfScoreResult": {
        "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": [
              "winner",
              "reAugen",
              "kontraAugen",
              "lines",
              "value",
              "perPlayer"
            ],
            "properties": {
              "winner": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "re",
                  "kontra",
                  null
                ]
              },
              "reAugen": {
                "type": "integer"
              },
              "kontraAugen": {
                "type": "integer"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "label",
                    "party",
                    "points"
                  ],
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "party": {
                      "type": "string"
                    },
                    "points": {
                      "type": "integer"
                    }
                  }
                }
              },
              "value": {
                "type": "integer",
                "description": "Points per Re player (negative when Re lost); Kontra players get the opposite."
              },
              "perPlayer": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "re",
                  "kontra"
                ],
                "properties": {
                  "re": {
                    "type": "integer"
                  },
                  "kontra": {
                    "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"
              }
            }
          }
        }
      }
    }
  }
}