Validate Style
validate_styleValidates Magic Lane style JSON offline against the engine schema, reporting every problem with its JSON path plus warnings for non-schema checks before saving.
Instructions
Validate a Magic Lane style JSON document offline against the published engine style schema, without calling the portal (unless an id is given, which fetches the style first). Reports every problem with its JSON path, unlike the portal which reports only the first. Of the rules the schema cannot express ("checksNotInSchema" lists them all), it checks layer id order, group and icon references, unique image ids, minzoom ≤ maxzoom and the declared satellite source, and reports them as warnings; it does not check that the background layer comes last, that image and font data are real files, nor image sizes. "warnings" lists what to fix before saving, also when it came from a template: apply each "fix", ask the user where "askUser" is true, make the change the message names where there is neither, and tell the user what you fixed. If one cannot be fixed, or the user keeps it, say so and leave it: warnings never block a save. "warnings" holds only the checks this server makes, so an empty list does not mean Studio shows no warning. "notes" need no change. Use it before update_style or create_style with data. Reference: get_style_reference: the essentials with no arguments (resource magiclane://docs/style-essentials), the full format with page "style-file-format" (https://developer.magiclane.com/docs/guides/map-studio/reference/style-file-format/)
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "validate_style"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Id of a style or template to fetch from the portal and validate. | |
| data | No | The style JSON document to validate. | |
| path | No | Path of a .json style file to read and validate. Prefer an absolute path: a relative one is taken from the folder MAGICLANE_FILES_DIR names when the server has one, otherwise the server's working directory. A path that starts with ~/ or ~user/ is refused: ~ is not read as a home folder. | |
| maxProblems | No | Maximum number of problems to report (default 50). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | Yes | Things to know that need no change. | |
| valid | Yes | True when the document has no schema problem; warnings do not count. | |
| source | Yes | What was validated. | |
| problems | Yes | Schema problems, at most maxProblems; empty when valid. | |
| schemaId | Yes | The $id of the schema the document was checked against. | |
| warnings | Yes | What to fix in the style. Fix them before saving (or save again), also when they came from a template: apply each "fix", ask the user where askUser is true, make the change the message names where there is neither, and tell the user what you fixed. If one cannot be fixed, or the user keeps it, say so and leave it: warnings never block a save. Only the checks this server makes: an empty list does not mean Studio shows no warning. | |
| truncated | Yes | Problems counted but not listed. | |
| checksNotInSchema | Yes | Every rule the schema cannot express. This server checks the ones about layer ids, groups, icon names, image ids, zoom ranges and the satellite source, and reports them in warnings. It does not check that the background layer comes last, that image and font data are real files, or the image sizes (Studio or the map checks the last two). | |
| warningsTruncated | Yes | warnings counted but not listed: validate again after fixing the listed ones. |