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

Method appendToolCallCard

app/src/AI/Conversation.cpp:1735–1764  ·  view source on GitHub ↗

* @brief Adds a ToolCallCard payload to the active assistant message. */

Source from the content-addressed store, hash-verified

1733 * @brief Adds a ToolCallCard payload to the active assistant message.
1734 */
1735void AI::Conversation::appendToolCallCard(const QString& callId,
1736 const QString& name,
1737 const QJsonObject& arguments,
1738 CallStatus status)
1739{
1740 if (m_assistantIndex < 0 || m_assistantIndex >= m_uiMessages.size())
1741 return;
1742
1743 auto map = m_uiMessages.at(m_assistantIndex).toMap();
1744 auto calls = map.value(QStringLiteral("toolCalls")).toList();
1745
1746 QString family = name;
1747 const int lastDot = family.lastIndexOf(QLatin1Char('.'));
1748 if (lastDot > 0)
1749 family.truncate(lastDot);
1750
1751 QVariantMap card;
1752 card[QStringLiteral("callId")] = callId;
1753 card[QStringLiteral("name")] = name;
1754 card[QStringLiteral("family")] = family;
1755 card[QStringLiteral("category")] = toolCallCategory(name);
1756 card[QStringLiteral("args")] = QJsonDocument(arguments).toJson(QJsonDocument::Indented);
1757 card[QStringLiteral("status")] = static_cast<int>(status);
1758 card[QStringLiteral("result")] = QString();
1759
1760 calls.append(card);
1761 map.insert(QStringLiteral("toolCalls"), calls);
1762 m_uiMessages[m_assistantIndex] = map;
1763 Q_EMIT messagesChanged();
1764}
1765
1766/**
1767 * @brief Updates the status (and optional result) of an existing ToolCallCard.

Callers

nothing calls this directly

Calls 5

toolCallCategoryFunction · 0.85
sizeMethod · 0.45
valueMethod · 0.45
toJsonMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected