-
Notifications
You must be signed in to change notification settings - Fork 76
Support for MCP definations using kotlin annotation #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@devcrocod @e5l it's ready for review. |
Sorry, I don’t fully understand the motivation. |
It basically provides better and more kotlin idiomatic way to define MCP tool.
Now, with the proposed changes, defining a MCP tool is simpler with annotation ( uses kotlin annotations https://kotlinlang.org/docs/annotations.html) similar to how it's there in python sdk which uses decorators (similar concept to kotlin annotations). check out this for example which we built using jar from this changes:
so in short, it's less of a schema generators and more around simplifying MCP tool definitions for kotlin-sdk users. |
That’s understandable, but it doesn’t explain why not support one of the libraries I sent earlier. Besides, the solution using annotations seems excessive to me at this point. Also, adding such a solution complicates support for multiplatform #70 , since reflection is platform-dependent |
because they're MCP agnostic and have a generic purpose (schema generation)
required is only one of the usecase, larger purpose is to reduce verbosity defining MCP tool. i.e
currently, it's too verbose to define a tool and can be simplified.
fair point, hence this PR adds support for doing it with annotations as an another way instead of replacing current one. |
I'm working on a solution based on KSP. With that, we can do this:
Generate code from below code (@McpServerCompnent @mcptool annotation) with KSP as follow:
And we can use it like:
I think this plan is friendly for dependency injection and Kotlin Multiplatform, with less runtime cost. |
Motivation and Context
Add support for #76
How Has This Been Tested?
Unit tested and built jar was locally tested with MCP server built with annotations.
Breaking Changes
No
Types of changes
Checklist
Additional context