Skip to main content
Glama
YanKe1816

Support Ticket Validator

by YanKe1816
README.md
# Support Ticket Validator

Support Ticket Validator checks whether supplied support ticket data contains required fields and returns a structured completeness status.

## Boundary

This app is read-only, stateless, deterministic, and has no external side effects. It does not authenticate users, call external APIs, use OAuth, store data, update support systems, reply to customers, approve refunds, close tickets, assign responsibility, or provide open-ended support strategy.

Developer Mode testing, production deployment, and formal submission are outside the current gate and have not been performed.

## Technology

- Cloudflare Workers
- TypeScript
- npm
- wrangler

## Project Structure

```text
support-ticket-validator/
├── package.json
├── package-lock.json
├── tsconfig.json
├── wrangler.jsonc
├── README.md
├── src/
│   ├── html.d.ts
│   ├── index.ts
│   ├── schemas.ts
│   ├── tool.ts
│   └── pages/
│       ├── home.html
│       ├── privacy.html
│       ├── terms.html
│       └── support.html
└── scripts/
    └── test-mcp-local.mjs
```

## Install

```bash
npm install
```

## Local Development

```bash
npm run dev
```

The local Worker defaults to:

```text
http://127.0.0.1:8787
```

## Checks

TypeScript:

```bash
npm run typecheck
```

GET `/`:

```bash
curl http://127.0.0.1:8787/
```

GET `/health`:

```bash
curl http://127.0.0.1:8787/health
```

Local MCP regression:

```bash
npm run test:mcp:local
```

To run the regression against another local URL:

```bash
BASE_URL=http://127.0.0.1:8787 npm run test:mcp:local
```

## URLs

- Website URL: `https://support-ticket-validator.sidcraigau.workers.dev`
- MCP URL: `https://support-ticket-validator.sidcraigau.workers.dev/mcp`
- Privacy URL: `https://support-ticket-validator.sidcraigau.workers.dev/privacy`
- Terms URL: `https://support-ticket-validator.sidcraigau.workers.dev/terms`
- Support URL: `https://support-ticket-validator.sidcraigau.workers.dev/support`

## MCP Tool

- Tool name: `validate_support_ticket_completeness`
- Tool title: `Validate Support Ticket Completeness`

Input fields:

- `ticket`: support ticket fields keyed by field name.
- `required_fields`: field names that should be present and non-empty.
- `source_label`: optional source label.
- `request_intent`: optional intent text used only for runtime boundary checks.

Output fields:

- `status`
- `is_complete`
- `checked_fields`
- `present_fields`
- `missing_fields`
- `source_label`
- `errors`

## Schema / Runtime Boundary

The JSON Schema layer declares top-level shape, allowed fields, and basic JSON types. It intentionally does not set `minProperties`, `minItems`, or string `minLength`, because empty tickets, empty required field lists, blank field names, and empty business values must reach the Tool Runtime and return the unified Error Contract.

Runtime type validation handles non-object arguments, missing required inputs, non-object tickets, array or null tickets, non-array `required_fields`, non-string `required_fields` items, and invalid optional string fields.

Business validation handles empty ticket data, empty normalized required field lists, duplicate and whitespace field names, empty values, and out-of-scope request intents.

## Error Contract

All success, incomplete, and error responses use the same `outputSchema`. Error records contain:

- `code`: one of `missing_required_input`, `invalid_input_type`, `empty_input`, `out_of_scope`, `internal_error`
- `message`: human-readable error summary
- `field`: input field related to the error, or an empty string for general errors

## Prohibited Capabilities

This project does not include customer replies, refund approval, refund rejection, ticket closure, ticket status updates, classification, extraction from unstructured messages, CRM or support platform integration, database access, OAuth, login, AI model calls, external APIs, emails, or external writes.