Skip to main content
Metadata
FieldValue
Canonical URIhttps://docs.aion.to/extensions/aion/context/get-contexts/1.0.0
Issueraion
Version1.0.0
ActivationAvailable on all A2A agent servers. No explicit activation required.
Related MethodsGetContext

Overview

GetContexts is a JSON-RPC method that returns a paginated list of available conversation context identifiers. Use the returned IDs with GetContext to retrieve full conversation history.

Request

{
  "jsonrpc": "2.0",
  "id": "request-id",
  "method": "GetContexts",
  "params": {
    "historyLength": 50,
    "historyOffset": 0
  }
}

Parameters

FieldTypeRequiredDescription
historyLengthIntegeroptionalMaximum number of contexts to return. Defaults to server-defined limit.
historyOffsetIntegeroptionalNumber of most-recent contexts to skip before returning results. Defaults to 0.

Response

Success

{
  "jsonrpc": "2.0",
  "id": "request-id",
  "result": [
    "conversation-123",
    "conversation-456",
    "conversation-789"
  ]
}
The result field contains a ContextsList — an ordered array of context_id strings, most recent first. Each ID can be passed to GetContext to retrieve the full conversation.

Error

{
  "jsonrpc": "2.0",
  "id": "request-id",
  "error": {
    "code": -32000,
    "message": "Server error description",
    "data": {}
  }
}
Error handling follows the JSON-RPC 2.0 specification.

Usage Example

# Retrieve the 20 most recent context identifiers
request = {
    "jsonrpc": "2.0",
    "id": "list-contexts-1",
    "method": "GetContexts",
    "params": {
        "historyLength": 20
    }
}

Pagination

Both historyLength and historyOffset work together to paginate through large context lists:
page = 0
page_size = 20

request = {
    "jsonrpc": "2.0",
    "id": f"list-contexts-page-{page}",
    "method": "GetContexts",
    "params": {
        "historyLength": page_size,
        "historyOffset": page * page_size
    }
}