Add metadata support to callTool method (#289)

According to
https://modelcontextprotocol.io/specification/2025-06-18/basic/index#meta,
the _meta parameter should be passable when calling tools. While the
CallToolRequest class (in types.kt) currently includes _meta in its
definition, SDK users cannot actually input _meta when invoking the
callTool method.

This Pull Request adds a metadata parameter to the CallTool method and
includes functionality to convert various data formats without loss.

Additionally, to encourage the use of valid Key name formats as defined
by the protocol, validation for prefixes has been implemented.

---------

Co-authored-by: MAERYO <maeryo@hanwha.com>
Co-authored-by: devcrocod <devcrocod@gmail.com>
This commit is contained in:
M A E R Y O 2025-10-23 22:17:09 +09:00 • committed by GitHub
commit 407df7a3a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -484,7 +484,7 @@ abstract class AbstractToolIntegrationTest : KotlinTestBase() {
"result" : 11.0,
"formattedResult" : "11,000",
"precision" : 3,
"tags" : [ ]
"tags" : ["test", "calculator", "integration"]
}
""".trimIndent()