Skip to main content
Glama
Skywalker-Harrison

Soduku Solver MCP Server

solve-sudoku

Solve Sudoku puzzles by providing the puzzle name. This tool processes Sudoku inputs to generate complete solutions.

Instructions

Solve a Sudoku puzzle

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the puzzle to solve

Implementation Reference

  • The execution handler for the 'solve-sudoku' tool. It retrieves a stored Sudoku puzzle by name, makes a copy, solves it using solveSudoku, stores the solved version, notifies of changes, and returns the formatted solution or error messages.
    elif name == "solve-sudoku":
        puzzle_name = arguments.get("name")
        
        if not puzzle_name:
            raise ValueError("Missing puzzle name")
            
        if puzzle_name not in sudoku_puzzles:
            return [
                types.TextContent(
                    type="text",
                    text=f"Sudoku puzzle '{puzzle_name}' not found",
                )
            ]
            
        # Make a copy of the grid to solve
        grid = [row[:] for row in sudoku_puzzles[puzzle_name]]
        
        # Solve the puzzle
        if solveSudoku(grid):
            # Store the solved puzzle with a new name
            solved_name = f"{puzzle_name}_solved"
            sudoku_puzzles[solved_name] = grid
            
            # Notify clients that resources have changed
            await server.request_context.session.send_resource_list_changed()
            
            # Return formatted solution
            formatted_grid = format_sudoku_grid(grid)
            
            return [
                types.TextContent(
                    type="text",
                    text=f"Solved Sudoku puzzle '{puzzle_name}':\n\n{formatted_grid}",
                )
            ]
        else:
            return [
                types.TextContent(
                    type="text",
                    text=f"No solution found for Sudoku puzzle '{puzzle_name}'",
                )
            ]
  • Registration of the 'solve-sudoku' tool in the list_tools method, including its name, description, and input schema requiring a 'name' parameter.
    types.Tool(
        name="solve-sudoku",
        description="Solve a Sudoku puzzle",
        inputSchema={
            "type": "object",
            "properties": {
                "name": {"type": "string", "description": "Name of the puzzle to solve"},
            },
            "required": ["name"],
        },
    ),
  • JSON schema for the 'solve-sudoku' tool input, defining a required 'name' string parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "name": {"type": "string", "description": "Name of the puzzle to solve"},
        },
        "required": ["name"],
    },
  • Core helper function that implements the Sudoku solver using backtracking with bitmask optimization for rows, columns, and 3x3 boxes.
    def solveSudoku(mat):
        """
        Solve a Sudoku puzzle.
        
        Args:
            mat: The Sudoku grid (9x9 matrix) with 0s for empty cells
            
        Returns:
            bool: True if solved successfully, False otherwise
        """
        n = len(mat)
        row = [0] * n
        col = [0] * n
        box = [0] * n
    
        # Set the bits in bitmasks for values that are initially present
        for i in range(n):
            for j in range(n):
                if mat[i][j] != 0:
                    row[i] |= (1 << mat[i][j])
                    col[j] |= (1 << mat[i][j])
                    box[(i // 3) * 3 + j // 3] |= (1 << mat[i][j])
    
        return sudokuSolverRec(mat, 0, 0, row, col, box)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool solves puzzles but does not describe how (e.g., algorithm, constraints), what happens on success/failure, or any side effects (e.g., whether it modifies stored data). This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, making it front-loaded and easy to parse. However, it is overly concise, bordering on under-specification, as it omits necessary context for effective use, slightly reducing its utility.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (solving a puzzle), lack of annotations, no output schema, and incomplete behavioral transparency, the description is insufficient. It does not explain what the tool returns (e.g., solved puzzle, success status) or how it interacts with siblings, leaving the agent with incomplete information for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'name' documented as 'Name of the puzzle to solve'. The description does not add meaning beyond this, such as explaining name format or referencing sibling tools. With high schema coverage, the baseline score of 3 is appropriate, as the schema handles parameter documentation adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Solve a Sudoku puzzle' clearly states the action (solve) and resource (Sudoku puzzle), making the purpose understandable. However, it lacks specificity about what constitutes a puzzle (e.g., a stored puzzle by name) and does not differentiate from sibling tools like 'solve-sudoku-text', leaving room for ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description does not mention prerequisites (e.g., needing a puzzle stored via 'add-sudoku'), exclusions, or comparisons to siblings like 'solve-sudoku-text', leaving the agent to infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Skywalker-Harrison/mcp-soduku'

If you have feedback or need assistance with the MCP directory API, please join our Discord server