fix(rmcp): add Audio variant to PromptMessageContent (#865)
The spec's prompt-message ContentBlock union is
`text | image | audio | resource_link | resource`, but
PromptMessageContent omitted `Audio`. Because the enum is
`#[serde(tag = "type")]` with no catch-all, a spec-conformant
`{"type":"audio",...}` content block failed to deserialize with
"unknown variant `audio`", breaking prompts/get for any server that
returns audio prompt content (the audio analogue of #842 / #843).
The supporting AudioContent type already existed, and Audio was
already a variant of the general RawContent enum (tool results,
sampling) -- only PromptMessageContent lacked it.
Add the flattened Audio variant (mirroring Image), a
PromptMessage::new_audio constructor (mirroring new_image), and
serialization + deserialization regression tests.
Fixes #864.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
25220361d5
commit
0a95c3b608
2 changed files with 141 additions and 1 deletions
|
|
@ -2115,6 +2115,37 @@
|
|||
"mimeType"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Audio content with base64-encoded data",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"annotations": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Annotations"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"type": "string"
|
||||
},
|
||||
"mimeType": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "audio"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"data",
|
||||
"mimeType"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Embedded server-side resource",
|
||||
"type": "object",
|
||||
|
|
|
|||
|
|
@ -2115,6 +2115,37 @@
|
|||
"mimeType"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Audio content with base64-encoded data",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"annotations": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Annotations"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"type": "string"
|
||||
},
|
||||
"mimeType": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "audio"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"data",
|
||||
"mimeType"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Embedded server-side resource",
|
||||
"type": "object",
|
||||
|
|
|
|||
Loading…
Reference in a new issue