Skip to main content
Glama
wangyafu
by wangyafu

get_puzzle

Retrieve complete details of a 'Turtle Soup' puzzle by specifying its title, enabling users to access full puzzle content for gameplay or reference.

Instructions

获取一个谜题的完整内容

    Args:
        puzzle_title: 海龟汤的标题

    Returns:
        选择结果信息
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
puzzle_titleYes

Implementation Reference

  • The handler function for the 'get_puzzle' tool. It takes a puzzle_title string parameter, looks up the puzzle in the global puzzles dictionary, and returns its string representation or an error message if not found.
    def get_puzzle(puzzle_title: str) -> str:
        """获取一个谜题的完整内容
    
        Args:
            puzzle_title: 海龟汤的标题
    
        Returns:
            选择结果信息
        """
        try:
            puzzle=puzzles[puzzle_title]
            return str(puzzle)
        except KeyError:
            return "找不到该谜题"
  • The @mcp.tool() decorator registers the get_puzzle function as an MCP tool.
    def get_puzzle(puzzle_title: str) -> str:
  • Pydantic model used to structure puzzle data, which is loaded and used by the get_puzzle tool.
    class Puzzle(BaseModel):
        title: str
        content: str
  • Helper function that loads puzzle files into the global puzzles dictionary, enabling the get_puzzle tool.
    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 of behavioral disclosure. It states the tool retrieves puzzle content but doesn't describe traits like whether it's read-only, requires authentication, has rate limits, or what happens on errors. For a tool with zero annotation coverage, this leaves significant gaps in understanding its 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 concise and well-structured, with a clear purpose statement followed by Args and Returns sections. It avoids unnecessary details, though the return description '选择结果信息' (selection result information) is vague. Overall, it's efficient but could be more informative in key areas.

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 (1 parameter, no annotations, no output schema), the description is incomplete. It lacks details on behavioral traits, usage context, and return values. The vague return description and absence of output schema leave the agent uncertain about what to expect, making it inadequate for effective tool invocation.

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?

The description adds minimal semantics beyond the input schema. It mentions 'puzzle_title: 海龟汤的标题' (puzzle_title: the title of the puzzle), which clarifies the parameter's purpose but doesn't provide format details or examples. With 0% schema description coverage, this offers some compensation but is insufficient for full understanding, aligning with the baseline.

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: '获取一个谜题的完整内容' (get the complete content of a puzzle). It specifies the verb '获取' (get) and resource '谜题' (puzzle), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'list_puzzles_tool', which might list puzzles rather than retrieve full content.

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. It doesn't mention sibling tools like 'get_prompt' or 'list_puzzles_tool', nor does it specify prerequisites or exclusions. Usage is implied by the purpose but lacks explicit context for selection.

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