Skip to main content
Glama
vivek081166

japan-utils-mcp

normalize_width

Convert half-width characters to full-width or vice versa in Japanese text. Choose from six modes for ASCII, digits, and kana conversion.

Instructions

Convert between half-width (半角) and full-width (全角) characters.

Args: text: Input string. mode: Conversion direction. One of: - 'to_full' : half-width → full-width for all categories (kana, ascii, digits) - 'to_half' : full-width → half-width for all categories - 'to_full_ascii_only' : convert only ASCII letters and digits to full-width, leave kana untouched - 'to_half_ascii_only' : convert only full-width ASCII to half-width - 'to_full_kana_only' : convert only half-width katakana to full-width - 'to_half_kana_only' : convert only full-width katakana to half-width

Returns: dict with keys: - input: str - output: str - mode: str

Examples: normalize_width("ABC123", "to_half") → "ABC123" normalize_width("ABC123", "to_full") → "ABC123" normalize_width("カタカナ", "to_full") → "カタカナ"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
modeNoto_full

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `normalize_width` function is the MCP tool handler. It is decorated with @mcp.tool() (line 439) and receives a `text` string and `mode` parameter (defaulting to 'to_full'). It uses jaconv.h2z/z2h for conversion between half-width and full-width characters, supporting six modes (to_full, to_half, to_full_ascii_only, to_half_ascii_only, to_full_kana_only, to_half_kana_only). Returns a dict with input, output, and mode keys.
    @mcp.tool()
    def normalize_width(text: str, mode: str = "to_full") -> dict[str, Any]:
        """Convert between half-width (半角) and full-width (全角) characters.
    
        Args:
            text: Input string.
            mode: Conversion direction. One of:
                - 'to_full' : half-width → full-width for all categories (kana, ascii, digits)
                - 'to_half' : full-width → half-width for all categories
                - 'to_full_ascii_only' : convert only ASCII letters and digits to full-width,
                                           leave kana untouched
                - 'to_half_ascii_only' : convert only full-width ASCII to half-width
                - 'to_full_kana_only'  : convert only half-width katakana to full-width
                - 'to_half_kana_only'  : convert only full-width katakana to half-width
    
        Returns:
            dict with keys:
                - input: str
                - output: str
                - mode: str
    
        Examples:
            normalize_width("ABC123", "to_half") → "ABC123"
            normalize_width("ABC123", "to_full") → "ABC123"
            normalize_width("カタカナ", "to_full") → "カタカナ"
        """
        m = mode.strip().lower()
    
        if m == "to_full":
            out = jaconv.h2z(text, kana=True, digit=True, ascii=True)
        elif m == "to_half":
            out = jaconv.z2h(text, kana=True, digit=True, ascii=True)
        elif m == "to_full_ascii_only":
            out = jaconv.h2z(text, kana=False, digit=True, ascii=True)
        elif m == "to_half_ascii_only":
            out = jaconv.z2h(text, kana=False, digit=True, ascii=True)
        elif m == "to_full_kana_only":
            out = jaconv.h2z(text, kana=True, digit=False, ascii=False)
        elif m == "to_half_kana_only":
            out = jaconv.z2h(text, kana=True, digit=False, ascii=False)
        else:
            raise ValueError(
                f"Unknown mode: {mode!r}. "
                "Use 'to_full', 'to_half', or one of the *_only variants."
            )
    
        return {"input": text, "output": out, "mode": m}
  • The tool is registered as an MCP tool via the @mcp.tool() decorator on line 439. The FastMCP instance is created on line 28.
    @mcp.tool()
  • The `jaconv` library (imported on line 21) is the external helper that provides the character width conversion functions h2z (half-to-full) and z2h (full-to-half).
    """japan-utils-mcp — MCP server exposing Japan-specific utilities to AI agents.
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the conversion direction and return format (dict with input, output, mode). It is a pure transformation tool with no destructive behavior, and the description adequately covers the behavior.

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 with a brief intro, Args list, Returns, and Examples. Every sentence adds value, and it is front-loaded with the purpose. No wasted text.

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?

Despite low schema coverage, the description is complete. It covers all modes, provides examples, and specifies the output structure. The output schema existence reduces the need for return value explanation, but the description still includes it.

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?

Given that schema description coverage is 0%, the description fully compensates by explaining both parameters: text as input string and mode with all six enumerated values. Examples further clarify usage.

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 that it converts between half-width and full-width characters. It specifies the resource (characters) and action (convert), and the detailed mode list distinguishes it from sibling tools like convert_kana which handle kana type conversion.

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 explains the various modes and their effects, which guides the user on when to use each mode. However, it does not explicitly mention alternatives or when not to use this tool versus siblings, but the sibling list (e.g., convert_kana) implies different use cases.

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