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

Function runCommand

app/src/AI/ToolDispatcher.cpp:666–685  ·  view source on GitHub ↗

* @brief Executes an API command and wraps its response into an {ok,result|error} envelope. */

Source from the content-addressed store, hash-verified

664 * @brief Executes an API command and wraps its response into an {ok,result|error} envelope.
665 */
666static QJsonObject runCommand(const QString& name, const QJsonObject& args = {})
667{
668 const auto callId = QUuid::createUuid().toString(QUuid::WithoutBraces);
669 const auto response = API::CommandRegistry::instance().execute(name, callId, args);
670
671 QJsonObject reply;
672 reply[QStringLiteral("ok")] = response.success;
673 if (response.success)
674 reply[QStringLiteral("result")] = response.result;
675 else {
676 QJsonObject error;
677 error[QStringLiteral("code")] = response.errorCode;
678 error[QStringLiteral("message")] = response.errorMessage;
679 if (!response.errorData.isEmpty())
680 error[QStringLiteral("data")] = response.errorData;
681
682 reply[QStringLiteral("error")] = error;
683 }
684 return reply;
685}
686
687/**
688 * @brief Builds command-specific repair hints attached to failed tool replies.

Callers 15

resolveDatasetFunction · 0.85
resolveWorkspaceFunction · 0.85
resolveGroupFunction · 0.85
executeScriptDryRunFunction · 0.85
maybeMarkDatasetVirtualFunction · 0.85
applyTransformScriptFunction · 0.85
applyFrameParserScriptFunction · 0.85
applyPainterScriptFunction · 0.85
executeBulkApplyFunction · 0.85
createTileWorkspaceFunction · 0.85
enableTileWidgetOptionFunction · 0.85
applyTileRangeUpdatesFunction · 0.85

Calls 2

executeMethod · 0.80
isEmptyMethod · 0.80

Tested by

no test coverage detected