{
  "openapi": "3.1.1",
  "info": {
    "title": "Schulte Table Generator (Printable) API",
    "version": "1.0.0",
    "summary": "Printable Schulte tables from 3 × 3 to 9 × 9: shuffled numbers to find in order, as SVG.",
    "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://mindquarryschultetable.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Printable Schulte tables from 3 × 3 to 9 × 9: shuffled numbers to find in order, as SVG.",
        "description": "Makes Schulte tables — grids of the numbers 1 to N² in random order that you find and point at in ascending order — as printable SVG files in millimetres, plus the number layout of every table. The same seed always gives the same tables, so a group can practise on identical sheets. The tables are the same ones Mindquarry uses in its Schulte exercise.\n\nMethodology:\n- Each table holds the numbers 1 … N² once, shuffled with a Fisher–Yates shuffle driven by a seeded sfc32 generator; table k uses the seed “\u003cseed\u003e|\u003ck\u003e”, so the same seed and size always give the same tables.\n- How to use a table: look at the centre, then find and point at 1, 2, 3 … as quickly as you can without errors; time yourself and compare only with your own earlier times on the same table size.\n- The SVG files use millimetre units (cell size × N wide) and print at true size from a browser or vector editor; black lines and numbers on white.\n\nPractising these tasks makes you better at these tasks; it does not prove that memory, intelligence or everyday life improve.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "mindquarry_schulte_table",
        "x-owner-app": "mindquarry",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MindquarrySchulteTableInput"
              },
              "examples": {
                "example1": {
                  "summary": "Three classic 5 × 5 tables",
                  "value": {
                    "size": 5,
                    "count": 3,
                    "seed": "mindquarry"
                  }
                },
                "example2": {
                  "summary": "One small 3 × 3 table for a first try",
                  "value": {
                    "size": 3,
                    "count": 1,
                    "cellMm": 25,
                    "seed": "first"
                  }
                },
                "example3": {
                  "summary": "Four 7 × 7 tables with 14 mm cells",
                  "value": {
                    "size": 7,
                    "count": 4,
                    "cellMm": 14,
                    "seed": "week-48"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MindquarrySchulteTableResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "MindquarrySchulteTableInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "size": {
            "title": "Table size (N × N)",
            "type": "integer",
            "minimum": 3,
            "maximum": 9,
            "default": 5
          },
          "count": {
            "title": "Number of tables",
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "default": 3
          },
          "cellMm": {
            "title": "Cell size",
            "description": "20 mm cells make a 5 × 5 table 10 cm wide.",
            "type": "number",
            "minimum": 8,
            "maximum": 40,
            "default": 20,
            "x-unit": "mm"
          },
          "seed": {
            "title": "Seed (same seed = same tables)",
            "type": "string",
            "maxLength": 64,
            "default": "mindquarry"
          },
          "showTitle": {
            "title": "Print a title above each table",
            "type": "boolean",
            "default": true
          }
        },
        "required": []
      },
      "MindquarrySchulteTableResult": {
        "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": [
              "size",
              "count",
              "seed",
              "widthMm",
              "tables"
            ],
            "properties": {
              "size": {
                "type": "integer"
              },
              "count": {
                "type": "integer"
              },
              "seed": {
                "type": "string"
              },
              "widthMm": {
                "type": "number"
              },
              "tables": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "n",
                    "seed",
                    "rows",
                    "svg"
                  ],
                  "properties": {
                    "n": {
                      "type": "integer"
                    },
                    "seed": {
                      "type": "string"
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      }
                    },
                    "svg": {
                      "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"
              }
            }
          }
        }
      }
    }
  }
}