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

Function executeScriptDryRun

app/src/AI/ToolDispatcher.cpp:1191–1219  ·  view source on GitHub ↗

* @brief Dispatches a dry-run call to the matching scripting endpoint and attaches references. */

Source from the content-addressed store, hash-verified

1189 * @brief Dispatches a dry-run call to the matching scripting endpoint and attaches references.
1190 */
1191static QJsonObject executeScriptDryRun(const QJsonObject& args)
1192{
1193 const auto kind = args.value(QStringLiteral("kind")).toString();
1194 const auto code = args.value(QStringLiteral("code")).toString();
1195 const int language =
1196 args.contains(QStringLiteral("language")) ? args.value(QStringLiteral("language")).toInt() : 1;
1197
1198 QJsonObject dryArgs;
1199 if (!code.isEmpty())
1200 dryArgs[QStringLiteral("code")] = code;
1201
1202 const QString command = dryRunCommandForKind(kind, args, dryArgs, language);
1203 if (command.isEmpty()) {
1204 QJsonObject out;
1205 out[QStringLiteral("ok")] = false;
1206 out[QStringLiteral("error")] = QStringLiteral("unknown_script_kind");
1207 return out;
1208 }
1209
1210 auto reply = runCommand(command, dryArgs);
1211 reply[QStringLiteral("command")] = command;
1212 reply[QStringLiteral("arguments")] = dryArgs;
1213 const auto docsKind = scriptingDocKindForScriptKind(kind, language);
1214 if (!docsKind.isEmpty())
1215 reply[QStringLiteral("reference")] =
1216 QStringLiteral("meta.fetchScriptingDocs{kind:'%1'}").arg(docsKind);
1217
1218 return attachRepairHint(reply, command);
1219}
1220
1221/**
1222 * @brief Toggles the target dataset to virtual when the apply request asks for it.

Callers 2

executeScriptApplyFunction · 0.85
executeAssistantToolFunction · 0.85

Calls 7

runCommandFunction · 0.85
attachRepairHintFunction · 0.85
isEmptyMethod · 0.80
dryRunCommandForKindFunction · 0.70
valueMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected