-
Notifications
You must be signed in to change notification settings - Fork 169
Adds optional _meta field to Tool #339
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?
Adds optional _meta field to Tool #339
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an optional _meta field to the Tool class to align with the OpenAI Apps SDK specification, which includes metadata fields on Tool descriptors. The change maintains backward compatibility by defaulting to an empty JSON object.
- Adds
_metafield toTooldata class by implementing theWithMetainterface - Updates
Server.addTool()method to accept an optional_metaparameter - Adds comprehensive serialization tests for the new field
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt | Adds _meta field to Tool class and implements WithMeta interface |
| kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/Server.kt | Updates addTool() method to accept optional _meta parameter |
| kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/ToolSerializationTest.kt | Adds test coverage for _meta field serialization |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt
Show resolved
Hide resolved
...n-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/ToolSerializationTest.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, Jeff
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/Server.kt
Outdated
Show resolved
Hide resolved
Adds support for tool descriptor metadata to misk-mcp. This is required by then OpenAI Apps SDK: https://developers.openai.com/apps-sdk/reference This is a temporary solution until modelcontextprotocol/kotlin-sdk#339 can be pulled in.
My pleasure @kpavlov, looking forward to this merge |
|
#289 |
Motivation and Context
The recently released openAI Apps SDK adds a '_meta' field on the Tool Descriptor. This would be in addition to it being available on Messages. It remains optional and defaults to an empty json object, following existing conventions.
This also adds a Tool.Builder and Tool.build() builders to help with Tool's large constructor
How Has This Been Tested?
Unit tests for serialization added
Breaking Changes
N/A
Types of changes
Checklist
Additional context
https://developers.openai.com/apps-sdk
https://developers.openai.com/apps-sdk/reference/#_meta-fields-the-client-provides