MCP tools

mastercss_preview_directive_format

Create a safe preview for formatting Master CSS directives, or format in-memory content without writing files.

Contract

Format directives in a source buffer or create a file-formatting preview. Content mode returns formatted text directly and does not create an apply token.

Input

context
stringOptional

Semantic context. Defaults to project; entry discovery or compilation failures are reported without falling back. Select preset explicitly for standalone preset queries. Values: project, preset.

content
stringOptional

Source buffer. When present, selects content mode and takes precedence over patterns.

filePath
stringOptional

Virtual workspace-relative path used to infer the source language; the buffer does not need to exist on disk. Defaults to master.css in content mode.

patterns
string[]Optional

File paths or glob patterns for file mode. Defaults to CSS, SCSS, Less, Vue, Svelte, and Astro sources outside node_modules.

range
objectOptional

Optional formatting range, using zero-based UTF-16 positions.

range.start
objectRequired when parent is provided

Inclusive start position.

range.start.line
integerRequired when parent is provided

Zero-based line index. Minimum: 0.

range.start.character
integerRequired when parent is provided

Zero-based UTF-16 code-unit offset. Minimum: 0.

range.end
objectRequired when parent is provided

Exclusive end position.

range.end.line
integerRequired when parent is provided

Zero-based line index. Minimum: 0.

range.end.character
integerRequired when parent is provided

Zero-based UTF-16 code-unit offset. Minimum: 0.

ttlMs
integerOptional

Preview lifetime in milliseconds. Omit to use the server’s --preview-ttl setting, which defaults to 300000 (5 minutes). Minimum: 1000. Maximum: 3600000.

Complete input schema
JSON
{  "$schema": "http://json-schema.org/draft-07/schema#",  "type": "object",  "properties": {    "context": {      "type": "string",      "enum": [        "project",        "preset"      ]    },    "content": {      "type": "string"    },    "filePath": {      "type": "string"    },    "patterns": {      "type": "array",      "items": {        "type": "string"      }    },    "range": {      "type": "object",      "properties": {        "start": {          "type": "object",          "properties": {            "line": {              "type": "integer",              "minimum": 0,              "maximum": 9007199254740991            },            "character": {              "type": "integer",              "minimum": 0,              "maximum": 9007199254740991            }          },          "required": [            "line",            "character"          ]        },        "end": {          "type": "object",          "properties": {            "line": {              "type": "integer",              "minimum": 0,              "maximum": 9007199254740991            },            "character": {              "type": "integer",              "minimum": 0,              "maximum": 9007199254740991            }          },          "required": [            "line",            "character"          ]        }      },      "required": [        "start",        "end"      ]    },    "ttlMs": {      "type": "integer",      "minimum": 1000,      "maximum": 3600000    }  }}

Example

Call mastercss_preview_directive_format from a connected MCP client with these arguments:

Arguments
{  "content": "@safelist \"background-color:transparent !\";",  "filePath": "card.css"}

The returned formatted string joins the importance marker to its class without editing a file.

Output

Both modes report files, edits, changed counts, and mode. Content mode includes formatted; file mode includes inputs and preview. Formatting uses the default preset language service and does not load the project manifest.

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
JSON
{  "$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": {                "root": {                  "type": "string"                },                "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": [                    "content",                    "files"                  ]                },                "files": {                  "type": "array",                  "items": {                    "type": "object",                    "properties": {                      "filePath": {                        "type": "string"                      },                      "languageId": {                        "type": "string"                      },                      "edits": {                        "type": "array",                        "items": {                          "type": "object",                          "properties": {                            "range": {                              "type": "object",                              "properties": {                                "start": {                                  "type": "object",                                  "properties": {                                    "line": {                                      "type": "integer",                                      "minimum": 0,                                      "maximum": 9007199254740991                                    },                                    "character": {                                      "type": "integer",                                      "minimum": 0,                                      "maximum": 9007199254740991                                    }                                  },                                  "required": [                                    "line",                                    "character"                                  ],                                  "additionalProperties": false                                },                                "end": {                                  "type": "object",                                  "properties": {                                    "line": {                                      "type": "integer",                                      "minimum": 0,                                      "maximum": 9007199254740991                                    },                                    "character": {                                      "type": "integer",                                      "minimum": 0,                                      "maximum": 9007199254740991                                    }                                  },                                  "required": [                                    "line",                                    "character"                                  ],                                  "additionalProperties": false                                }                              },                              "required": [                                "start",                                "end"                              ],                              "additionalProperties": false                            },                            "newText": {                              "type": "string"                            }                          },                          "required": [                            "range",                            "newText"                          ],                          "additionalProperties": false                        }                      },                      "changed": {                        "type": "boolean"                      },                      "beforeBytes": {                        "type": "integer",                        "minimum": 0,                        "maximum": 9007199254740991                      },                      "afterBytes": {                        "type": "integer",                        "minimum": 0,                        "maximum": 9007199254740991                      }                    },                    "required": [                      "filePath",                      "languageId",                      "edits",                      "changed",                      "beforeBytes",                      "afterBytes"                    ],                    "additionalProperties": false                  }                },                "summary": {                  "type": "object",                  "properties": {                    "files": {                      "type": "integer",                      "minimum": 0,                      "maximum": 9007199254740991                    },                    "changed": {                      "type": "integer",                      "minimum": 0,                      "maximum": 9007199254740991                    },                    "edits": {                      "type": "integer",                      "minimum": 0,                      "maximum": 9007199254740991                    }                  },                  "required": [                    "files",                    "changed",                    "edits"                  ],                  "additionalProperties": false                }              },              "required": [                "root",                "manifest",                "mode",                "files",                "summary"              ],              "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

Content mode does not write files or store a token. In file mode, 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.


© 2026 Aoyue Design LLC.MIT License
Trademark Policy