Documentation
¶
Overview ¶
Package jsonrpc provides JSON-RPC 2.0 protocol implementation for A2A.
Index ¶
Constants ¶
View Source
const ( Version = "2.0" // HTTP headers ContentJSON = "application/json" // JSON-RPC method names per A2A spec §7 MethodMessageSend = "SendMessage" MethodMessageStream = "SendStreamingMessage" MethodTasksGet = "GetTask" MethodTasksList = "ListTasks" MethodTasksCancel = "CancelTask" MethodTasksResubscribe = "SubscribeToTask" MethodPushConfigGet = "GetTaskPushNotificationConfig" MethodPushConfigSet = "CreateTaskPushNotificationConfig" MethodPushConfigList = "ListTaskPushNotificationConfigs" MethodPushConfigDelete = "DeleteTaskPushNotificationConfig" MethodGetExtendedAgentCard = "GetExtendedAgentCard" )
JSON-RPC 2.0 protocol constants
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientRequest ¶
type ClientRequest struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params any `json:"params,omitempty"`
ID string `json:"id"`
}
ClientRequest represents a JSON-RPC 2.0 client request.
type ClientResponse ¶
type ClientResponse struct {
JSONRPC string `json:"jsonrpc"`
ID string `json:"id"`
Result json.RawMessage `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
ClientResponse represents a JSON-RPC 2.0 client response.
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data map[string]any `json:"data,omitempty"`
}
Error represents a JSON-RPC 2.0 error object. TODO(yarolegovich): Convert to transport-agnostic error format so Client can use errors.Is(err, a2a.ErrMethodNotFound). This needs to be implemented across all transports (currently not in grpc either).
func ToJSONRPCError ¶
ToJSONRPCError converts an error to a JSON-RPC Error.
func (*Error) ToA2AError ¶
ToA2AError converts a JSON-RPC error to an a2a.Error.
type ServerRequest ¶
type ServerRequest struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
ID any `json:"id"`
}
ServerRequest represents a JSON-RPC 2.0 server request.
Click to show internal directories.
Click to hide internal directories.