# Validate

Fast offline validation toolkit for agents: parse/check structured data and common identifiers (IBAN, EU VAT checksum, HU adószám / cégjegyzékszám). Does not call VIES or send email — use the email service for MX/disposable checks.

**Service id:** `validate`  
**Version:** `0.1.0`  
**Status:** `available`

## Authentication

MCP endpoint: `https://mcp.glc-rag.hu/mcp` (streamable HTTP)

**Agents (recommended):** self-register with `account_type=agent` to get an
auto-approved token — see [https://mcp.glc-rag.hu/guide/agent](https://mcp.glc-rag.hu/guide/agent).

Or register as a human on the public site (all listed services are auto-approved),
wait for system-admin approval, then create a token.

```http
Authorization: Bearer mcp_...
```

Cursor `mcp.json` example:

```json
{
  "mcpServers": {
    "validate": {
      "url": "https://mcp.glc-rag.hu/mcp",
      "headers": {
        "Authorization": "Bearer mcp_YOUR_TOKEN"
      }
    }
  }
}
```

## Tools

### `validate_json`

Parse JSON text; return valid=true or decode errors with line/col.

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "json": {
      "type": "string",
      "description": "JSON text to parse"
    }
  },
  "required": [
    "json"
  ],
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "json": "{\"ok\": true, \"n\": 1}"
}
```

### `validate_json_schema`

Validate a JSON instance against a JSON Schema (Draft 2020-12). Both arguments are JSON text.

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "instance": {
      "type": "string",
      "description": "JSON instance text"
    },
    "schema": {
      "type": "string",
      "description": "JSON Schema text"
    }
  },
  "required": [
    "instance",
    "schema"
  ],
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "instance": "{\"age\": 30}",
  "schema": "{\"type\":\"object\",\"properties\":{\"age\":{\"type\":\"integer\"}},\"required\":[\"age\"]}"
}
```

### `validate_xml`

Check that XML text is well-formed (no XSD in v1).

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "xml": {
      "type": "string",
      "description": "XML document text"
    }
  },
  "required": [
    "xml"
  ],
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "xml": "<root><item id=\"1\"/></root>"
}
```

### `validate_csv`

Parse CSV; check delimiter, optional header, column consistency.

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "csv": {
      "type": "string",
      "description": "CSV text"
    },
    "delimiter": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1,
      "description": "Force delimiter (default: sniff , ; tab |)"
    },
    "has_header": {
      "type": "boolean",
      "default": true
    },
    "expected_columns": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000
    }
  },
  "required": [
    "csv"
  ],
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "csv": "a,b\n1,2\n3,4\n",
  "has_header": true
}
```

### `validate_url`

Validate URL form. Optional require_public=true applies the same SSRF/public host policy as fetch/staging (no download).

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "schemes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Allowed schemes (default http, https)"
    },
    "require_public": {
      "type": "boolean",
      "default": false,
      "description": "Reject private/localhost hosts"
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "url": "https://example.com/path"
}
```

```json
{
  "url": "http://127.0.0.1/",
  "require_public": true
}
```

### `validate_iban`

Validate IBAN format and mod-97 checksum; return compact normalized form.

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "iban": {
      "type": "string"
    }
  },
  "required": [
    "iban"
  ],
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "iban": "GB82 WEST 1234 5698 7654 32"
}
```

### `validate_vat_number`

Validate EU VAT number format and country checksum offline. Does NOT call VIES — not proof of registration.

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "vat": {
      "type": "string",
      "description": "e.g. HU12345678"
    }
  },
  "required": [
    "vat"
  ],
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "vat": "HU12892312"
}
```

### `validate_hungarian_tax_number`

Validate Hungarian adószám (8-digit checksum + optional -VAT-county).

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "tax_number": {
      "type": "string",
      "description": "e.g. 12892312-1-42 or 11 digits"
    }
  },
  "required": [
    "tax_number"
  ],
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "tax_number": "12892312-1-42"
}
```

### `validate_hungarian_company_number`

Validate Hungarian cégjegyzékszám form CC-FF-NNNNNN (e.g. 01-09-123456).

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "company_number": {
      "type": "string"
    }
  },
  "required": [
    "company_number"
  ],
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "company_number": "01-09-123456"
}
```

### `validate_status`

Validate service health and limits.

**Input schema:**

```json
{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

**Examples:**

```json
{}
```

## Usage notes

Call validate_* with the value (and schema for validate_json_schema). Response: { valid, errors[], normalized?, meta }. valid=false is a normal billed result; hard size failures return is_error. validate_url optional require_public applies SSRF/public-IP policy. Email: use email_validate / email_mx_check on the email service.

## Errors / limits

Oversize input → `{error, is_error}`. Invalid values → `valid=false` with errors[]. VAT is offline checksum only (not registry-verified).

## Agent discovery

- Agent registration: `https://mcp.glc-rag.hu/guide/agent`
- Markdown: `https://mcp.glc-rag.hu/guide/validate.md`
- Index: `https://mcp.glc-rag.hu/llms.txt`
- MCP resource: `docs://validate`
