mastercss_preview_fixes
Create a diff preview for lint fixes or generated CSS output and return a confirmation token.
Contract
Prepare a reviewable diff for native lint fixes or generated CSS output. This request does not apply its changes.
Input
Complete input schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "context": { "type": "string", "enum": [ "project", "preset" ] }, "mode": { "type": "string", "enum": [ "lint-fixes", "generated-css" ] }, "patterns": { "type": "array", "items": { "type": "string" } }, "rules": { "type": "string" }, "outputPath": { "type": "string" }, "ttlMs": { "type": "integer", "minimum": 1000, "maximum": 3600000 } }}Example
Call mastercss_preview_fixes from a connected MCP client with these arguments:
{ "mode": "lint-fixes", "patterns": [ "src/button.html" ], "rules": "sort-classes"}Review preview.changes and its diffs before passing a returned token to the apply tool.
Output
preview contains changed files, complete proposed text, diffs, hashes, and a summary. A changed result includes confirmToken and expiresAt. Lint mode includes a lint report; generated-CSS mode includes outputPath and a scan summary. Manifest errors return the error envelope; an error must not be interpreted as an empty successful preview.
Every tool returns an object with version: 3, metadata, diagnostics and result. Success payload fields described above live in result.data; failure has result.status: "error" and a required { code, message } error. JSON text equals structuredContent. Tool errors set isError. Metadata records actual context, package/language/binding versions, manifest fingerprint, entries and dependencies; unavailable information is null or an empty array.
Complete output schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "version": { "type": "number", "const": 3 }, "metadata": { "type": "object", "properties": { "versions": { "anyOf": [ { "type": "object", "properties": { "languageVersion": { "type": "number" }, "bindingAbiVersion": { "type": "number" }, "packageVersion": { "type": "string" } }, "required": [ "languageVersion", "bindingAbiVersion", "packageVersion" ], "additionalProperties": {} }, { "type": "null" } ] }, "context": { "anyOf": [ { "type": "string", "enum": [ "project", "preset" ] }, { "type": "null" } ] }, "manifestFingerprint": { "type": [ "string", "null" ] }, "entries": { "type": "array", "items": { "type": "string" } }, "dependencies": { "type": "array", "items": { "type": "string" } } }, "required": [ "versions", "context", "manifestFingerprint", "entries", "dependencies" ], "additionalProperties": false }, "diagnostics": { "type": "array", "items": { "type": "object", "properties": { "code": { "type": "string" }, "phase": { "type": "string" }, "severity": { "type": [ "string", "number" ] }, "message": { "type": "string" }, "notes": { "type": "array", "items": { "type": "string" } }, "alternatives": { "type": "array", "items": { "type": "string" } }, "source": { "type": "string" }, "range": { "anyOf": [ { "type": "object", "properties": { "start": { "type": "number" }, "end": { "type": "number" } }, "required": [ "start", "end" ], "additionalProperties": false }, { "type": "object", "properties": { "start": { "type": "object", "properties": { "line": { "type": "number" }, "character": { "type": "number" } }, "required": [ "line", "character" ], "additionalProperties": false }, "end": { "type": "object", "properties": { "line": { "type": "number" }, "character": { "type": "number" } }, "required": [ "line", "character" ], "additionalProperties": false } }, "required": [ "start", "end" ], "additionalProperties": false } ] } }, "required": [ "message" ], "additionalProperties": {} } }, "result": { "oneOf": [ { "type": "object", "properties": { "status": { "type": "string", "const": "success" }, "data": { "type": "object", "properties": { "manifest": { "type": "object", "properties": { "context": { "type": "string", "enum": [ "project", "preset" ] }, "status": { "type": "string", "enum": [ "loaded", "error" ] }, "fingerprint": { "type": [ "string", "null" ] }, "entries": { "type": "array", "items": { "type": "string" } }, "dependencies": { "type": "array", "items": { "type": "string" } }, "versions": { "type": "object", "properties": { "languageVersion": { "type": "number" }, "bindingAbiVersion": { "type": "number" }, "packageVersion": { "type": "string" } }, "required": [ "languageVersion", "bindingAbiVersion", "packageVersion" ], "additionalProperties": {} } }, "required": [ "context", "status", "fingerprint", "entries", "dependencies" ], "additionalProperties": {} }, "mode": { "type": "string", "enum": [ "lint-fixes", "generated-css" ] }, "preview": { "type": "object", "properties": { "confirmToken": { "type": "string" }, "expiresAt": { "type": "number" }, "changes": { "type": "array", "items": { "type": "object", "properties": { "filePath": { "type": "string" }, "beforeHash": { "type": [ "string", "null" ] }, "afterHash": { "type": "string" }, "beforeExists": { "type": "boolean" }, "beforeBytes": { "type": "number" }, "afterBytes": { "type": "number" }, "afterText": { "type": "string" }, "diff": { "type": "string" } }, "required": [ "filePath", "beforeHash", "afterHash", "beforeExists", "beforeBytes", "afterBytes", "afterText", "diff" ], "additionalProperties": false } }, "summary": { "type": "object", "properties": { "files": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "bytesBefore": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "bytesAfter": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "files", "bytesBefore", "bytesAfter" ], "additionalProperties": false } }, "required": [ "changes", "summary" ], "additionalProperties": {} } }, "required": [ "manifest", "mode", "preview" ], "additionalProperties": {} } }, "required": [ "status", "data" ], "additionalProperties": false }, { "type": "object", "properties": { "status": { "type": "string", "const": "error" }, "error": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } }, "required": [ "code", "message" ], "additionalProperties": false } }, "required": [ "status", "error" ], "additionalProperties": false } ] } }, "required": [ "version", "metadata", "diagnostics", "result" ], "additionalProperties": false}Project context and lifecycle
Workspace files stay unchanged until mastercss_apply_preview. A nonempty preview stores a token in this server process; expiry, restart, or successful application requires a new preview. An unchanged result has no confirmation token.
The local stdio server uses the workspace passed to --root. Confirm the root and intended CSS entries with mastercss_workspace_info before relying on project-dependent values.
See the MCP workflow guide for client setup and the preview/apply workflow.