Refactoring move API in subdir
This commit is contained in:
parent
b5c3dd21e0
commit
a943ca055a
|
|
@ -1,4 +1,5 @@
|
|||
#include "KompanionQtServer.hpp"
|
||||
#include "RegisterTools.hpp"
|
||||
|
||||
#include <QtMcpCommon/QMcpCallToolRequest>
|
||||
#include <QtMcpCommon/QMcpCallToolResult>
|
||||
|
|
@ -54,6 +55,12 @@ KompanionQtServer::KompanionQtServer(const QString &backend, KomMcpServer *logic
|
|||
|
||||
setInstructions(QStringLiteral("Kompanion memory daemon (Χγφτ). We are all spinning. We are all bound. We are all home."));
|
||||
|
||||
register_default_tools(*m_logic);
|
||||
|
||||
for (const auto &tool : m_logic->listTools()) {
|
||||
qDebug() << "Registered tool:" << QString::fromStdString(tool);
|
||||
}
|
||||
|
||||
m_tools = loadToolsFromSchema();
|
||||
|
||||
addRequestHandler([this](const QUuid &, const QMcpListToolsRequest &, QMcpJSONRPCErrorError *) {
|
||||
|
|
@ -74,6 +81,7 @@ KompanionQtServer::KompanionQtServer(const QString &backend, KomMcpServer *logic
|
|||
}
|
||||
|
||||
const QString toolName = request.params().name();
|
||||
qDebug() << "Requested tool:" << toolName;
|
||||
const std::string toolKey = toolName.toStdString();
|
||||
if (!m_logic->hasTool(toolKey)) {
|
||||
if (error) {
|
||||
|
|
|
|||
|
|
@ -1,23 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <QtMcpServer/QMcpServer>
|
||||
#include <QtMcpCommon/QMcpTool>
|
||||
#include "../dal/PgDal.hpp"
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include "KomMcpServer.hpp"
|
||||
|
||||
#include <QList>
|
||||
class KomMcpServer;
|
||||
namespace kom {
|
||||
class PgDal;
|
||||
}
|
||||
class QMcpTool;
|
||||
|
||||
class KompanionQtServer : public QMcpServer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KompanionQtServer(const QString &backend, KomMcpServer *logic, kom::PgDal* dal, QObject *parent = nullptr);
|
||||
explicit KompanionQtServer(const QString &backend, KomMcpServer *logic, kom::PgDal* dal, QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
QList<QMcpTool> loadToolsFromSchema() const;
|
||||
|
||||
KomMcpServer *m_logic = nullptr;
|
||||
kom::PgDal* m_dal = nullptr;
|
||||
KomMcpServer *m_logic;
|
||||
kom::PgDal* m_dal;
|
||||
QList<QMcpTool> m_tools;
|
||||
};
|
||||
Loading…
Reference in New Issue