Skip to content

Conversation

dstibbe
Copy link

@dstibbe dstibbe commented Sep 4, 2025

Support resource links in tool result content #158

  • Refactored PromptMessageContent to ContentBlock
  • Added the ResourceLink as a ContentBlock type

Motivation and Context

The new spec introduced a new ContentBlock type: ResourceLink. This type however hasn't been implemented yet.
Noticed that there was actually no ContentBlock type at all in the core as the latest schema reference specified. Instead there is a PromptMessageContent.

How Has This Been Tested?

Added unit tests. Ran all tests.
Also used the build in a standalone project:

  • calling a tool returning a ResourceLink via de client directly
  • called a tool using Jetbrains Koog framework

Breaking Changes

Added the following:

  • ContentBlock
  • CreateMessageResultContent, and
  • SamplingMessageContent

However, I kept the two intrefaces PromptMessageContent and PromptMessageContentMultimodal purely for backwards compatibility. They are deprecated however.

Types of changes

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

Checklist

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

Additional context

@Copilot Copilot AI review requested due to automatic review settings September 12, 2025 09:59
@devcrocod devcrocod force-pushed the 158-support-resource-links branch from 23d2726 to c3746a4 Compare September 12, 2025 09:59
Copy link
Contributor

@Copilot 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 support for ResourceLink ContentBlock type to align with the MCP specification, refactoring the existing PromptMessageContent type hierarchy to use the more structured ContentBlock interface.

  • Introduces ResourceLink as a new ContentBlock type for linking to external resources
  • Refactors type hierarchy from PromptMessageContent to ContentBlock with specialized content types
  • Maintains backwards compatibility by deprecating old interfaces while keeping them functional

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt Adds ResourceLink class and ContentBlock interface hierarchy
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.util.kt Updates polymorphic serializers for new ContentBlock types
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/TypesTest.kt Adds tests for ResourceLink and updates existing tests
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/TypesUtilTest.kt Updates serialization tests for ContentBlock types
kotlin-sdk-core/api/kotlin-sdk-core.api API documentation for new types and interfaces
CONTRIBUTING.md Minor update to build instructions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

1 participant