Skip to content

Conversation

@devcrocod
Copy link
Contributor

@devcrocod devcrocod commented Nov 7, 2025

Implement the last version of the mcp schema and complete restructuring of the mcp schema implementation from a monolithic types.kt file into separate files.

Motivation and Context

The previous implementation of the mcp schema was outdated and contained several issues. In addition, it stored all mcp types in a single large file, which made maintenance and further development more difficult

How Has This Been Tested?

All tests passed

Breaking Changes

Yes. The new types are now located in a separate package. Additionally, many types have new parameters and modified constructors

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

Additional context

to adopt the new structure:
Before:

  import io.modelcontextprotocol.kotlin.sdk.InitializeRequest
  import io.modelcontextprotocol.kotlin.sdk.Resource

After:

  import io.modelcontextprotocol.kotlin.sdk.types.InitializeRequest
  import io.modelcontextprotocol.kotlin.sdk.types.Resource

kpavlov
kpavlov previously approved these changes Nov 7, 2025
Copy link
Contributor

@kpavlov kpavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you

name: String,
description: String,
inputSchema: Tool.Input = Tool.Input(),
inputSchema: ToolSchema = ToolSchema(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

get() = _responseHandlers.value

private val _progressHandlers: AtomicRef<PersistentMap<RequestId, ProgressCallback>> =
private val _progressHandlers: AtomicRef<PersistentMap<ProgressToken, ProgressCallback>> =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻


setRequestHandler<PingRequest>(Method.Defined.Ping) { _, _ ->
EmptyRequestResult()
EmptyResult()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be constant

@kpavlov kpavlov added the refactoring Making things better label Nov 7, 2025
@devcrocod devcrocod force-pushed the devcrocod/mcp-schema branch from 6b2f4ad to 55214b8 Compare November 7, 2025 16:12
@kpavlov kpavlov mentioned this pull request Nov 7, 2025
9 tasks
@devcrocod devcrocod force-pushed the devcrocod/mcp-schema branch from 55214b8 to 4f0decc Compare November 9, 2025 00:51
@devcrocod devcrocod added enhancement New feature or request bugfix Something was fixed 🎉 labels Nov 9, 2025
@devcrocod devcrocod marked this pull request as ready for review November 9, 2025 01:17
Copilot AI review requested due to automatic review settings November 9, 2025 01:17
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 refactors the Kotlin SDK's type system by moving MCP protocol types from the io.modelcontextprotocol.kotlin.sdk package to a new io.modelcontextprotocol.kotlin.sdk.types package. This is a large-scale package reorganization that affects both the core SDK and test code.

Key changes:

  • Moved all protocol types (requests, responses, notifications, etc.) to a dedicated types package
  • Updated all import statements across test files to reference the new package location
  • Renamed several classes to improve clarity (e.g., Tool.InputToolSchema, EmptyRequestResultEmptyResult)
  • Restructured test files to align with the new package structure, creating dedicated test files for each type category

Reviewed Changes

Copilot reviewed 93 out of 95 changed files in this pull request and generated no comments.

File Description
Multiple test files in kotlin-sdk-test/src/jvmTest/ Updated imports from io.modelcontextprotocol.kotlin.sdk.* to io.modelcontextprotocol.kotlin.sdk.types.*
Multiple test files in kotlin-sdk-core/src/commonTest/ Created new comprehensive test files organized by type category (ToolsTest, SamplingTest, etc.) and updated existing tests
Server implementation files Updated imports and references to use new type package location
Transport and shared infrastructure Updated to reference types from new package

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Something was fixed 🎉 enhancement New feature or request refactoring Making things better

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants