|
Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
|
An MCP client that checks what comes back (invariants 2 and 3). More...
Public Member Functions | |
| Client (Verdict *verdict, QElapsedTimer *clock) | |
Reports violations to verdict, timing requests with clock. | |
| virtual bool | connected () const =0 |
| Whether it can still send. | |
| virtual QString | kind () const =0 |
| The transport's name, for the log. | |
| int | send (const QString &method, const QJsonObject ¶ms={ }, const QString &tool={ }) |
| Sends a request; returns its id. | |
| void | notify (const QString &method, const QJsonObject ¶ms={ }) |
| Sends a notification. | |
| void | cancel (int id) |
Cancels request id, if it is still pending. | |
| QList< int > | pendingIds () const |
| Ids still waiting for an answer. | |
| void | checkTimeouts () const |
| Fails the verdict for requests unanswered past the timeout (cancelled ones aside). | |
| bool | settled () const |
| Whether everything not cancelled has been answered. | |
| virtual void | disconnectNow () |
| Drops the connection: pending requests are forgotten (no answer is owed). | |
| QStringList | takeTexts () |
| The texts of the last results, for harvesting ids and window titles. | |
Public Attributes | |
| QJsonArray | tools |
| The last tools/list result. | |
| int | results = 0 |
| tools/call results received. | |
| int | toolErrors = 0 |
| Of those, the ones with isError. | |
Protected Member Functions | |
| virtual void | transmit (const QJsonObject &message, int id)=0 |
Sends message; id is its request id, or -1 for a notification. | |
| void | fail (const QString &what) const |
| Records a violation. | |
| void | forget (int id) |
Forgets request id: its answer will never come, and none is owed. | |
| void | handle (const QByteArray &bytes) |
| Checks one message from the server. | |
Static Protected Member Functions | |
| static QJsonObject | initializeParams () |
| The initialize request's parameters. | |
Private Attributes | |
| QHash< int, Pending > | m_pending |
| Requests awaiting an answer. | |
| QStringList | m_texts |
| Text results not yet taken. | |
| int | m_nextId = 1 |
| Next request id. | |
| Verdict * | m_verdict |
| Where violations go. | |
| QElapsedTimer * | m_clock |
| The run's clock. | |
An MCP client that checks what comes back (invariants 2 and 3).
Subclasses carry the messages: the local socket, or HTTP.
|
pure virtual |
Whether it can still send.
Implemented in anonymous_namespace{main.cpp}::HttpClient, and anonymous_namespace{main.cpp}::LocalClient.
|
inlinevirtual |
Drops the connection: pending requests are forgotten (no answer is owed).
Reimplemented in anonymous_namespace{main.cpp}::HttpClient, and anonymous_namespace{main.cpp}::LocalClient.
|
pure virtual |
The transport's name, for the log.
Implemented in anonymous_namespace{main.cpp}::HttpClient, and anonymous_namespace{main.cpp}::LocalClient.
|
protectedpure virtual |
Sends message; id is its request id, or -1 for a notification.
Implemented in anonymous_namespace{main.cpp}::HttpClient, and anonymous_namespace{main.cpp}::LocalClient.