Skip to main content
Glama

validate_nif

Read-onlyIdempotent

Validates a Portuguese NIF (Número de Identificação Fiscal) — the 9-digit tax identification number issued by the Portuguese Tax Authority (AT) to individuals and companies. Applies the official modulo-11 checksum algorithm to verify the check digit. Returns { valid: true, nif: string } for valid NIFs, or { valid: false, reason: string } for invalid format or failed checksum. First-digit rules are enforced: 1–3 for individuals, 5 for corporations, 6 for public entities, 7–8 for other entities, 9 for occasional taxpayers. Use when processing Portuguese invoices (faturas), onboarding suppliers, validating user registrations, or any fiscal compliance workflow. Does not query the AT database — offline format and checksum validation only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nifYes9-digit Portuguese NIF, with or without spaces. Example: '123456789' or '123 456 789'

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / nif / description
      Previous value: -"9-digit Portuguese NIF, with or without spaces. Example: '123456789'"New value: +"9-digit Portuguese NIF, with or without spaces. Example: '123456789' or '123 456 789'"
    • changedOutput schema / (root)
      Previous value: -{
      -  "$schema": "http://json-schema.org/draft-07/schema#",
      -  "additionalProperties": false,
      -  "properties": {
      -    "nif": {
      -      "type": "string"
      -    },
      -    "reason": {
      -      "type": "string"
      -    },
      -    "valid": {
      -      "type": "boolean"
      -    }
      -  },
      -  "required": [
      -    "valid"
      -  ],
      -  "type": "object"
      -}New value: +null
  2. Changed3 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / nif / description
      Previous value: -"9-digit Portuguese NIF, with or without spaces. Example: '123456789' or '123 456 789'"New value: +"9-digit Portuguese NIF, with or without spaces. Example: '123456789'"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "nif": {
      +      "type": "string"
      +    },
      +    "reason": {
      +      "type": "string"
      +    },
      +    "valid": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "valid"
      +  ],
      +  "type": "object"
      +}
  3. Changed1 schema field changed
    • changedInput schema / properties / nif / description
      Previous value: -"The Portuguese NIF to validate. Can include spaces which will be stripped. Example: '123456789'"New value: +"9-digit Portuguese NIF, with or without spaces. Example: '123456789' or '123 456 789'"
  4. Changed1 schema field changed
    • changedInput schema / properties / nif / description
      Previous value: -"The Portuguese NIF to validate"New value: +"The Portuguese NIF to validate. Can include spaces which will be stripped. Example: '123456789'"
  5. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Goes beyond annotations by disclosing the modulo-11 checksum algorithm, first-digit rules for different entity types, return shape, and offline-only behavior. This provides rich behavioral context that annotations (readOnlyHint, idempotentHint) do not cover. No contradiction with annotations.

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?

Six sentences, each informative and front-loaded with purpose. The enumeration of first-digit rules and multiple use cases adds slight verbosity, but overall the description is well-structured with no fluff.

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?

For a one-parameter validation tool with no output schema, the description covers purpose, algorithm, return values, input rules, use cases, and limitations. It compensates for the absence of an output schema by explicitly describing the return shape and reason field.

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 input schema already covers the nif parameter with a full description and example (100% coverage). The description adds context about validation rules but does not add additional parameter syntax or format details beyond what the schema provides. Baseline 3 is appropriate.

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 uses a specific verb 'Validates' with a precise resource 'Portuguese NIF' (expanded as Número de Identificação Fiscal). It clearly distinguishes from sibling tools like validate_nif_es by specifying the Portuguese jurisdiction and providing details on the tax authority (AT).

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?

Provides clear use cases (invoices, supplier onboarding, user registrations, fiscal compliance) and notes the offline-only limitation, which indicates when a DB-backed validation would be needed. Though it doesn't explicitly name an alternative tool, the context is strong and the sibling list makes the distinction obvious.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources