All posts
EngineeringNovember 24, 2026 · The Ubriot team · 5 min read

A tool that cannot publish hands back the command instead

Our MCP server exposed an OTA publish tool that could not ship the one thing an OTA update needs, the JavaScript bundle. It now returns the CLI command to run, and refuses to paste anything unsafe into it.

The Ubriot MCP server lets an AI assistant work with your apps: list builds, read logs, trigger a build, send a push. One of its tools was called ubriot_publish_ota, and its description said it would publish an over-the-air update to a React Native app, delivered to users without going through the store. That was a promise the tool could not keep.

An OTA update is a JavaScript bundle. The bundle is exported from the app's source, with the app's dependencies installed, on a machine that has both. The MCP server runs wherever the assistant runs and has none of that. The old implementation posted a channel and a description to the updates endpoint and answered with a success message that quoted the new update id. Whatever the API did with a request that carried no bundle, a tool that says it delivers code to your users should not be in the position of guessing.

Return the next step, not a pretend result

The tool now publishes nothing. It builds the exact command for the ubriot CLI, which can export the bundle, and returns it as text for the assistant to show you. Its first line says Nothing was published, so a model reading the result cannot report success by accident. Its description says the same thing, because the description is what the assistant reads when it decides whether to call the tool at all.

ubriot update --app my-app --channel production --message "Fix login copy"

The rest of the text tells you where to run it (in the app's folder), what the command does (exports the bundle, warns if installed binaries cannot run it, publishes it) and which tool to call afterwards to check the result, ubriot_list_updates. The assistant still saves you the typing and the lookup of the right app id and channel. It just stops short of claiming something that happens on your machine.

A command that people paste is an input

Returning a command line created a second problem. The app id, the channel and the release note all come from the conversation, and a conversation can contain anything. Text that you hand back to be pasted into a terminal is text that will be run by a shell, so a release note like a quoted ampersand followed by another program name would turn a helpful suggestion into an injection.

The rules are deliberately narrow. The app id and the channel must be plain slugs: they start with a letter or a digit and contain only letters, digits, dots, dashes and underscores. If either one is not, no command is produced at all, and the text says what characters are allowed and points at ubriot_list_apps. The release note is optional, so it gets the gentler treatment. If it matches a short allow-list of ordinary punctuation it goes into the command inside double quotes. If it does not, the command is returned without it, and a line explains that the note was left out because it contains characters that are unsafe to paste into a shell and that you can add it with --message yourself.

const SAFE_IDENTIFIER = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
const SAFE_MESSAGE = /^[A-Za-z0-9][A-Za-z0-9 .,_\-\/()#']*$/;

Both patterns require the first character to be a letter or digit. That is not decoration: a value that begins with a dash would be read by the CLI as another flag, so an app id of -x is rejected the same way a semicolon is. A percent sign is outside the message allow-list too, which keeps shell expansion and URL-style escapes out of the pasted line. We would rather drop a note than quote it cleverly.

One more detail: an app id can arrive percent-encoded, so it is decoded once before the check. If the value cannot be decoded, it is checked as it came.

What the tests pin down

There are four tests, one per behaviour. The first asserts that the result starts with Nothing was published and contains the full command for a named app, channel and note. The second asserts the default channel is production and that an encoded app id comes out decoded. The third feeds the release note a list of nasty values, among them a quoted ampersand, a command substitution, backticks, a percent sign, a pipe and a leading dash, and asserts for each that the command is still there without the note and that the nasty text appears nowhere in the output. The fourth does the same for bad app ids and channels: no ubriot update line at all.

The third test is the one that matters, because it tests the absence of the string rather than the presence of a safe one. A test that only checks the happy path would keep passing if someone widened the allow-list to everything.

If you build tools for assistants

Two habits carry over. If an operation needs something the tool cannot reach, return the instruction for the place that can, and say plainly that nothing happened. And treat any string that you return for a human to run as input to a shell, with an allow-list, a narrow one, and a test for what must never appear. A refused note is a minor inconvenience. A pasted one could be anything.

Try Ubriot AI

React Native CI/CD from one CLI.

Get started