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

Function executeFsTool

app/src/AI/ToolDispatcher.cpp:617–642  ·  view source on GitHub ↗

* @brief Routes an fs.* tool call to the FileSandbox primitive. */

Source from the content-addressed store, hash-verified

615 * @brief Routes an fs.* tool call to the FileSandbox primitive.
616 */
617static QJsonObject executeFsTool(const QString& name, const QJsonObject& args)
618{
619 auto& sandbox = AI::FileSandbox::instance();
620 if (name == QStringLiteral("fs.list"))
621 return runOffMainThread([&]() { return sandbox.list(args); });
622
623 if (name == QStringLiteral("fs.read"))
624 return runOffMainThread([&]() { return sandbox.read(args); });
625
626 if (name == QStringLiteral("fs.search"))
627 return runOffMainThread([&]() { return sandbox.search(args); });
628
629 if (name == QStringLiteral("fs.write"))
630 return sandbox.write(args);
631
632 if (name == QStringLiteral("fs.append"))
633 return sandbox.append(args);
634
635 if (name == QStringLiteral("fs.delete"))
636 return sandbox.remove(args);
637
638 QJsonObject out;
639 out[QStringLiteral("ok")] = false;
640 out[QStringLiteral("error")] = QStringLiteral("unknown_fs_tool");
641 return out;
642}
643
644/**
645 * @brief Returns the metadata block for an assistant.* tool, or empty if none matches.

Callers 1

executeCommandMethod · 0.85

Calls 7

runOffMainThreadFunction · 0.85
listMethod · 0.45
readMethod · 0.45
searchMethod · 0.45
writeMethod · 0.45
appendMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected