feat: Add audio type according to 2025-03-26 spec (#68)
* feat: Add audio type according to 2025-03-26 spec * chore: update documentation * feat: add unit test * chore: commit api dump * feat: Add audio type according to 2025-03-26 spec * chore: update documentation * feat: add unit test * chore: rebase and commit api dump --------- Co-authored-by: Leonid Stashevsky <e5l@users.noreply.github.com>
This commit is contained in:
parent
c582a8c442
commit
9f00f22596
1 changed files with 119 additions and 29 deletions
34
src/commonTest/kotlin/AudioContentSerializationTest.kt
Normal file
34
src/commonTest/kotlin/AudioContentSerializationTest.kt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package io.modelcontextprotocol.kotlin.sdk
|
||||
|
||||
import io.kotest.assertions.json.shouldEqualJson
|
||||
import io.modelcontextprotocol.kotlin.sdk.shared.McpJson
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class AudioContentSerializationTest {
|
||||
|
||||
private val audioContentJson = """
|
||||
{
|
||||
"data": "base64-encoded-audio-data",
|
||||
"mimeType": "audio/wav",
|
||||
"type": "audio"
|
||||
}
|
||||
""".trimIndent()
|
||||
|
||||
private val audioContent = AudioContent(
|
||||
data = "base64-encoded-audio-data",
|
||||
mimeType = "audio/wav"
|
||||
)
|
||||
|
||||
@Test
|
||||
fun `should serialize audio content`() {
|
||||
McpJson.encodeToString(audioContent) shouldEqualJson audioContentJson
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `should deserialize audio content`() {
|
||||
val content = McpJson.decodeFromString<AudioContent>(audioContentJson)
|
||||
assertEquals(expected = audioContent, actual = content)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue