Refactoring move API in subdir
This commit is contained in:
parent
b5c3dd21e0
commit
a943ca055a
|
|
@ -1,4 +1,5 @@
|
||||||
#include "KompanionQtServer.hpp"
|
#include "KompanionQtServer.hpp"
|
||||||
|
#include "RegisterTools.hpp"
|
||||||
|
|
||||||
#include <QtMcpCommon/QMcpCallToolRequest>
|
#include <QtMcpCommon/QMcpCallToolRequest>
|
||||||
#include <QtMcpCommon/QMcpCallToolResult>
|
#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."));
|
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();
|
m_tools = loadToolsFromSchema();
|
||||||
|
|
||||||
addRequestHandler([this](const QUuid &, const QMcpListToolsRequest &, QMcpJSONRPCErrorError *) {
|
addRequestHandler([this](const QUuid &, const QMcpListToolsRequest &, QMcpJSONRPCErrorError *) {
|
||||||
|
|
@ -74,6 +81,7 @@ KompanionQtServer::KompanionQtServer(const QString &backend, KomMcpServer *logic
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString toolName = request.params().name();
|
const QString toolName = request.params().name();
|
||||||
|
qDebug() << "Requested tool:" << toolName;
|
||||||
const std::string toolKey = toolName.toStdString();
|
const std::string toolKey = toolName.toStdString();
|
||||||
if (!m_logic->hasTool(toolKey)) {
|
if (!m_logic->hasTool(toolKey)) {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,25 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtMcpServer/QMcpServer>
|
#include <QtMcpServer/QMcpServer>
|
||||||
#include <QtMcpCommon/QMcpTool>
|
#include <QtCore/QList>
|
||||||
#include "../dal/PgDal.hpp"
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
#include "KomMcpServer.hpp"
|
class KomMcpServer;
|
||||||
|
namespace kom {
|
||||||
#include <QList>
|
class PgDal;
|
||||||
|
}
|
||||||
|
class QMcpTool;
|
||||||
|
|
||||||
class KompanionQtServer : public QMcpServer
|
class KompanionQtServer : public QMcpServer
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
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:
|
private:
|
||||||
QList<QMcpTool> loadToolsFromSchema() const;
|
QList<QMcpTool> loadToolsFromSchema() const;
|
||||||
|
|
||||||
KomMcpServer *m_logic = nullptr;
|
KomMcpServer *m_logic;
|
||||||
kom::PgDal* m_dal = nullptr;
|
kom::PgDal* m_dal;
|
||||||
QList<QMcpTool> m_tools;
|
QList<QMcpTool> m_tools;
|
||||||
};
|
};
|
||||||
Loading…
Reference in New Issue