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

Method describeCommand

app/src/AI/ToolDispatcher.cpp:2152–2174  ·  view source on GitHub ↗

* @brief Returns the metadata block for a single command, or an empty object. */

Source from the content-addressed store, hash-verified

2150 * @brief Returns the metadata block for a single command, or an empty object.
2151 */
2152QJsonObject AI::ToolDispatcher::describeCommand(const QString& requestedName) const
2153{
2154 const QString name = canonicalToolName(requestedName);
2155 if (isAssistantTool(name))
2156 return assistantToolDescription(name);
2157
2158 if (isFsTool(name))
2159 return fsToolDescription(name);
2160
2161 const auto& commands = API::CommandRegistry::instance().commands();
2162 const auto it = commands.constFind(name);
2163 if (it == commands.constEnd())
2164 return {};
2165
2166 if (AI::CommandRegistry::instance().safetyOf(name) == Safety::Blocked)
2167 return {};
2168
2169 QJsonObject desc;
2170 desc[QStringLiteral("name")] = it.value().name;
2171 desc[QStringLiteral("description")] = it.value().description;
2172 desc[QStringLiteral("inputSchema")] = it.value().inputSchema;
2173 return desc;
2174}
2175
2176//--------------------------------------------------------------------------------------------------
2177// Dispatch

Callers 1

runMetaDescribeMethod · 0.80

Calls 6

isAssistantToolFunction · 0.85
assistantToolDescriptionFunction · 0.85
isFsToolFunction · 0.85
fsToolDescriptionFunction · 0.85
safetyOfMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected