Skip to main content
Glama
vivek081166

japan-utils-mcp

kanji_to_romaji

Transliterates Japanese kanji and kana text into Hepburn romaji, returning the romaji, hiragana reading, and original input.

Instructions

Transliterate Japanese text (kanji + kana mix) to Hepburn romaji.

Args: text: Japanese text. May contain kanji, hiragana, katakana, ASCII. Non-Japanese characters pass through unchanged.

Returns: dict with keys: - romaji: str (space-separated Hepburn romaji) - hiragana: str (kanji converted to hiragana, kana preserved) - input: str (echo of the original input)

Examples: kanji_to_romaji("山田太郎") → {"romaji": "yamada tarou", "hiragana": "やまだたろう"} kanji_to_romaji("東京駅") → {"romaji": "toukyou eki", "hiragana": "とうきょうえき"}

Caveats: - Kanji with multiple readings (e.g. proper nouns) may be ambiguous. The transliteration uses the most common reading, which is sometimes wrong for personal names. Use as a starting point, not a guarantee.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool handler function for 'kanji_to_romaji'. Uses pykakasi to convert Japanese text (kanji + kana) to Hepburn romaji and hiragana.
    @mcp.tool()
    def kanji_to_romaji(text: str) -> dict[str, Any]:
        """Transliterate Japanese text (kanji + kana mix) to Hepburn romaji.
    
        Args:
            text: Japanese text. May contain kanji, hiragana, katakana, ASCII.
                Non-Japanese characters pass through unchanged.
    
        Returns:
            dict with keys:
                - romaji: str (space-separated Hepburn romaji)
                - hiragana: str (kanji converted to hiragana, kana preserved)
                - input: str (echo of the original input)
    
        Examples:
            kanji_to_romaji("山田太郎") → {"romaji": "yamada tarou", "hiragana": "やまだたろう"}
            kanji_to_romaji("東京駅") → {"romaji": "toukyou eki", "hiragana": "とうきょうえき"}
    
        Caveats:
            - Kanji with multiple readings (e.g. proper nouns) may be ambiguous.
              The transliteration uses the most common reading, which is
              sometimes wrong for personal names. Use as a starting point, not a
              guarantee.
        """
        results = _kakasi.convert(text)
        romaji = " ".join(r["hepburn"] for r in results if r["hepburn"]).strip()
        hira = "".join(r["hira"] for r in results)
        return {
            "romaji": romaji,
            "hiragana": hira,
            "input": text,
        }
  • The pykakasi instance used as the engine for transliteration. Initialized at module level.
    _kakasi = pykakasi.kakasi()
  • The tool is registered via the @mcp.tool() decorator on the kanji_to_romaji function. mcp is a FastMCP instance created on line 28.
    @mcp.tool()
  • The function signature defines the schema: input is 'text: str', output is dict with keys 'romaji', 'hiragana', and 'input'. Docstring describes the expected behavior.
    @mcp.tool()
    def kanji_to_romaji(text: str) -> dict[str, Any]:
        """Transliterate Japanese text (kanji + kana mix) to Hepburn romaji.
    
        Args:
            text: Japanese text. May contain kanji, hiragana, katakana, ASCII.
                Non-Japanese characters pass through unchanged.
    
        Returns:
            dict with keys:
                - romaji: str (space-separated Hepburn romaji)
                - hiragana: str (kanji converted to hiragana, kana preserved)
                - input: str (echo of the original input)
    
        Examples:
            kanji_to_romaji("山田太郎") → {"romaji": "yamada tarou", "hiragana": "やまだたろう"}
            kanji_to_romaji("東京駅") → {"romaji": "toukyou eki", "hiragana": "とうきょうえき"}
    
        Caveats:
            - Kanji with multiple readings (e.g. proper nouns) may be ambiguous.
              The transliteration uses the most common reading, which is
              sometimes wrong for personal names. Use as a starting point, not a
              guarantee.
        """
        results = _kakasi.convert(text)
        romaji = " ".join(r["hepburn"] for r in results if r["hepburn"]).strip()
        hira = "".join(r["hira"] for r in results)
        return {
            "romaji": romaji,
            "hiragana": hira,
            "input": text,
        }
Behavior4/5

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

With no annotations, the description discloses key behaviors: non-Japanese characters pass through unchanged, ambiguous readings may occur, and the return format is a dict with specific keys. This is thorough but could mention if the tool is read-only or has side effects.

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 well-structured with sections (Args, Returns, Examples, Caveats) and front-loaded with the main purpose. While comprehensive, it is slightly verbose; the examples and caveats are helpful but add length. Still, every sentence contributes.

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 simplicity (one input, defined output), the description is highly complete. It covers input constraints, output structure, and addresses ambiguity caveats. The presence of an output schema in the description further enhances completeness.

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?

The single parameter 'text' has no description in the schema (0% coverage). The description adds semantic value by explaining what the text may contain (kanji, kana, ASCII) and that non-Japanese characters pass through unchanged. This fully compensates for the schema gap.

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: transliterate Japanese text to Hepburn romaji. It specifies the verb 'transliterate' and the resource 'Japanese text (kanji + kana mix)'. This distinguishes it from sibling tools like convert_kana or split_japanese_name.

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

Usage Guidelines4/5

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

The description provides examples and caveats (ambiguous readings for proper nouns) that guide usage. However, it does not explicitly contrast with siblings like convert_kana, so it lacks a clear 'when to use this vs alternatives' statement.

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/vivek081166/japan-utils-mcp'

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