Skip to content
Download

MCP tools

The server has seven tools. The AI picks which one to call on its own; this page is a reference for what each accepts and returns.

All of them, except lua_api, accept the project argument (text): the project folder, with the project.brasa. It is optional when the server was opened with --project, which is what the configuration Brasa writes does.

When something fails, the tool returns the message flagged as an error: a project without project.brasa, a room that does not exist, an executable that is not next to brasa_cli.

Summarizes the project, with no arguments besides project.

Returns
General Name, folder, language (lua or cpp), resolution, start room, global objects and input actions.
Rooms Name, file, size, number of instances and interfaces.
Objects Name, file, sprite, whether it is solid, the script and the events it defines (onUpdate, onSpawn…).
Lists Sprites, sounds, interfaces, themes, tilesets, fonts, videos and scripts.
loadErrors How many files could not be read.

Checks the project without running the game, with no arguments besides project.

Checks
Files Invalid or unreadable JSON.
References A sprite, mask, object, room, tileset, interface, theme or font that does not exist: in project.brasa, objects, rooms, tilesets and interfaces.
Lua Syntax error in each .lua, with file:line.
Interfaces The warnings of the .ui.json interfaces, such as a repeated name.

Returns the list of problems (error or warning, file, line when there is one, message) and the totals. In a C++ project, it does not check the C++ code.

Runs the game without a window and without sound, without touching the save.

Argument Type Default Limit What it does
frames integer 120 1 to 3600 How many frames to run. That is 60 per second of game time, but they run without waiting for the clock.
room text the start room a room of the project The room the game starts in.

Returns the exit code, the errors (file:line: message) and the last 200 lines of the game output, including what it wrote with print. It counts as an error if the game logged an error, exited with a code other than 0 or did not finish in time. The time limit is 30 seconds plus 1 second per 20 frames; after that, the game is closed.

In a Lua project, it uses the brasa_player that sits next to brasa_cli. In a C++ project, it uses the compiled game: if it has not been compiled yet, the tool asks for brasa_cli build.

Like run_game, but it also returns the PNG image of the last frame, at the game resolution.

Argument Type Default Limit What it does
frames integer 60 1 to 3600 How many frames to run before the image.
room text the start room a room of the project The room the game starts in.

Returns the image and the same summary as run_game.

Draws an interface (.ui.json) as a PNG, like the editor preview, without running the game. It uses the brasa_editor that sits next to brasa_cli.

Argument Type Default Limit What it does
interface text, required an interface of the project The interface name: the .ui.json file without the extension.
width integer the game width 16 to 4096 Width of the preview screen.
height integer the game height 16 to 4096 Height of the preview screen.
scale integer the project uiScale 1 to 16 Interface scale.

Returns the image and a line with the size and scale. The call waits up to 90 seconds.

Looks up the Lua API. It has no project.

Argument Type Default What it does
query text empty What to look for: a name (spawn) or a topic (camera). Ignores case and accents.

Without query, it returns every name registered in the engine (global functions, tables such as Save and camera, self:... methods and self.x fields) and the documentation index. With query, it returns the matching names and the documentation sections that talk about the topic, up to about 40 thousand characters; beyond that, it says how many sections were left out.

The documentation comes from the docs/lua/ folder, next to brasa_cli. Without it, the tool returns only the names.

Exports the game ready to distribute, like brasa_cli export.

Argument Type Default Options What it does
output text, required The folder where the exported game is written.
platform text the current system windows, linux Which system to export for.
pack boolean false Bundles the data into a data.pak (scripts become bytecode).
zip boolean false Also builds the .zip (Windows) or .tar.gz (Linux).

Returns the result of brasa_cli export and the output folder. The call waits up to 15 minutes. See Export the game for the export details.