Skip to content

Conversation

@devcrocod
Copy link
Contributor

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@devcrocod devcrocod marked this pull request as ready for review November 11, 2025 13:13
Copilot AI review requested due to automatic review settings November 11, 2025 13:13
Copilot finished reviewing on behalf of devcrocod November 11, 2025 13:14
Copy link
Contributor

Copilot AI left a 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 params fields 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 {

Copy link

Copilot AI Nov 11, 2025

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 */

Suggested change
/**
* Metadata for this notification.
*/

Copilot uses AI. Check for mistakes.
get() = params.ref

/**
* Additional, context for generating completions.
Copy link

Copilot AI Nov 11, 2025

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).

Suggested change
* Additional, context for generating completions.
* Additional context for generating completions.

Copilot uses AI. Check for mistakes.
*/
public val context: CompleteRequestParams.Context?
get() = params.context

Copy link

Copilot AI Nov 11, 2025

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 */

Suggested change
/**
* Metadata for this request. May include a progressToken for out-of-band progress notifications.
*/

Copilot uses AI. Check for mistakes.
@OptIn(ExperimentalSerializationApi::class)
@EncodeDefault
override val method: Method = Method.Defined.RootsList

Copy link

Copilot AI Nov 11, 2025

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 */

Suggested change
/**
* Metadata for this request. May include a progressToken for out-of-band progress notifications.
*/

Copilot uses AI. Check for mistakes.
@OptIn(ExperimentalSerializationApi::class)
@EncodeDefault
override val method: Method = Method.Defined.Ping

Copy link

Copilot AI Nov 11, 2025

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 */

Suggested change
/**
* Metadata for this request. May include a progressToken for out-of-band progress notifications.
*/

Copilot uses AI. Check for mistakes.
@kpavlov kpavlov merged commit 13f858d into main Nov 11, 2025
10 checks passed
@kpavlov kpavlov deleted the devcrocod/add-properties-for-new-schema branch November 11, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants