-
Notifications
You must be signed in to change notification settings - Fork 178
Add backwards compatibility constructors and tests #395
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2f73cd8
Add _meta/meta assertions for SDK client tests
kpavlov 6cc2634
Remove redundant explicit casting in `OldSchemaAbstractToolIntegratio…
kpavlov 1921e5c
Deprecate `_meta` in `WithMeta` and add fallback to `meta` usage
kpavlov 6775bc5
Deprecate `_meta` in `WithMeta` and add fallback to `meta` usage
kpavlov 36c7719
Replace `throw Error` with `error(..)` for consistency in `Protocol` …
kpavlov befe3d9
Merge branch 'main' into kpavlov/tests_meta
kpavlov ed0b1b5
Fix SseServerIntegrationTest
kpavlov 62066c2
Merge branch 'main' into kpavlov/tests_meta
kpavlov fb0d735
Deprecate legacy constructors in request types, introduce helper util…
kpavlov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| package io.modelcontextprotocol.kotlin.sdk.types | ||
|
|
||
| import io.modelcontextprotocol.kotlin.sdk.types.CompleteRequestParams.Argument | ||
| import io.modelcontextprotocol.kotlin.sdk.types.CompleteRequestParams.Context | ||
| import kotlinx.serialization.EncodeDefault | ||
| import kotlinx.serialization.ExperimentalSerializationApi | ||
| import kotlinx.serialization.SerialName | ||
|
|
@@ -20,7 +22,7 @@ public data class CompleteRequest(override val params: CompleteRequestParams) : | |
| /** | ||
| * The argument's information for which completion options are requested. | ||
| */ | ||
| public val argument: CompleteRequestParams.Argument | ||
| public val argument: Argument | ||
| get() = params.argument | ||
|
|
||
| /** | ||
|
|
@@ -32,11 +34,23 @@ public data class CompleteRequest(override val params: CompleteRequestParams) : | |
| /** | ||
| * Additional, context for generating completions. | ||
| */ | ||
| public val context: CompleteRequestParams.Context? | ||
| public val context: Context? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same as with |
||
| get() = params.context | ||
|
|
||
| public val meta: RequestMeta? | ||
| get() = params.meta | ||
|
|
||
| @Deprecated( | ||
| message = "Will be removed in a future release.", | ||
| replaceWith = ReplaceWith(expression = "CompleteRequest(CompleteRequestParams(argument, ref, context, meta))"), | ||
| level = DeprecationLevel.WARNING, | ||
| ) | ||
| public constructor( | ||
| argument: Argument, | ||
| ref: Reference, | ||
| context: Context? = null, | ||
| meta: RequestMeta? = null, | ||
| ) : this(CompleteRequestParams(argument, ref, context, meta)) | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -67,7 +81,7 @@ public data class CompleteRequestParams( | |
| /** | ||
| * Additional context to help generate more relevant completions. | ||
| * | ||
| * @property arguments Previously-resolved variables in a URI template or prompt. | ||
| * @property arguments Previously resolved variables in a URI template or prompt. | ||
| * These can be used to provide context-aware completions. | ||
| * For example, if completing a file path, this might contain the repository or directory context. | ||
| */ | ||
|
|
@@ -100,8 +114,8 @@ public data class CompleteResult( | |
| * This can exceed the number of values actually sent in the response, | ||
| * indicating that pagination or filtering may be needed. | ||
| * @property hasMore Indicates whether there are additional completion options beyond | ||
| * those provided in the current response, even if the exact total is unknown. | ||
| * Use this when the complete set of completions is too large to calculate upfront. | ||
| * those provided in the current response, even if the exact total is unknown. | ||
| * Use this when the complete set of completions is too large to calculate upfront. | ||
| */ | ||
| @Serializable | ||
| public data class Completion(val values: List<String>, val total: Int? = null, val hasMore: Boolean? = null) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It’s better to refer to the class directly rather than importing it separately
this makes the code clearer and easier to understand:
CompleteRequestParams.ArgumentThere 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.
Idea complains about it but yes