Update Style Content
update_styleSave a complete map style in Magic Lane Studio by replacing its full JSON with a version check; conflicting edits are refused so existing work is not overwritten.
Instructions
Saves the new content of the style in Magic Lane Studio: replaces the complete style JSON of one of your styles. Always send the full document (edit the "data" from get_style and send it back) and the "version" you read as baseVersion; if the style was saved since (for example in Studio) the write is refused with a conflict and nothing changes — read again, compare, and resend deliberately, never automatically. For a large style, send a file instead of data: first read the "version" with get_style (includeData: false), then download_style it with a path, edit the file, and pass that path here (exactly one of data and path) with that version as baseVersion. The document then never has to pass through the conversation, and a save made in Studio after the download is refused, not overwritten. A version read after the edit would let that save be overwritten. By default the document is validated offline first, reporting every schema problem with its path. A saved document that still has something to fix comes back with warnings: fix them, save again 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). Name, description, tags and purposes are untouched (use edit_style_details). Requires "Studio: Read & write". The style format, with its traps (colours are ABGR integers): 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/). Publishing, reverting and deleting styles, previews, thumbnails and privacy settings are Studio actions (https://developer.magiclane.com/studio) and are not available through these tools; a save here only saves.
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": {
"id": "<id>",
"baseVersion": "<baseVersion>"
},
"name": "update_style"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Id of one of your styles (UUID); a template cannot be changed. | |
| data | No | The complete new style JSON. Replaces the whole content; partial documents are not merged. | |
| path | No | Path of a style JSON file on this computer, used instead of data, for example a file written by download_style and then edited. 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, which may not be yours. A path that starts with ~/ or ~user/ is refused: ~ is not read as a home folder. | |
| baseVersion | Yes | The "version" string of the style as last read (from get_style, list_styles, create_style or a previous write), unchanged. Opaque: never parse or edit it. If the style was saved since (for example in Studio) the write is refused with a conflict and nothing changes. | |
| validateOffline | No | Validate the document against the bundled engine style schema before sending (default true). The portal reports only the first schema problem; the offline check reports all of them with paths and saves a round-trip. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Style id. | |
| from | No | The style file the JSON was read from: on the local server only. | |
| note | Yes | Things to know about this result. | |
| saved | Yes | The content was saved. | |
| updated | Yes | When it was saved, ISO date-time. | |
| version | Yes | The new version: pass it as baseVersion to the next write. | |
| warnings | No | 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. | |
| warningsTruncated | No | warnings counted but not listed: validate again after fixing the listed ones. |