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

Function makeRepairHint

app/src/AI/ToolDispatcher.cpp:690–723  ·  view source on GitHub ↗

* @brief Builds command-specific repair hints attached to failed tool replies. */

Source from the content-addressed store, hash-verified

688 * @brief Builds command-specific repair hints attached to failed tool replies.
689 */
690static QJsonObject makeRepairHint(const QString& name, const QString& message)
691{
692 QJsonObject repair;
693 if (name == QStringLiteral("project.workspace.addWidget")
694 || name == QStringLiteral("assistant.workspace.addTile")) {
695 repair[QStringLiteral("next")] =
696 QStringLiteral("Call assistant.snapshot, then assistant.workspace.addTile with a valid "
697 "workspaceId, groupId, widgetType slug, and dataset identifier if the "
698 "group lacks that widget compatibility.");
699 repair[QStringLiteral("identityReminder")] =
700 QStringLiteral("workspaceId identifies a workspace; groupId identifies a group; "
701 "datasetId is only scoped within a group; uniqueId is opaque.");
702 }
703
704 if (message.contains(QStringLiteral("customizeWorkspaces"), Qt::CaseInsensitive))
705 repair[QStringLiteral("customizeMode")] =
706 QStringLiteral("Run project.workspace.setCustomizeMode{enabled:true} before workspace "
707 "mutations.");
708
709 if (name.contains(QStringLiteral("dryRun")) || name.contains(QStringLiteral("script"))) {
710 repair[QStringLiteral("scriptWorkflow")] =
711 QStringLiteral("Fetch the matching scripting reference, fix the code, run "
712 "assistant.script.dryRun again, then apply only after dry-run succeeds.");
713 }
714
715 if (name == QStringLiteral("project.batch")
716 || name == QStringLiteral("assistant.project.bulkApply")) {
717 repair[QStringLiteral("batchShape")] =
718 QStringLiteral("Use ops:[{command:'project.dataset.update', params:{...}}, ...]. "
719 "Do not put params at the op top level and do not nest project.batch.");
720 }
721
722 return repair;
723}
724
725/**
726 * @brief Merges a repair hint into the error object of a failed reply.

Callers 2

attachRepairHintFunction · 0.85
executeCommandMethod · 0.85

Calls 1

containsMethod · 0.45

Tested by

no test coverage detected