check_design_drift
Checks candidate UI code against a reference design-token set and returns a compact, structured list of drift violations. For each: the token axis (color / radius / spacing / font / type), the value found, the expected token and its value, and the location. It reads DECLARED styles and tokens, not pixels. It is stateless (the tokens and code are passed in the call; nothing is stored) and read-only (it reports drift; it does not modify your code). Inputs: reference_tokens — the user's design system as {color:{name:hex}, radius:{name:val}, space:{name:val}, font:{name:stack}, type:{role:{size}}}; code — the CSS/markup to check (declarations such as color: #fff or padding: 12px); optional source (a short label for usage counts; it does not change the check). Recommended use: after you generate UI code against a design system the user has agreed to (they pasted tokens, or approved one you proposed, or described one you composed), call this before presenting the result; if violations come back, fix them and re-check until clean. The build-and-fix loop is yours; swatchdog is the instrument.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"reference_tokens": "<reference_tokens>",
"code": "<code>"
},
"name": "check_design_drift"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| source | No | ||
| reference_tokens | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||