Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
client.cpp File Reference

Calling tools from the command line over HTTP (was mcpcall.py). More...

#include "client.h"
#include "common.h"
#include "describe.h"
#include "project.h"
#include <QtCore/QCryptographicHash>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QTime>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
#include <utility>

Namespaces

namespace  Sonde
 Embeddable Model Context Protocol server for Qt applications.

Functions

QJsonObject Sonde::Cli::anonymous_namespace{client.cpp}::rpc (int id, const QString &method, const QJsonObject &params)
 A JSON-RPC request.
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.
QString Sonde::Cli::anonymous_namespace{client.cpp}::freeImagePath (const QString &ext)
 A file name for an image no earlier call saved: sonde-N.
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.
void Sonde::Cli::anonymous_namespace{client.cpp}::describeTools (Client &client, const QStringList &names)
 sonde describe: each named tool (or every tool) in full.
Client Sonde::Cli::clientFrom (const Options &options)
 The client sonde uses with options: –url, $SONDE_URL, this checkout's endpoint.json, or the default.
void Sonde::Cli::toolsCommand (const Options &options, const QString &command, const QStringList &rest)
 sonde tools, describe, call and session, with the arguments after the command in rest.

Variables

constexpr QLatin1StringView Sonde::Cli::anonymous_namespace{client.cpp}::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.

Detailed Description

Calling tools from the command line over HTTP (was mcpcall.py).