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

Function executeAssistantTool

app/src/AI/ToolDispatcher.cpp:1787–1851  ·  view source on GitHub ↗

* @brief Top-level dispatcher for every assistant.* virtual tool name. */

Source from the content-addressed store, hash-verified

1785 * @brief Top-level dispatcher for every assistant.* virtual tool name.
1786 */
1787static QJsonObject executeAssistantTool(const QString& name, const QJsonObject& args)
1788{
1789 if (name == QStringLiteral("assistant.snapshot")) {
1790 QJsonObject snapArgs;
1791 if (args.contains(QStringLiteral("verbose")))
1792 snapArgs[QStringLiteral("verbose")] = args.value(QStringLiteral("verbose")).toBool();
1793
1794 const auto projectReply = runCommand(QStringLiteral("project.snapshot"), snapArgs);
1795 const auto workspaceReply = runCommand(QStringLiteral("project.workspace.list"));
1796 if (!projectReply.value(QStringLiteral("ok")).toBool())
1797 return projectReply;
1798
1799 QJsonObject out;
1800 out[QStringLiteral("ok")] = true;
1801 out[QStringLiteral("snapshot")] =
1802 compactProjectSnapshotResult(projectReply.value(QStringLiteral("result")).toObject(),
1803 workspaceReply.value(QStringLiteral("result")).toObject(),
1804 snapArgs.value(QStringLiteral("verbose")).toBool());
1805 out[QStringLiteral("identity")] =
1806 QStringLiteral("Dataset path/title/uniqueId are resolver inputs. Dataset mutations use "
1807 "{groupId,datasetId}. Workspace tiles use {workspaceId,widgetType,groupId}. "
1808 "Never derive uniqueId in chat.");
1809 return out;
1810 }
1811
1812 if (name == QStringLiteral("assistant.dataset.resolve"))
1813 return resolveDataset(args);
1814
1815 if (name == QStringLiteral("assistant.workspace.resolve"))
1816 return resolveWorkspace(args);
1817
1818 if (name == QStringLiteral("assistant.workspace.plan")) {
1819 QJsonObject out;
1820 out[QStringLiteral("ok")] = true;
1821 out[QStringLiteral("snapshot")] =
1822 executeAssistantTool(QStringLiteral("assistant.snapshot"), {});
1823 out[QStringLiteral("hint")] =
1824 QStringLiteral("Choose widgetType slugs already present in each group's "
1825 "compatibleWidgetTypes. For plot/fft/bar/gauge/compass/led/waterfall on a "
1826 "specific dataset, use assistant.workspace.addTile so options are enabled "
1827 "before the tile is pinned.");
1828 return out;
1829 }
1830
1831 if (name == QStringLiteral("assistant.workspace.addTile"))
1832 return executeAddTile(args);
1833
1834 if (name == QStringLiteral("assistant.script.dryRun"))
1835 return executeScriptDryRun(args);
1836
1837 if (name == QStringLiteral("assistant.script.apply"))
1838 return executeScriptApply(args);
1839
1840 if (name == QStringLiteral("assistant.project.bulkApply"))
1841 return executeBulkApply(args);
1842
1843 if (name == QStringLiteral("assistant.checkpoint") || name == QStringLiteral("assistant.restore")
1844 || name == QStringLiteral("assistant.listCheckpoints"))

Callers 1

executeCommandMethod · 0.85

Calls 10

runCommandFunction · 0.85
resolveDatasetFunction · 0.85
resolveWorkspaceFunction · 0.85
executeAddTileFunction · 0.85
executeScriptDryRunFunction · 0.85
executeScriptApplyFunction · 0.85
executeBulkApplyFunction · 0.85
containsMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected