https://github.com/xemantic/xemantic-ai-tool-schema-mdc
Adapting xemantic-ai-tool-schema to Model Context Protocol kotlin-sdk Tool input
https://github.com/xemantic/xemantic-ai-tool-schema-mdc
agentic agentic-ai agents ai anthropic artificial-intelligence artificialintelligence function-calling json-schema kotlin kotlin-library kotlin-multiplatform large-language-models llm mdc model-context-protocol schema tool tool-use
Last synced: 5 months ago
JSON representation
Adapting xemantic-ai-tool-schema to Model Context Protocol kotlin-sdk Tool input
- Host: GitHub
- URL: https://github.com/xemantic/xemantic-ai-tool-schema-mdc
- Owner: xemantic
- License: apache-2.0
- Created: 2025-01-07T13:45:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-11-09T00:27:10.000Z (10 months ago)
- Last Synced: 2025-11-15T15:02:50.837Z (10 months ago)
- Topics: agentic, agentic-ai, agents, ai, anthropic, artificial-intelligence, artificialintelligence, function-calling, json-schema, kotlin, kotlin-library, kotlin-multiplatform, large-language-models, llm, mdc, model-context-protocol, schema, tool, tool-use
- Language: Kotlin
- Homepage:
- Size: 69.3 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 42
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# xemantic-ai-tool-schema-mdc
Adapting [xemantic-ai-tool-schema](https://github.com/xemantic/xemantic-ai-tool-schema) to Model Context Protocol kotlin-sdk Tool input.
[
](https://central.sonatype.com/namespace/com.xemantic.ai)
[
](https://github.com/xemantic/xemantic-ai-tool-schema-mdc/releases)
[
](https://github.com/xemantic/xemantic-ai-tool-schema-mdc/blob/main/LICENSE)
[
](https://github.com/xemantic/xemantic-ai-tool-schema-mdc/actions/workflows/build-main.yml)
[
](https://github.com/xemantic/xemantic-ai-tool-schema-mdc/actions/workflows/build-main.yml)
[
](https://github.com/xemantic/xemantic-ai-tool-schema-mdc/commits/main/)
[
](https://github.com/xemantic/xemantic-ai-tool-schema-mdc/commits/main/)
[
](https://github.com/xemantic/xemantic-ai-tool-schema-mdc/graphs/contributors)
[
](https://github.com/xemantic/xemantic-ai-tool-schema-mdc/commits/main/)
[
]()
[
](https://github.com/xemantic/xemantic-ai-tool-schema-mdc/commit/39c1fa4c138d4c671868c973e2ad37b262ae03c2)
[
](https://kotlinlang.org/docs/releases.html)
[
](https://discord.gg/vQktqqN2Vn)
[
](https://discord.gg/vQktqqN2Vn)
[
](https://x.com/KazikPogoda)
## Why?
The [kotlin-sdk](https://github.com/modelcontextprotocol/kotlin-sdk) variant of the [Model Context Protocol](https://modelcontextprotocol.io/) is expressing [JSON Schema](https://json-schema.org/) as `Tool.Input` class, which offers limited flexibility comparing
to [JsonSchema](https://github.com/xemantic/xemantic-ai-tool-schema/blob/main/src/commonMain/kotlin/JsonSchema.kt) delivered by the [xemantic-ai-tool-schema](https://github.com/xemantic/xemantic-ai-tool-schema) project.
In particular `definitions` of types cannot be expressed.
I hope `kotlin-sdk` will embrace something more versatile soon. Meanwhile, this adapter library can be used for automatic MDC-compatible JSON Schema generation out of serializable Kotlin classes.
## Usage
### Setting up Gradle
In your `build.gradle.kts`:
```kotlin
dependencies {
implementation("com.xemantic.ai:xemantic-ai-tool-schema-mdc:0.1.1")
}
```
### Getting `Tool.Input` instance
```kotlin
@Serializable
data class Foo(
val bar: String
)
// ...
val inputSchema: Tool.Input = mdcToolInput()
```
See [ObjectSchemaToMdcToolInputTest](src/commonTest/kotlin/ObjectSchemaToMdcToolInputTest.kt) for details.
## Development
Clone this project, and then run:
```shell
./gradlew build
```