Skip to main content
Glama

validate_polish_regon

Verify the correctness of a Polish business registry number (REGON) of 9 or 14 digits. Returns validation status, the number, and its length.

Instructions

Validate a Polish REGON (business registry number — 9 or 14 digits).

Returns {'valid': bool, 'regon': str, 'length': int}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regonYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The @mcp.tool handler that exposes validate_polish_regon as an MCP tool. It normalizes the REGON string and delegates to the validate_regon helper.
    @mcp.tool
    async def validate_polish_regon(regon: str) -> dict[str, Any]:
        """Validate a Polish REGON (business registry number — 9 or 14 digits).
    
        Returns {'valid': bool, 'regon': str, 'length': int}.
        """
        import re
    
        normalized = re.sub(r"\s", "", regon)
        valid = validate_regon(regon)
        return {
            "valid": valid,
            "regon": regon,
            "normalized": normalized,
            "length": len(normalized),
            "message": "REGON is valid." if valid else "REGON failed checksum validation.",
        }
  • The validate_regon helper function that implements the actual 9- and 14-digit Polish REGON checksum algorithm.
    def validate_regon(regon: str) -> bool:
        """Return True when *regon* passes the 9- or 14-digit Polish REGON checksum."""
        digits = re.sub(r"\s", "", regon)
        if not digits.isdigit():
            return False
        if len(digits) == 9:
            total = sum(int(d) * w for d, w in zip(digits, _REGON9_WEIGHTS))
            return total % 11 % 10 == int(digits[8])
        if len(digits) == 14:
            total = sum(int(d) * w for d, w in zip(digits, _REGON14_WEIGHTS))
            return total % 11 % 10 == int(digits[13])
        return False
  • The @mcp.tool decorator on line 204 registers the function as an MCP tool named 'validate_polish_regon'.
    @mcp.tool
  • Return type schema showing the dict keys returned: valid, regon, normalized, length, message.
    return {
        "valid": valid,
        "regon": regon,
        "normalized": normalized,
        "length": len(normalized),
        "message": "REGON is valid." if valid else "REGON failed checksum validation.",
Behavior3/5

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

The description discloses the return format (valid, regon, length) but does not specify whether validation is algorithmic or involves external calls, nor does it mention error handling or prerequisites. With no annotations, more detail would be beneficial.

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 two-sentence description efficiently states purpose, format constraints, and return structure with no wasted words.

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

Completeness4/5

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

For a simple one-parameter validation tool with an output schema, the description covers the essential inputs and outputs. Omitting the validation mechanism (algorithm vs. service) is a minor gap.

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 sole parameter 'regon' is given meaningful context (Polish business registry number, 9 or 14 digits) beyond the schema's bare type. This compensates for 0% schema description coverage.

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 identifies the action ('Validate') and the resource ('Polish REGON'), including specific format details (9 or 14 digits). It implicitly distinguishes from sibling 'validate_polish_nip' by focusing on a different identifier.

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?

No explicit when-to-use or alternatives are stated, but the name and description make it obvious this is for REGON numbers. Since a sibling for NIP exists, the context is clear enough for an agent to select correctly.

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/cmendezs/mcp-ksef-pl'

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