Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::Cli::anonymous_namespace{client.cpp} Namespace Reference

Functions

QJsonObject rpc (int id, const QString &method, const QJsonObject &params)
 A JSON-RPC request.
std::optional< std::pair< QString, std::optional< QString > > > endpointRecord ()
 The "url" and "executable" of the nearest endpoint.json, from here upwards: sonde writes it with this checkout's endpoints, so with several checkouts each reaches its own copy.
QString freeImagePath (const QString &ext)
 A file name for an image no earlier call saved: sonde-N.
void printResult (const QJsonObject &result, const QString &image)
 Prints the content of tool result result: text as it is, images saved to files (the first one to image, if given, else each to a new name), with the time each was saved, so an image read later can be told from an older one.
void describeTools (Client &client, const QStringList &names)
 sonde describe: each named tool (or every tool) in full.

Variables

constexpr QLatin1StringView kDefaultUrl { "http://127.0.0.1:8765/mcp" }
 How long a request may take, in milliseconds: a tool may wait for up to 5 minutes.

Function Documentation

◆ endpointRecord()

std::optional< std::pair< QString, std::optional< QString > > > Sonde::Cli::anonymous_namespace{client.cpp}::endpointRecord ( )

The "url" and "executable" of the nearest endpoint.json, from here upwards: sonde writes it with this checkout's endpoints, so with several checkouts each reaches its own copy.

Nothing if there is none with a URL.

◆ freeImagePath()

QString Sonde::Cli::anonymous_namespace{client.cpp}::freeImagePath ( const QString & ext)

A file name for an image no earlier call saved: sonde-N.

ext with the lowest N not taken. Reusing a name would let a viewer that caches by path show an old image.

◆ printResult()

void Sonde::Cli::anonymous_namespace{client.cpp}::printResult ( const QJsonObject & result,
const QString & image )

Prints the content of tool result result: text as it is, images saved to files (the first one to image, if given, else each to a new name), with the time each was saved, so an image read later can be told from an older one.

Exits with 1 if it is an error.

Variable Documentation

◆ kDefaultUrl

QLatin1StringView Sonde::Cli::anonymous_namespace{client.cpp}::kDefaultUrl { "http://127.0.0.1:8765/mcp" }
constexpr

How long a request may take, in milliseconds: a tool may wait for up to 5 minutes.

The server sonde calls when nothing else names one.