diff --git a/agent-client-protocol-schema/src/v2/content.rs b/agent-client-protocol-schema/src/v2/content.rs index 55a6c446a..d3bf2c08f 100644 --- a/agent-client-protocol-schema/src/v2/content.rs +++ b/agent-client-protocol-schema/src/v2/content.rs @@ -149,13 +149,13 @@ fn other_content_block_schema(schema: &mut Schema) { #[derive(Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema)] #[non_exhaustive] pub struct TextContent { + /// Text payload carried by this content block. + pub text: String, /// Optional annotations that help clients decide how to display or route this content. #[serde_as(deserialize_as = "DefaultOnError")] #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] pub annotations: Option, - /// Text payload carried by this content block. - pub text: String, /// The _meta property is reserved by ACP to allow clients and agents to attach additional /// metadata to their interactions. Implementations MUST NOT make assumptions about values at /// these keys. @@ -211,11 +211,6 @@ impl> From for ContentBlock { #[serde(rename_all = "camelCase")] #[non_exhaustive] pub struct ImageContent { - /// Optional annotations that help clients decide how to display or route this content. - #[serde_as(deserialize_as = "DefaultOnError")] - #[schemars(extend("x-deserialize-default-on-error" = true))] - #[serde(default)] - pub annotations: Option, /// Base64-encoded media payload. pub data: String, /// MIME type describing the encoded media payload. @@ -225,6 +220,11 @@ pub struct ImageContent { #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] pub uri: Option, + /// Optional annotations that help clients decide how to display or route this content. + #[serde_as(deserialize_as = "DefaultOnError")] + #[schemars(extend("x-deserialize-default-on-error" = true))] + #[serde(default)] + pub annotations: Option, /// The _meta property is reserved by ACP to allow clients and agents to attach additional /// metadata to their interactions. Implementations MUST NOT make assumptions about values at /// these keys. @@ -283,15 +283,15 @@ impl ImageContent { #[serde(rename_all = "camelCase")] #[non_exhaustive] pub struct AudioContent { + /// Base64-encoded media payload. + pub data: String, + /// MIME type describing the encoded media payload. + pub mime_type: String, /// Optional annotations that help clients decide how to display or route this content. #[serde_as(deserialize_as = "DefaultOnError")] #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] pub annotations: Option, - /// Base64-encoded media payload. - pub data: String, - /// MIME type describing the encoded media payload. - pub mime_type: String, /// The _meta property is reserved by ACP to allow clients and agents to attach additional /// metadata to their interactions. Implementations MUST NOT make assumptions about values at /// these keys. @@ -341,13 +341,13 @@ impl AudioContent { #[derive(Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema)] #[non_exhaustive] pub struct EmbeddedResource { + /// Embedded resource payload, either text or binary data. + pub resource: EmbeddedResourceResource, /// Optional annotations that help clients decide how to display or route this content. #[serde_as(deserialize_as = "DefaultOnError")] #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] pub annotations: Option, - /// Embedded resource payload, either text or binary data. - pub resource: EmbeddedResourceResource, /// The _meta property is reserved by ACP to allow clients and agents to attach additional /// metadata to their interactions. Implementations MUST NOT make assumptions about values at /// these keys. @@ -408,15 +408,15 @@ pub enum EmbeddedResourceResource { #[serde(rename_all = "camelCase")] #[non_exhaustive] pub struct TextResourceContents { + /// Text payload carried by this content block. + pub text: String, + /// URI associated with this resource or media payload. + pub uri: String, /// MIME type describing the encoded media payload. #[serde_as(deserialize_as = "DefaultOnError")] #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] pub mime_type: Option, - /// Text payload carried by this content block. - pub text: String, - /// URI associated with this resource or media payload. - pub uri: String, /// The _meta property is reserved by ACP to allow clients and agents to attach additional /// metadata to their interactions. Implementations MUST NOT make assumptions about values at /// these keys. @@ -469,13 +469,13 @@ impl TextResourceContents { pub struct BlobResourceContents { /// Base64-encoded bytes for a binary resource payload. pub blob: String, + /// URI associated with this resource or media payload. + pub uri: String, /// MIME type describing the encoded media payload. #[serde_as(deserialize_as = "DefaultOnError")] #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] pub mime_type: Option, - /// URI associated with this resource or media payload. - pub uri: String, /// The _meta property is reserved by ACP to allow clients and agents to attach additional /// metadata to their interactions. Implementations MUST NOT make assumptions about values at /// these keys. @@ -526,11 +526,15 @@ impl BlobResourceContents { #[serde(rename_all = "camelCase")] #[non_exhaustive] pub struct ResourceLink { - /// Optional annotations that help clients decide how to display or route this content. + /// Human-readable name shown for this protocol object. + pub name: String, + /// URI associated with this resource or media payload. + pub uri: String, + /// Optional display title for end-user UI. #[serde_as(deserialize_as = "DefaultOnError")] #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] - pub annotations: Option, + pub title: Option, /// Optional human-readable details shown with this protocol object. #[serde_as(deserialize_as = "DefaultOnError")] #[schemars(extend("x-deserialize-default-on-error" = true))] @@ -541,20 +545,16 @@ pub struct ResourceLink { #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] pub mime_type: Option, - /// Human-readable name shown for this protocol object. - pub name: String, /// Optional size of the linked resource in bytes, if known. #[serde_as(deserialize_as = "DefaultOnError")] #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] pub size: Option, - /// Optional display title for end-user UI. + /// Optional annotations that help clients decide how to display or route this content. #[serde_as(deserialize_as = "DefaultOnError")] #[schemars(extend("x-deserialize-default-on-error" = true))] #[serde(default)] - pub title: Option, - /// URI associated with this resource or media payload. - pub uri: String, + pub annotations: Option, /// The _meta property is reserved by ACP to allow clients and agents to attach additional /// metadata to their interactions. Implementations MUST NOT make assumptions about values at /// these keys. diff --git a/schema/v2/schema.json b/schema/v2/schema.json index ede20c7b6..b64fae566 100644 --- a/schema/v2/schema.json +++ b/schema/v2/schema.json @@ -980,6 +980,10 @@ "description": "Text provided to or from an LLM.", "type": "object", "properties": { + "text": { + "description": "Text payload carried by this content block.", + "type": "string" + }, "annotations": { "description": "Optional annotations that help clients decide how to display or route this content.", "anyOf": [ @@ -992,10 +996,6 @@ ], "x-deserialize-default-on-error": true }, - "text": { - "description": "Text payload carried by this content block.", - "type": "string" - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/extensibility)", "type": ["object", "null"], @@ -1009,18 +1009,6 @@ "description": "An image provided to or from an LLM.", "type": "object", "properties": { - "annotations": { - "description": "Optional annotations that help clients decide how to display or route this content.", - "anyOf": [ - { - "$ref": "#/$defs/Annotations" - }, - { - "type": "null" - } - ], - "x-deserialize-default-on-error": true - }, "data": { "description": "Base64-encoded media payload.", "type": "string" @@ -1034,6 +1022,18 @@ "type": ["string", "null"], "x-deserialize-default-on-error": true }, + "annotations": { + "description": "Optional annotations that help clients decide how to display or route this content.", + "anyOf": [ + { + "$ref": "#/$defs/Annotations" + }, + { + "type": "null" + } + ], + "x-deserialize-default-on-error": true + }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/extensibility)", "type": ["object", "null"], @@ -1047,6 +1047,14 @@ "description": "Audio provided to or from an LLM.", "type": "object", "properties": { + "data": { + "description": "Base64-encoded media payload.", + "type": "string" + }, + "mimeType": { + "description": "MIME type describing the encoded media payload.", + "type": "string" + }, "annotations": { "description": "Optional annotations that help clients decide how to display or route this content.", "anyOf": [ @@ -1059,14 +1067,6 @@ ], "x-deserialize-default-on-error": true }, - "data": { - "description": "Base64-encoded media payload.", - "type": "string" - }, - "mimeType": { - "description": "MIME type describing the encoded media payload.", - "type": "string" - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/extensibility)", "type": ["object", "null"], @@ -1080,16 +1080,17 @@ "description": "A resource that the server is capable of reading, included in a prompt or tool call result.", "type": "object", "properties": { - "annotations": { - "description": "Optional annotations that help clients decide how to display or route this content.", - "anyOf": [ - { - "$ref": "#/$defs/Annotations" - }, - { - "type": "null" - } - ], + "name": { + "description": "Human-readable name shown for this protocol object.", + "type": "string" + }, + "uri": { + "description": "URI associated with this resource or media payload.", + "type": "string" + }, + "title": { + "description": "Optional display title for end-user UI.", + "type": ["string", "null"], "x-deserialize-default-on-error": true }, "description": { @@ -1102,25 +1103,24 @@ "type": ["string", "null"], "x-deserialize-default-on-error": true }, - "name": { - "description": "Human-readable name shown for this protocol object.", - "type": "string" - }, "size": { "description": "Optional size of the linked resource in bytes, if known.", "type": ["integer", "null"], "format": "int64", "x-deserialize-default-on-error": true }, - "title": { - "description": "Optional display title for end-user UI.", - "type": ["string", "null"], + "annotations": { + "description": "Optional annotations that help clients decide how to display or route this content.", + "anyOf": [ + { + "$ref": "#/$defs/Annotations" + }, + { + "type": "null" + } + ], "x-deserialize-default-on-error": true }, - "uri": { - "description": "URI associated with this resource or media payload.", - "type": "string" - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/extensibility)", "type": ["object", "null"], @@ -1157,11 +1157,6 @@ "description": "Text-based resource contents.", "type": "object", "properties": { - "mimeType": { - "description": "MIME type describing the encoded media payload.", - "type": ["string", "null"], - "x-deserialize-default-on-error": true - }, "text": { "description": "Text payload carried by this content block.", "type": "string" @@ -1170,6 +1165,11 @@ "description": "URI associated with this resource or media payload.", "type": "string" }, + "mimeType": { + "description": "MIME type describing the encoded media payload.", + "type": ["string", "null"], + "x-deserialize-default-on-error": true + }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/extensibility)", "type": ["object", "null"], @@ -1187,15 +1187,15 @@ "description": "Base64-encoded bytes for a binary resource payload.", "type": "string" }, + "uri": { + "description": "URI associated with this resource or media payload.", + "type": "string" + }, "mimeType": { "description": "MIME type describing the encoded media payload.", "type": ["string", "null"], "x-deserialize-default-on-error": true }, - "uri": { - "description": "URI associated with this resource or media payload.", - "type": "string" - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/extensibility)", "type": ["object", "null"], @@ -1209,6 +1209,14 @@ "description": "The contents of a resource, embedded into a prompt or tool call result.", "type": "object", "properties": { + "resource": { + "description": "Embedded resource payload, either text or binary data.", + "allOf": [ + { + "$ref": "#/$defs/EmbeddedResourceResource" + } + ] + }, "annotations": { "description": "Optional annotations that help clients decide how to display or route this content.", "anyOf": [ @@ -1221,14 +1229,6 @@ ], "x-deserialize-default-on-error": true }, - "resource": { - "description": "Embedded resource payload, either text or binary data.", - "allOf": [ - { - "$ref": "#/$defs/EmbeddedResourceResource" - } - ] - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/extensibility)", "type": ["object", "null"], diff --git a/schema/v2/schema.unstable.json b/schema/v2/schema.unstable.json index 17297c6aa..60cdcb14a 100644 --- a/schema/v2/schema.unstable.json +++ b/schema/v2/schema.unstable.json @@ -1179,6 +1179,10 @@ "description": "Text provided to or from an LLM.", "type": "object", "properties": { + "text": { + "description": "Text payload carried by this content block.", + "type": "string" + }, "annotations": { "description": "Optional annotations that help clients decide how to display or route this content.", "anyOf": [ @@ -1191,10 +1195,6 @@ ], "x-deserialize-default-on-error": true }, - "text": { - "description": "Text payload carried by this content block.", - "type": "string" - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", "type": ["object", "null"], @@ -1208,18 +1208,6 @@ "description": "An image provided to or from an LLM.", "type": "object", "properties": { - "annotations": { - "description": "Optional annotations that help clients decide how to display or route this content.", - "anyOf": [ - { - "$ref": "#/$defs/Annotations" - }, - { - "type": "null" - } - ], - "x-deserialize-default-on-error": true - }, "data": { "description": "Base64-encoded media payload.", "type": "string" @@ -1233,6 +1221,18 @@ "type": ["string", "null"], "x-deserialize-default-on-error": true }, + "annotations": { + "description": "Optional annotations that help clients decide how to display or route this content.", + "anyOf": [ + { + "$ref": "#/$defs/Annotations" + }, + { + "type": "null" + } + ], + "x-deserialize-default-on-error": true + }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", "type": ["object", "null"], @@ -1246,6 +1246,14 @@ "description": "Audio provided to or from an LLM.", "type": "object", "properties": { + "data": { + "description": "Base64-encoded media payload.", + "type": "string" + }, + "mimeType": { + "description": "MIME type describing the encoded media payload.", + "type": "string" + }, "annotations": { "description": "Optional annotations that help clients decide how to display or route this content.", "anyOf": [ @@ -1258,14 +1266,6 @@ ], "x-deserialize-default-on-error": true }, - "data": { - "description": "Base64-encoded media payload.", - "type": "string" - }, - "mimeType": { - "description": "MIME type describing the encoded media payload.", - "type": "string" - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", "type": ["object", "null"], @@ -1279,16 +1279,17 @@ "description": "A resource that the server is capable of reading, included in a prompt or tool call result.", "type": "object", "properties": { - "annotations": { - "description": "Optional annotations that help clients decide how to display or route this content.", - "anyOf": [ - { - "$ref": "#/$defs/Annotations" - }, - { - "type": "null" - } - ], + "name": { + "description": "Human-readable name shown for this protocol object.", + "type": "string" + }, + "uri": { + "description": "URI associated with this resource or media payload.", + "type": "string" + }, + "title": { + "description": "Optional display title for end-user UI.", + "type": ["string", "null"], "x-deserialize-default-on-error": true }, "description": { @@ -1301,25 +1302,24 @@ "type": ["string", "null"], "x-deserialize-default-on-error": true }, - "name": { - "description": "Human-readable name shown for this protocol object.", - "type": "string" - }, "size": { "description": "Optional size of the linked resource in bytes, if known.", "type": ["integer", "null"], "format": "int64", "x-deserialize-default-on-error": true }, - "title": { - "description": "Optional display title for end-user UI.", - "type": ["string", "null"], + "annotations": { + "description": "Optional annotations that help clients decide how to display or route this content.", + "anyOf": [ + { + "$ref": "#/$defs/Annotations" + }, + { + "type": "null" + } + ], "x-deserialize-default-on-error": true }, - "uri": { - "description": "URI associated with this resource or media payload.", - "type": "string" - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", "type": ["object", "null"], @@ -1356,11 +1356,6 @@ "description": "Text-based resource contents.", "type": "object", "properties": { - "mimeType": { - "description": "MIME type describing the encoded media payload.", - "type": ["string", "null"], - "x-deserialize-default-on-error": true - }, "text": { "description": "Text payload carried by this content block.", "type": "string" @@ -1369,6 +1364,11 @@ "description": "URI associated with this resource or media payload.", "type": "string" }, + "mimeType": { + "description": "MIME type describing the encoded media payload.", + "type": ["string", "null"], + "x-deserialize-default-on-error": true + }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", "type": ["object", "null"], @@ -1386,15 +1386,15 @@ "description": "Base64-encoded bytes for a binary resource payload.", "type": "string" }, + "uri": { + "description": "URI associated with this resource or media payload.", + "type": "string" + }, "mimeType": { "description": "MIME type describing the encoded media payload.", "type": ["string", "null"], "x-deserialize-default-on-error": true }, - "uri": { - "description": "URI associated with this resource or media payload.", - "type": "string" - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", "type": ["object", "null"], @@ -1408,6 +1408,14 @@ "description": "The contents of a resource, embedded into a prompt or tool call result.", "type": "object", "properties": { + "resource": { + "description": "Embedded resource payload, either text or binary data.", + "allOf": [ + { + "$ref": "#/$defs/EmbeddedResourceResource" + } + ] + }, "annotations": { "description": "Optional annotations that help clients decide how to display or route this content.", "anyOf": [ @@ -1420,14 +1428,6 @@ ], "x-deserialize-default-on-error": true }, - "resource": { - "description": "Embedded resource payload, either text or binary data.", - "allOf": [ - { - "$ref": "#/$defs/EmbeddedResourceResource" - } - ] - }, "_meta": { "description": "The _meta property is reserved by ACP to allow clients and agents to attach additional\nmetadata to their interactions. Implementations MUST NOT make assumptions about values at\nthese keys.\n\nSee protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/v2/draft/extensibility)", "type": ["object", "null"],