Skip to content

Commit 8f9872f

Browse files
committed
code review comments
1 parent de10b52 commit 8f9872f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/ServerAnnotations.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public fun <T : Any> Server.registerToolFromAnnotatedFunction(
6464
val properties = buildJsonObject {
6565
function.valueParameters.forEach { param ->
6666
val paramAnnotation = param.findAnnotation<McpParam>()
67-
val paramName = param.name ?: "param${param.index}"
67+
val paramName = param.name ?: "param${function.valueParameters.indexOf(param)}"
6868

6969
putJsonObject(paramName) {
7070
val type = when {
@@ -91,7 +91,7 @@ public fun <T : Any> Server.registerToolFromAnnotatedFunction(
9191
val paramAnnotation = param.findAnnotation<McpParam>()
9292
paramAnnotation?.required != false && !param.isOptional
9393
}
94-
.map { it.name ?: "param${it.index}" }
94+
.map { it.name ?: "param${function.valueParameters.indexOf(it)}" }
9595
}
9696

9797
// Create tool input schema

0 commit comments

Comments
 (0)