-
Notifications
You must be signed in to change notification settings - Fork 178
Add new helper properties to request and notification types #388
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
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 convenience getter properties to request and notification types in the Kotlin SDK, allowing direct access to commonly used fields without needing to navigate through the params object. This improves the ergonomics of the API while maintaining backward compatibility.
- Added getter properties that delegate to underlying
paramsfields across all request types - Included comprehensive KDoc documentation for most new properties
- Reorganized some parameter class definitions for better code organization
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/tools.kt | Added cursor and meta helper properties to ListToolsRequest |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/sampling.kt | Added multiple helper properties to CreateMessageRequest (maxTokens, messages, modelPreferences, etc.) and reformatted KDoc comments |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/roots.kt | Added meta helper property to ListRootsRequest |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/resources.kt | Added helper properties to multiple resource-related requests and reorganized parameter class definitions |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/prompts.kt | Added cursor and meta helper properties to ListPromptsRequest |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/notification.kt | Added helper properties to CustomNotification and CancelledNotification |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/logging.kt | Added level and meta helper properties to SetLevelRequest |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/initialize.kt | Added multiple helper properties to InitializeRequest (protocolVersion, capabilities, clientInfo, meta) |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/elicitation.kt | Added helper properties to ElicitRequest (message, requestedSchema, meta) |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/completion.kt | Added helper properties to CompleteRequest (argument, ref, context, meta) |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/PingRequest.kt | Added meta helper property to PingRequest |
| kotlin-sdk-core/api/kotlin-sdk-core.api | Updated API signatures to reflect new public getter methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ClientNotification, | ||
| ServerNotification | ||
| ServerNotification { | ||
|
|
Copilot
AI
Nov 11, 2025
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.
Missing documentation: The meta property should have a KDoc comment to maintain consistency with similar properties in other types. Consider adding: /**\n * Metadata for this notification.\n */
| /** | |
| * Metadata for this notification. | |
| */ |
| get() = params.ref | ||
|
|
||
| /** | ||
| * Additional, context for generating completions. |
Copilot
AI
Nov 11, 2025
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.
Spelling error: "Additional, context" should be "Additional context" (remove the comma).
| * Additional, context for generating completions. | |
| * Additional context for generating completions. |
| */ | ||
| public val context: CompleteRequestParams.Context? | ||
| get() = params.context | ||
|
|
Copilot
AI
Nov 11, 2025
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.
Missing documentation: The meta property should have a KDoc comment to maintain consistency with other properties in this class. Consider adding: /**\n * Metadata for this request. May include a progressToken for out-of-band progress notifications.\n */
| /** | |
| * Metadata for this request. May include a progressToken for out-of-band progress notifications. | |
| */ |
| @OptIn(ExperimentalSerializationApi::class) | ||
| @EncodeDefault | ||
| override val method: Method = Method.Defined.RootsList | ||
|
|
Copilot
AI
Nov 11, 2025
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.
Missing documentation: The meta property should have a KDoc comment to maintain consistency with similar properties in other request types. Consider adding: /**\n * Metadata for this request. May include a progressToken for out-of-band progress notifications.\n */
| /** | |
| * Metadata for this request. May include a progressToken for out-of-band progress notifications. | |
| */ |
| @OptIn(ExperimentalSerializationApi::class) | ||
| @EncodeDefault | ||
| override val method: Method = Method.Defined.Ping | ||
|
|
Copilot
AI
Nov 11, 2025
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.
Missing documentation: The meta property should have a KDoc comment to maintain consistency with similar properties in other request types. Consider adding: /**\n * Metadata for this request. May include a progressToken for out-of-band progress notifications.\n */
| /** | |
| * Metadata for this request. May include a progressToken for out-of-band progress notifications. | |
| */ |
Add properties for types of new schema
Motivation and Context
Added getters to simplify access to properties in request and notification types.
How Has This Been Tested?
All tests pass
Breaking Changes
None
Types of changes
Checklist