Skip to main content
Glama
watamoo

Crossword MCP Server

by watamoo

register_candidates

Add candidate words for crossword clues by matching character length, returning registered and rejected words to track puzzle-solving progress.

Instructions

指定したカギに対して文字数がマッチする候補語を追加登録する。登録済みと除外された語をまとめて返す。

Args: clue_id (str): 登録対象のカギ ID。setup で読み込んだカギ定義に存在している 必要がある。前後の空白は自動で除去される。 candidates (list[str]): 追加したい候補語のリスト。空文字は許容されない。 カギの length と文字数が一致しない語は登録されず、除外リストに入る。

Returns: dict[str, list[str]]: registered に登録後の候補語リスト(過去の登録分を含む)、 rejected に長さ不一致で追加できなかった語のリストを格納する辞書。

Notes: 長さが一致した語のみ状態に追加され、既存の候補リストは保持したまま追記される。 同じ語が既に登録済みの場合は無視される。

Raises: RuntimeError: setup をまだ呼び出していない場合。 ValueError: clue_id が空、または候補語が空文字だった場合。 KeyError: 指定した clue_id のカギが存在しない場合。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clue_idYes
candidatesYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'register_candidates' MCP tool. It validates the clue_id, filters candidates by length matching the clue, adds new unique ones to the state, and returns lists of registered and rejected candidates.
    @mcp.tool()
    async def register_candidates(
        clue_id: str,
        candidates: list[str],
    ) -> dict[str, list[str]]:
        """指定したカギに対して文字数がマッチする候補語を追加登録する。登録済みと除外された語をまとめて返す。
    
        Args:
            clue_id (str): 登録対象のカギ ID。`setup` で読み込んだカギ定義に存在している
                必要がある。前後の空白は自動で除去される。
            candidates (list[str]): 追加したい候補語のリスト。空文字は許容されない。
                カギの `length` と文字数が一致しない語は登録されず、除外リストに入る。
    
        Returns:
            dict[str, list[str]]: `registered` に登録後の候補語リスト(過去の登録分を含む)、
                `rejected` に長さ不一致で追加できなかった語のリストを格納する辞書。
    
        Notes:
            長さが一致した語のみ状態に追加され、既存の候補リストは保持したまま追記される。
            同じ語が既に登録済みの場合は無視される。
    
        Raises:
            RuntimeError: `setup` をまだ呼び出していない場合。
            ValueError: `clue_id` が空、または候補語が空文字だった場合。
            KeyError: 指定した `clue_id` のカギが存在しない場合。
        """
    
        _ensure_setup()
    
        if not clue_id:
            raise ValueError("clue_id は必須です。")
    
        clue_id = clue_id.strip()
        if clue_id not in state.clues:
            raise KeyError("指定された clue_id のカギが存在しません。")
    
        clue = state.clues[clue_id]
        existing = state.candidates.get(clue_id)
        if existing is None:
            existing = []
    
        rejected: list[str] = []
    
        for candidate in candidates:
            word = candidate.strip()
            if not word:
                raise ValueError("空の候補は登録できません。")
            if len(word) == clue.length:
                if word not in existing:
                    existing.append(word)
            else:
                rejected.append(word)
    
        state.candidates[clue_id] = existing
    
        final_registered = state.candidates.get(clue_id, [])
    
        return {"登録済みの候補語リスト": list(final_registered), "文字数がマッチせず登録されなかった候補語リスト": rejected}
  • src/server.py:205-205 (registration)
    The @mcp.tool() decorator registers the register_candidates function as an MCP tool.
    @mcp.tool()
  • Type hints and docstring define the input schema (clue_id: str, candidates: list[str]) and output schema (dict with registered and rejected lists).
    async def register_candidates(
        clue_id: str,
        candidates: list[str],
    ) -> dict[str, list[str]]:
        """指定したカギに対して文字数がマッチする候補語を追加登録する。登録済みと除外された語をまとめて返す。
    
        Args:
            clue_id (str): 登録対象のカギ ID。`setup` で読み込んだカギ定義に存在している
                必要がある。前後の空白は自動で除去される。
            candidates (list[str]): 追加したい候補語のリスト。空文字は許容されない。
                カギの `length` と文字数が一致しない語は登録されず、除外リストに入る。
    
        Returns:
            dict[str, list[str]]: `registered` に登録後の候補語リスト(過去の登録分を含む)、
                `rejected` に長さ不一致で追加できなかった語のリストを格納する辞書。
    
        Notes:
            長さが一致した語のみ状態に追加され、既存の候補リストは保持したまま追記される。
            同じ語が既に登録済みの場合は無視される。
    
        Raises:
            RuntimeError: `setup` をまだ呼び出していない場合。
            ValueError: `clue_id` が空、または候補語が空文字だった場合。
            KeyError: 指定した `clue_id` のカギが存在しない場合。
        """
Behavior5/5

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

With no annotations provided, the description carries full burden and delivers comprehensive behavioral disclosure. It describes the tool's mutation behavior (adds candidates to existing state), idempotency (duplicates are ignored), validation logic (length matching, non-empty strings), error conditions, and return structure. It also explains state persistence ('既存の候補リストは保持したまま追記される' - existing candidate list is maintained and appended to).

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

Conciseness5/5

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

The description is well-structured and efficiently organized with clear sections (purpose statement, Args, Returns, Notes, Raises). Every sentence adds value: the opening statement defines the core operation, followed by organized technical details. No redundant or verbose content is present.

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

Completeness5/5

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

Given the tool's mutation complexity and lack of annotations, the description provides complete context. It covers purpose, usage prerequisites, parameter semantics, behavioral details (validation, idempotency, state changes), return values (though output schema exists, the description clarifies the dictionary structure), and error conditions. The presence of an output schema reduces the need to explain return types, but the description still adds valuable context about what 'registered' and 'rejected' contain.

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

Parameters5/5

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

Despite 0% schema description coverage, the description fully compensates by providing detailed parameter semantics in the Args section. It explains clue_id must exist in setup-loaded definitions and gets trimmed, and candidates must be non-empty strings with length matching the clue's length. The description adds crucial validation logic not inferable from the bare schema types.

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

Purpose5/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 with specific verbs ('追加登録する' - add/register) and resources ('候補語' - candidate words) for a specific target ('指定したカギ' - specified clue). It distinguishes from siblings by focusing on registration rather than retrieval (get_candidates), rendering (render_solution), searching (search_consistent_sets), or setup (setup).

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

Usage Guidelines5/5

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

The description provides explicit usage guidance: it states when to use (to add candidate words matching length to a clue), prerequisites (must call 'setup' first, clue_id must exist in loaded definitions), and exclusions (candidates must be non-empty strings, length must match clue's length). The 'Raises' section further clarifies error conditions that guide proper usage.

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/watamoo/mcp-crossword-tools'

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