Skip to main content
Glama
wangyafu
by wangyafu

list_puzzles_tool

Discover all available puzzles on the Haiguitang MCP Server's 'Turtle Soup' game by using this tool to retrieve a comprehensive list for enhanced gameplay experience.

Instructions

列出所有可用的谜题

    Returns:
        谜题列表
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_puzzles_tool' tool. It is decorated with @mcp.tool() for registration and implements the logic to list all loaded puzzles by iterating over the global 'puzzles' dictionary and formatting them into a string list.
    @mcp.tool()
    def list_puzzles_tool() -> str:
        """列出所有可用的谜题
    
        Returns:
            谜题列表
        """
        puzzle_list = []
        for puzzle_id, puzzle in puzzles.items():
            puzzle_list.append(f"- {puzzle_id}")
        return "可用谜题列表:\n" + "\n".join(puzzle_list)
  • The @mcp.tool() decorator registers the list_puzzles_tool function as an MCP tool.
    @mcp.tool()
  • The load_puzzles function populates the global 'puzzles' dictionary used by list_puzzles_tool by searching for .md files in various directories and parsing them into Puzzle objects.
    def load_puzzles():
        # 获取当前脚本所在目录
        current_dir = os.path.dirname(os.path.abspath(__file__))
        base_dir = os.path.dirname(current_dir)  # 获取上一级目录
    
        # 查找多个可能的路径
        puzzle_paths = [
            os.path.join(current_dir, "puzzles", "*.md"),  # app/puzzles/*.md
            os.path.join(base_dir, "haiguitang-mcp", "puzzles", "*.md"),  # 项目根目录/app/puzzles/*.md
            os.path.join(base_dir, "puzzles", "*.md"),  # 项目根目录/puzzles/*.md
            os.path.join(base_dir, "*.md"),  # 项目根目录/*.md
        ]
    
        for path_pattern in puzzle_paths:
            print(f"正在搜索路径: {path_pattern}")
            puzzle_files = glob.glob(path_pattern)
            for file_path in puzzle_files:
                puzzle_title = os.path.basename(file_path).replace(".md", "")
                if "README" in puzzle_title:
                    continue
                try:
                    with open(file_path, "r", encoding="utf-8") as f:
                        content = f.read()
    
    
                    # 创建谜题对象
                    puzzle = Puzzle(
                        title=puzzle_title,
                        content=content
                    )
                    puzzles[puzzle_title] = puzzle
                    print(f"已加载谜题: {puzzle_title}")
                except Exception as e:
                    print(f"加载谜题 {puzzle_title} 失败: {str(e)}")
    
        if not puzzles:
            print("警告:未找到任何谜题文件")
    
    # 初始化时加载谜题
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. It states the tool returns a puzzle list, which implies a read-only operation, but doesn't disclose behavioral traits like whether it requires authentication, has rate limits, pagination, or error conditions. This is a significant gap for a tool with no annotation coverage.

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

Conciseness3/5

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

The description is brief with two lines: one stating the purpose and another indicating the return value. However, the 'Returns:' section is somewhat redundant since it just restates '谜题列表' (puzzle list) without adding value. It could be more front-loaded and eliminate the unnecessary return annotation.

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 no annotations and no output schema, the description is incomplete. It doesn't explain the return format (e.g., structure of the puzzle list), error handling, or any behavioral context. For a list operation, this leaves gaps in understanding how to interpret results or handle edge cases.

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

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it correctly doesn't mention any. Baseline is 4 for zero parameters, as it appropriately avoids redundant information.

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

Purpose4/5

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

The description clearly states the tool's purpose: '列出所有可用的谜题' (List all available puzzles). It uses a specific verb ('列出' - list) and resource ('谜题' - puzzles). However, it doesn't differentiate from sibling tools like 'get_puzzle' which likely retrieves a specific puzzle, so it doesn't fully distinguish from alternatives.

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?

The description provides no guidance on when to use this tool versus alternatives like 'get_puzzle' or 'get_prompt'. There's no mention of context, prerequisites, or exclusions. The agent must infer usage from the tool name and description 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

Related 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/wangyafu/haiguitangmcp'

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