mastercss_apply_preview
Apply a previously generated preview token after validating hashes and workspace containment.
Contract
Apply the exact changes from a reviewed preview in the same running server session. This tool writes workspace files.
Input
Complete input schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "confirmToken": { "type": "string", "minLength": 1 } }, "required": [ "confirmToken" ]}Example
Call mastercss_apply_preview from a connected MCP client with these arguments:
{ "confirmToken": "<token-from-reviewed-preview>"}Replace the placeholder with preview.confirmToken from the same server session. The placeholder itself is not a valid token.
Output
A successful result has applied: true and changes containing file paths and their resulting hashes. Unknown, expired, consumed, changed-source, and out-of-root previews are rejected. Inspect tool errors before treating a change as applied.
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": { "applied": { "type": "boolean", "const": true }, "changes": { "type": "array", "items": { "type": "object", "properties": { "filePath": { "type": "string" }, "afterHash": { "type": "string" } }, "required": [ "filePath", "afterHash" ], "additionalProperties": false } } }, "required": [ "applied", "changes" ], "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
The server validates all original file hashes and writable paths before writing the proposed contents. Successful application consumes the token. File writes are sequential; this is not a transactional multi-file rollback mechanism. Run project checks and inspect the changed UI afterward.
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.