1
- package io.modelcontextprotocol.kotlin.sdk.server
1
+ package io.modelcontextprotocol.annotation
2
2
3
- import io.ktor.util.rootCause
4
- import io.modelcontextprotocol.kotlin.sdk.CallToolRequest
5
3
import io.modelcontextprotocol.kotlin.sdk.CallToolResult
6
4
import io.modelcontextprotocol.kotlin.sdk.TextContent
7
5
import io.modelcontextprotocol.kotlin.sdk.Tool
8
- import kotlinx.serialization.json.JsonObject
6
+ import io.modelcontextprotocol.kotlin.sdk.server.Server
9
7
import kotlinx.serialization.json.JsonPrimitive
10
8
import kotlinx.serialization.json.buildJsonObject
11
9
import kotlinx.serialization.json.put
12
10
import kotlinx.serialization.json.putJsonObject
13
11
import java.lang.reflect.InvocationTargetException
14
- import kotlin.reflect.KCallable
15
- import kotlin.reflect.KClass
16
12
import kotlin.reflect.KFunction
17
13
import kotlin.reflect.KParameter
18
14
import kotlin.reflect.KType
19
15
import kotlin.reflect.full.findAnnotation
20
16
import kotlin.reflect.full.hasAnnotation
21
17
import kotlin.reflect.full.instanceParameter
22
18
import kotlin.reflect.full.valueParameters
23
- import kotlin.reflect.typeOf
24
- import kotlin.text.get
25
- import kotlin.text.set
26
19
27
20
/* *
28
- * Extension function to register tools from class methods annotated with [McpTool].
29
- * This function will scan the provided class for methods annotated with [McpTool] and register them as tools.
21
+ * Extension function to register tools from class methods annotated with [io.modelcontextprotocooool. McpTool].
22
+ * This function will scan the provided class for methods annotated with [io.modelcontextprotocooool. McpTool] and register them as tools.
30
23
*
31
24
* @param instance The instance of the class containing the annotated methods.
32
25
* @param T The type of the class.
@@ -50,7 +43,7 @@ public inline fun <reified T : Any> Server.registerAnnotatedTools(instance: T) {
50
43
*
51
44
* @param instance The instance of the class containing the annotated method.
52
45
* @param function The function to register as a tool.
53
- * @param annotation The [McpTool] annotation.
46
+ * @param annotation The [io.modelcontextprotocooool. McpTool] annotation.
54
47
*/
55
48
public fun <T : Any > Server.registerToolFromAnnotatedFunction (
56
49
instance : T ,
0 commit comments