Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::JsonRpc Namespace Reference

JSON-RPC 2.0 message helpers. More...

Enumerations

enum  ErrorCode {
  ParseError = -32700 , InvalidRequest = -32600 , MethodNotFound = -32601 , InvalidParams = -32602 ,
  InternalError = -32603 , NotAdmitted = -32002
}
 Standard JSON-RPC error codes. More...

Functions

QJsonObject result (const QJsonValue &id, const QJsonValue &result)
 A success response.
QJsonObject error (const QJsonValue &id, int code, const QString &message, const QJsonValue &data={ })
 An error response (a missing id becomes null).
QJsonObject notification (const QString &method, const QJsonObject &params)
 A notification; params are omitted when empty.
bool isRequest (const QJsonObject &message)
 Whether message is a request (has both method and id).
bool expectsResponse (const QJsonObject &message)
 Whether message must be answered: it has an id and is not itself a response.

Detailed Description

JSON-RPC 2.0 message helpers.

Enumeration Type Documentation

◆ ErrorCode

Standard JSON-RPC error codes.

Enumerator
ParseError 

Invalid JSON.

InvalidRequest 

Not a valid request object.

MethodNotFound 

Unknown method.

InvalidParams 

Invalid method parameters.

InternalError 

Internal error.

NotAdmitted 

A request before the session was admitted (LSP's "server not initialized"; MCP defines none): initialize wasn't sent, or the client waits for approval (design 0033).