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

Method generateToolsFromRegistry

app/src/API/MCPHandler.cpp:639–661  ·  view source on GitHub ↗

* @brief Generate MCP tools from CommandRegistry */

Source from the content-addressed store, hash-verified

637 * @brief Generate MCP tools from CommandRegistry
638 */
639QVector<API::MCP::Tool> API::MCPHandler::generateToolsFromRegistry() const
640{
641 QVector<MCP::Tool> tools;
642
643 const auto& commands = CommandRegistry::instance().commands();
644 for (auto it = commands.constBegin(); it != commands.constEnd(); ++it) {
645 const auto& name = it.key();
646 MCP::Tool tool;
647 tool.name = name;
648 tool.description = it.value().description;
649 tool.inputSchema = it.value().inputSchema.isEmpty()
650 ? QJsonObject{{QStringLiteral("type"), QStringLiteral("object")}}
651 : it.value().inputSchema;
652
653 const auto parts = name.split(QLatin1Char('.'));
654 if (parts.size() >= 2)
655 tagToolFromCommandName(tool, parts);
656
657 tools.append(tool);
658 }
659
660 return tools;
661}
662
663/**
664 * @brief Generate MCP resources

Callers

nothing calls this directly

Calls 5

keyMethod · 0.80
isEmptyMethod · 0.80
valueMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected