Skip to content

usm/mcp-validate

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

Intent

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.

Flows

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)

Contracts

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

Tests

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