MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / makeBlockedReply

Function makeBlockedReply

app/src/AI/ToolDispatcher.cpp:2183–2201  ·  view source on GitHub ↗

* @brief Builds the Blocked-tool rejection reply, with a device-control repair hint. */

Source from the content-addressed store, hash-verified

2181 * @brief Builds the Blocked-tool rejection reply, with a device-control repair hint.
2182 */
2183static QJsonObject makeBlockedReply(const QString& name)
2184{
2185 qCWarning(AI::serialStudioAI) << "Tool execution blocked:" << name;
2186 QJsonObject error;
2187 error[QStringLiteral("code")] = QStringLiteral("blocked");
2188 error[QStringLiteral("message")] = QStringLiteral("This command is blocked for AI safety.");
2189 if (AI::CommandRegistry::instance().isDeviceGated(name)) {
2190 error[QStringLiteral("repair")] =
2191 QStringLiteral("Hardware writes and connection changes must be performed by the user "
2192 "unless they enable the 'Allow device control' checkbox in the AI panel. "
2193 "Offer to build an Output Control tile instead; mention the checkbox only "
2194 "if the user explicitly wants you to drive the device.");
2195 }
2196
2197 QJsonObject reply;
2198 reply[QStringLiteral("ok")] = false;
2199 reply[QStringLiteral("error")] = error;
2200 return reply;
2201}
2202
2203/**
2204 * @brief Validates args and forwards to API::CommandRegistry honoring AI safety tags.

Callers 1

executeCommandMethod · 0.85

Calls 1

isDeviceGatedMethod · 0.80

Tested by

no test coverage detected