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

Method updateToolCallCard

app/src/AI/Conversation.cpp:1769–1798  ·  view source on GitHub ↗

* @brief Updates the status (and optional result) of an existing ToolCallCard. */

Source from the content-addressed store, hash-verified

1767 * @brief Updates the status (and optional result) of an existing ToolCallCard.
1768 */
1769void AI::Conversation::updateToolCallCard(const QString& callId,
1770 CallStatus status,
1771 const QJsonObject& result)
1772{
1773 for (int i = m_uiMessages.size() - 1; i >= 0; --i) {
1774 auto map = m_uiMessages.at(i).toMap();
1775 auto calls = map.value(QStringLiteral("toolCalls")).toList();
1776 bool changed = false;
1777 for (int c = 0; c < calls.size(); ++c) {
1778 auto card = calls.at(c).toMap();
1779 if (card.value(QStringLiteral("callId")).toString() != callId)
1780 continue;
1781
1782 card.insert(QStringLiteral("status"), static_cast<int>(status));
1783 if (!result.isEmpty())
1784 card.insert(QStringLiteral("result"),
1785 QString::fromUtf8(QJsonDocument(result).toJson(QJsonDocument::Indented)));
1786
1787 calls[c] = card;
1788 changed = true;
1789 break;
1790 }
1791 if (changed) {
1792 map.insert(QStringLiteral("toolCalls"), calls);
1793 m_uiMessages[i] = map;
1794 Q_EMIT messagesChanged();
1795 return;
1796 }
1797 }
1798}
1799
1800/**
1801 * @brief Executes a single tool call and feeds its result back.

Callers

nothing calls this directly

Calls 4

isEmptyMethod · 0.80
sizeMethod · 0.45
valueMethod · 0.45
toJsonMethod · 0.45

Tested by

no test coverage detected