File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public fun <T : Any> Server.registerToolFromAnnotatedFunction(
64
64
val properties = buildJsonObject {
65
65
function.valueParameters.forEach { param ->
66
66
val paramAnnotation = param.findAnnotation<McpParam >()
67
- val paramName = param.name ? : " param${param.index } "
67
+ val paramName = param.name ? : " param${function.valueParameters.indexOf(param) } "
68
68
69
69
putJsonObject(paramName) {
70
70
val type = when {
@@ -91,7 +91,7 @@ public fun <T : Any> Server.registerToolFromAnnotatedFunction(
91
91
val paramAnnotation = param.findAnnotation<McpParam >()
92
92
paramAnnotation?.required != false && ! param.isOptional
93
93
}
94
- .map { it.name ? : " param${it.index } " }
94
+ .map { it.name ? : " param${function.valueParameters.indexOf(it) } " }
95
95
}
96
96
97
97
// Create tool input schema
You can’t perform that action at this time.
0 commit comments