Skip to main content

The MCP tool reference

The tools that Clate's MCP server offers to AI tools. Use this page when you connect your own tool or want to know exactly what the assistant can do.

Clate's MCP server is called Clate MCP Server. It talks JSON-RPC over HTTP and offers the nine tools below. Every tool needs an open project and fails with the message No project is open. Ask the user to open a project first. otherwise.

Overview​

ToolTitleKindPurpose
get_pagesList pagesReadThe pages of the project with their top-level nodes. Call it first.
get_nodeRead node subtreeReadA node and everything below it, with the settings that are set.
create_pageCreate pageAddsCreates a new page.
get_active_pageRead active pageReadThe page that new objects are added to.
get_selectionRead canvas selectionReadThe nodes selected on the canvas.
apply_changesApply model changesChangesApplies a list of changes in one step.
get_instance_imageRead rendered imageReadA picture of what an object looks like.
list_assetsList assetsReadThe image assets of the project.
get_asset_imageRead asset imageReadA picture of an image asset.

get_pages​

Returns the pages and the top-level nodes of each page. No parameters.

The result has a list pages. Each page has an id, a name, and rootNodeIds, the top-level nodes of the page. Use the page id as the parent when you create objects.

get_node​

Returns a node and its subtree with the settings that are set.

ParameterDescription
nodeIdThe node to read. Use a root node from get_pages, or a node id from an earlier result.
maxDepthOptional. How many levels to return: 1 is the node alone, 2 adds its children, and 0 returns everything. The default is 4.

Each node has an id, a displayName, a typeName such as QtQuick.Text, a kind (object, frame or page), its properties and its children. Nodes whose children were cut off by maxDepth are marked with truncated: true.

Values are plain: booleans, numbers, and strings. Colors are strings in the form #aarrggbb. A setting that refers to an asset has the form { "asset": id }, and a setting that holds a gradient has the form { "nodeId": id }. Read the gradient with another get_node call.

create_page​

Creates a page. The parameter displayName is the name of the page. The result is the new pageId. Creating a page whose name already exists fails.

get_active_page​

Returns the pageId and displayName of the active page. The pageId is missing when no page is active.

get_selection​

Returns nodeIds, the nodes that are selected on the canvas. Use it to find out what the user means by "this".

apply_changes​

Applies a list of changes as one step. If any change fails, Clate applies none of them. The parameter changes is a list. Each change has an op that names the operation.

OperationWhat it does
create_objectCreates an object, with its settings and children, under a page or a frame.
create_object_beforeCreates an object directly before an existing sibling.
create_property_objectCreates an object that fills a setting of another object, such as a gradient.
remove_nodeRemoves a node with everything below it.
set_propertySets a setting of an object.
remove_propertyResets a setting to its default.
reparent_nodeMoves a node into another frame or page.
move_node_beforeMoves a node directly before a sibling.
set_display_nameRenames a node.
change_to_frameTurns an object into a frame.
add_assetAdds an image asset, from base64 data or a file path.
update_assetReplaces the content of an asset.
remove_assetRemoves an asset that is not in use.
set_asset_display_nameRenames an asset.

The result has created, the new node ids of the objects created at the top level, and assets, the new asset ids.

Types an AI can create​

QtQuick.Shapes.DesignHelpers.RectangleShape (also used for frames), EllipseShape, RegularPolygonShape and StarShape, QtQuick.Text, QtQuick.Image, and for fills the gradients QtQuick.Shapes.LinearGradient, RadialGradient and ConicalGradient with QtQuick.GradientStop children. A type name always has the module in front of it. Clate rejects other types.

A plain object cannot contain other objects. To create an object with children, set kind to frame.

Settings an AI can change​

See What an AI can do for the list of settings.

Errors​

When a change fails, the tool returns an error that names the change, for example Change 2 of 3 ('set_property') failed: .... Clate applies nothing in that case.

get_instance_image​

Returns a picture of what an object looks like, with everything inside it, cropped to the bounds of the object. The parameter nodeId is the object. The picture is attached as a PNG that is at most 1024 pixels on its longest edge. The result also has hasImage, width, and height.

The picture is a way to check a result, not a way to measure. Read positions and sizes with get_node. After a change, the picture can still show the old state for a moment.

list_assets​

Lists the assets of the project.

ParameterDescription
mimeTypeThe kind of asset, for example image.
mimeSubtypeOptional. For example png.
nameFilterOptional. Text to look for in the name, ignoring upper and lower case.

Each asset in the result has an assetId, a displayName, a mimeType, and a mimeSubtype.

get_asset_image​

Returns a picture of an image asset. The parameter assetId is the asset. The picture is attached as a PNG that is at most 1024 pixels on its longest edge.

Next steps​