Tools

generate_sudoku_puzzle

Generate a new, uniquely-solvable Sudoku puzzle at the given difficulty.

Input schema:

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "difficulty": {
      "default": "medium",
      "enum": [
        "very easy",
        "easy",
        "medium",
        "hard",
        "very hard"
      ],
      "type": "string"
    }
  }
}

Output schema:

{
  "description": "Result of generating a new puzzle.",
  "properties": {
    "puzzle": {
      "description": "A 9x9 Sudoku grid; 0 marks an empty cell.",
      "properties": {
        "rows": {
          "description": "9 rows of 9 cells each; 1-9 for a digit, 0 for empty",
          "items": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": "array"
        }
      },
      "required": [
        "rows"
      ],
      "type": "object"
    },
    "difficulty": {
      "enum": [
        "very easy",
        "easy",
        "medium",
        "hard",
        "very hard"
      ],
      "type": "string"
    },
    "givens": {
      "description": "Actual number of filled cells in the generated puzzle",
      "type": "integer"
    }
  },
  "required": [
    "puzzle",
    "difficulty",
    "givens"
  ],
  "type": "object"
}

Metadata:

{
  "fastmcp": {
    "tags": []
  }
}

validate_partial_sudoku_solution

Check whether a partially-filled Sudoku grid is conflict-free and still completable.

Input schema:

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "grid": {
      "description": "A 9x9 Sudoku grid; 0 marks an empty cell.",
      "properties": {
        "rows": {
          "description": "9 rows of 9 cells each; 1-9 for a digit, 0 for empty",
          "items": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": "array"
        }
      },
      "required": [
        "rows"
      ],
      "type": "object"
    }
  },
  "required": [
    "grid"
  ]
}

Output schema:

{
  "description": "Result of validating a partially-filled grid.",
  "properties": {
    "conflicts": {
      "items": {
        "description": "A single cell's position.\n\nrow and col are 1-indexed, matching how Sudoku cells are conventionally described in text,\nrather than the 0-indexed positions used internally.",
        "properties": {
          "row": {
            "description": "1-indexed row",
            "maximum": 9,
            "minimum": 1,
            "type": "integer"
          },
          "col": {
            "description": "1-indexed column",
            "maximum": 9,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "row",
          "col"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "is_completable": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "description": "Whether the grid can still be completed; None when has_conflicts is True, since completability is not a meaningful question until conflicts are resolved"
    },
    "empty_cells": {
      "description": "Every still-empty cell in the grid, regardless of has_conflicts",
      "items": {
        "description": "A single cell's position.\n\nrow and col are 1-indexed, matching how Sudoku cells are conventionally described in text,\nrather than the 0-indexed positions used internally.",
        "properties": {
          "row": {
            "description": "1-indexed row",
            "maximum": 9,
            "minimum": 1,
            "type": "integer"
          },
          "col": {
            "description": "1-indexed column",
            "maximum": 9,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "row",
          "col"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "has_conflicts": {
      "readOnly": true,
      "type": "boolean"
    },
    "empty_cells_count": {
      "description": "Number of still-empty cells, i.e. len(empty_cells)",
      "readOnly": true,
      "type": "integer"
    }
  },
  "required": [
    "conflicts",
    "is_completable",
    "empty_cells",
    "has_conflicts",
    "empty_cells_count"
  ],
  "type": "object"
}

Metadata:

{
  "fastmcp": {
    "tags": []
  }
}

validate_full_sudoku_solution

Check whether a fully-filled Sudoku grid is a correct solution.

Input schema:

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "grid": {
      "description": "A 9x9 Sudoku grid; 0 marks an empty cell.",
      "properties": {
        "rows": {
          "description": "9 rows of 9 cells each; 1-9 for a digit, 0 for empty",
          "items": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": "array"
        }
      },
      "required": [
        "rows"
      ],
      "type": "object"
    }
  },
  "required": [
    "grid"
  ]
}

Output schema:

{
  "description": "Result of validating a fully-filled grid.",
  "properties": {
    "has_empty_cells": {
      "type": "boolean"
    },
    "conflicts": {
      "items": {
        "description": "A single cell's position.\n\nrow and col are 1-indexed, matching how Sudoku cells are conventionally described in text,\nrather than the 0-indexed positions used internally.",
        "properties": {
          "row": {
            "description": "1-indexed row",
            "maximum": 9,
            "minimum": 1,
            "type": "integer"
          },
          "col": {
            "description": "1-indexed column",
            "maximum": 9,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "row",
          "col"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "is_valid": {
      "readOnly": true,
      "type": "boolean"
    }
  },
  "required": [
    "has_empty_cells",
    "conflicts",
    "is_valid"
  ],
  "type": "object"
}

Metadata:

{
  "fastmcp": {
    "tags": []
  }
}

solve_sudoku_puzzle

Solve an unsolved Sudoku grid, or report why it cannot be solved.

Input schema:

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "grid": {
      "description": "A 9x9 Sudoku grid; 0 marks an empty cell.",
      "properties": {
        "rows": {
          "description": "9 rows of 9 cells each; 1-9 for a digit, 0 for empty",
          "items": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "type": "array"
        }
      },
      "required": [
        "rows"
      ],
      "type": "object"
    }
  },
  "required": [
    "grid"
  ]
}

Output schema:

{
  "description": "Result of solving an unsolved grid.",
  "properties": {
    "status": {
      "enum": [
        "satisfiable",
        "conflicting_givens",
        "unsatisfiable"
      ],
      "type": "string"
    },
    "solution": {
      "anyOf": [
        {
          "description": "A 9x9 Sudoku grid; 0 marks an empty cell.",
          "properties": {
            "rows": {
              "description": "9 rows of 9 cells each; 1-9 for a digit, 0 for empty",
              "items": {
                "items": {
                  "type": "integer"
                },
                "type": "array"
              },
              "type": "array"
            }
          },
          "required": [
            "rows"
          ],
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "conflicts": {
      "description": "Populated only when status is conflicting_givens",
      "items": {
        "description": "A single cell's position.\n\nrow and col are 1-indexed, matching how Sudoku cells are conventionally described in text,\nrather than the 0-indexed positions used internally.",
        "properties": {
          "row": {
            "description": "1-indexed row",
            "maximum": 9,
            "minimum": 1,
            "type": "integer"
          },
          "col": {
            "description": "1-indexed column",
            "maximum": 9,
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "row",
          "col"
        ],
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "status",
    "solution",
    "conflicts"
  ],
  "type": "object"
}

Metadata:

{
  "fastmcp": {
    "tags": []
  }
}