Skip to content

usm/mcp-validate ​

MCP validate tool — validates a .usm file by path or inline YAML content against the v1 JSON Schema.

Why this exists ​

Agents modifying .usm files need to validate their changes before writing. The validate tool checks a file path or inline YAML string against the schema, returning valid/errors without the agent needing to call the CLI.

How it works ​

Validate by path (validate-path) ​

Agent validates an existing .usm file

  1. Get — file path
  2. Parse — YAML content
  3. Observe — validation result (valid + errors)

Guarantees ​

validate-inline-or-path ​

Validate must accept either a file path or inline YAML content

Acceptance criteria:

  • [ ] Returns { valid, errors } structure
  • [ ] Errors include path and message
  • [ ] File-not-found returns valid: false

Test specifications ​

validate-valid-path ​

Given:

  • valid_usm_file: true

Then:

  • assertion: result.valid is true

validate-inline ​

Given:

  • inline_yaml: "summary: too short"

Then:

  • assertion: result.valid is false
  • assertion: errors list non-empty

Implementation ​

  • Primary: src/mcp/validate.ts
  • Test code status: none

See Also ​

  • usm/cli-validate