Add experimental mcpClient(...) factory method (#396)
- Introduced `@ExperimentalMcpApi` annotation to mark experimental APIs. - Added `mcpClient` function for initializing and connecting MCP clients. - Modified tests to utilize the new `mcpClient` function. - Refactored variable naming in transport tests for improved readability. ## Motivation and Context To improve the creation of the MCP Client experience. ## How Has This Been Tested? Integration test updated ## Breaking Changes No ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] 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) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed ## Additional context <!-- Add any other context, implementation notes, or design decisions -->
This commit is contained in:
parent
8bdbd36c32
commit
93d544e618
1 changed files with 118 additions and 15 deletions
|
|
@ -0,0 +1,54 @@
|
|||
package io.modelcontextprotocol.kotlin.sdk
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.ANNOTATION_CLASS
|
||||
import kotlin.annotation.AnnotationTarget.CLASS
|
||||
import kotlin.annotation.AnnotationTarget.CONSTRUCTOR
|
||||
import kotlin.annotation.AnnotationTarget.FIELD
|
||||
import kotlin.annotation.AnnotationTarget.FUNCTION
|
||||
import kotlin.annotation.AnnotationTarget.LOCAL_VARIABLE
|
||||
import kotlin.annotation.AnnotationTarget.PROPERTY
|
||||
import kotlin.annotation.AnnotationTarget.PROPERTY_GETTER
|
||||
import kotlin.annotation.AnnotationTarget.PROPERTY_SETTER
|
||||
import kotlin.annotation.AnnotationTarget.TYPEALIAS
|
||||
import kotlin.annotation.AnnotationTarget.VALUE_PARAMETER
|
||||
|
||||
/**
|
||||
* Annotation marking an API as experimental and subject to changes or removal in the future.
|
||||
*
|
||||
* This annotation is used to signal that a particular element, such as a class, function, or property,
|
||||
* is part of an experimental API. Such APIs may not be stable, and their usage requires opting in
|
||||
* explicitly.
|
||||
*
|
||||
* Users of the annotated API must explicitly accept the opt-in requirement to ensure they are aware
|
||||
* of the potential instability or unfinished nature of the API.
|
||||
*
|
||||
* Targets that can be annotated include:
|
||||
* - Classes
|
||||
* - Annotation classes
|
||||
* - Properties
|
||||
* - Fields
|
||||
* - Local variables
|
||||
* - Value parameters
|
||||
* - Constructors
|
||||
* - Functions
|
||||
* - Property getters
|
||||
* - Property setters
|
||||
* - Type aliases
|
||||
*/
|
||||
@RequiresOptIn
|
||||
@MustBeDocumented
|
||||
@Target(
|
||||
CLASS,
|
||||
ANNOTATION_CLASS,
|
||||
PROPERTY,
|
||||
FIELD,
|
||||
LOCAL_VARIABLE,
|
||||
VALUE_PARAMETER,
|
||||
CONSTRUCTOR,
|
||||
FUNCTION,
|
||||
PROPERTY_GETTER,
|
||||
PROPERTY_SETTER,
|
||||
TYPEALIAS,
|
||||
)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
public annotation class ExperimentalMcpApi
|
||||
Loading…
Reference in a new issue