Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
automation.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <sonde/server.h>
9
10#include <QtCore/QObject>
11
12#include <functional>
13
14class NotesStore;
15
17class Asker
18{
19public:
21 Asker() = default;
23 virtual ~Asker() = default;
24 Q_DISABLE_COPY_MOVE(Asker)
25
26
28 virtual void askToConnect(const Sonde::SessionRequest &request) = 0;
29
33 virtual void askToDelete(const QString &title, const Sonde::ToolCall &call,
34 std::function<void(bool)> answer) = 0;
35};
36
42class Automation : public QObject
43{
44 Q_OBJECT
45public:
47 Automation(NotesStore *store, Asker *asker, QObject *parent = nullptr);
48
51 bool start(const QString &name);
53 void stop();
55 bool isRunning() const;
57 QString endpoint() const;
58
60 QList<Sonde::SessionInfo> clients() const;
62 void disconnectClient(const QString &id);
63
64Q_SIGNALS:
66 void runningChanged(bool running);
69
70private:
72 void addTools();
73
77};
Whatever asks the user: dialogs in the application, a script in its tests.
Definition automation.h:18
virtual ~Asker()=default
Destroys it.
Asker()=default
Creates it.
virtual void askToConnect(const Sonde::SessionRequest &request)=0
A client asks to connect: approve or deny request, now or later.
virtual void askToDelete(const QString &title, const Sonde::ToolCall &call, std::function< void(bool)> answer)=0
A client asks to delete note title, in tool call call: call answer with whether the user agreed,...
void stop()
Stops listening, and disconnects every client.
Definition automation.cpp:64
NotesStore * m_store
The notes.
Definition automation.h:74
Asker * m_asker
Asks the user.
Definition automation.h:75
void addTools()
Registers note_list, note_read, note_append and note_delete.
Definition automation.cpp:93
Automation(NotesStore *store, Asker *asker, QObject *parent=nullptr)
The interface over store, asking asker; not listening yet.
Definition automation.cpp:37
void clientsChanged()
A client was let in, or left.
bool isRunning() const
Whether it is listening.
Definition automation.cpp:73
void disconnectClient(const QString &id)
Disconnects client id.
Definition automation.cpp:88
bool start(const QString &name)
Starts listening on local socket name, which only this user can open.
Definition automation.cpp:54
QList< Sonde::SessionInfo > clients() const
The connected clients that were let in.
Definition automation.cpp:83
void runningChanged(bool running)
It started or stopped.
QString endpoint() const
The socket's full path or pipe name, for the user's MCP client.
Definition automation.cpp:78
Sonde::Server m_server
The MCP server.
Definition automation.h:76
The notes, in order, changed only through undoable commands, so a change made by an AI assistant can ...
Definition notesstore.h:22
An embeddable Model Context Protocol server.
Definition server.h:92
Embeddable Model Context Protocol server for Qt applications.
Definition dispatch.cpp:10
Sonde::Server, the embeddable MCP server.