Skip to main content

a2ui_types/v09/
capabilities.rs

1use serde::{Deserialize, Serialize};
2
3use super::catalog::Catalog;
4
5// ---------------------------------------------------------------------------
6// Client Capabilities
7// ---------------------------------------------------------------------------
8
9/// Client capabilities for v0.9, sent in A2A message metadata under `a2uiClientCapabilities`.
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11pub struct ClientCapabilities {
12    /// The capabilities structure for v0.9.
13    #[serde(rename = "v0.9")]
14    pub v09: ClientCapabilitiesV09,
15}
16
17/// The inner capabilities object for v0.9.
18#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
19pub struct ClientCapabilitiesV09 {
20    /// URIs of component and function catalogs supported by the client.
21    #[serde(rename = "supportedCatalogIds")]
22    pub supported_catalog_ids: Vec<String>,
23
24    /// Inline catalog definitions (only if the agent declares `acceptsInlineCatalogs: true`).
25    #[serde(rename = "inlineCatalogs", skip_serializing_if = "Option::is_none")]
26    pub inline_catalogs: Option<Vec<Catalog>>,
27}
28
29// ---------------------------------------------------------------------------
30// Server Capabilities
31// ---------------------------------------------------------------------------
32
33/// Server capabilities for v0.9, advertised via Agent Card or transport initialization.
34#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35pub struct ServerCapabilities {
36    /// The server capabilities structure for v0.9.
37    #[serde(rename = "v0.9")]
38    pub v09: ServerCapabilitiesV09,
39}
40
41/// The inner server capabilities object for v0.9.
42#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
43pub struct ServerCapabilitiesV09 {
44    /// Catalog IDs that the server can generate UI for.
45    #[serde(
46        rename = "supportedCatalogIds",
47        skip_serializing_if = "Option::is_none"
48    )]
49    pub supported_catalog_ids: Option<Vec<String>>,
50
51    /// Whether the server accepts inline catalogs from the client.
52    #[serde(
53        rename = "acceptsInlineCatalogs",
54        skip_serializing_if = "Option::is_none"
55    )]
56    pub accepts_inline_catalogs: Option<bool>,
57}