Skip to content

Commit e962089

Browse files
authored
Merge branch 'main' into n500/add-receiver-mcp-dsl
2 parents 60646bd + cb79ea7 commit e962089

File tree

17 files changed

+1532
-169
lines changed

17 files changed

+1532
-169
lines changed

.github/workflows/validate-pr.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ name: Validate PR
33
on:
44
workflow_dispatch:
55
pull_request:
6-
types: [auto_merge_enabled]
6+
branches: [main]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
711

812
jobs:
913
validate-pr:
@@ -17,7 +21,7 @@ jobs:
1721
java-version: '21'
1822
distribution: 'temurin'
1923
- name: Setup Gradle
20-
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
24+
uses: gradle/actions/setup-gradle@v4
2125

2226
- name: Clean Build with Gradle
2327
run: ./gradlew clean build

api/kotlin-sdk.api

Lines changed: 382 additions & 61 deletions
Large diffs are not rendered by default.

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ktor = "3.2.1"
1212
mockk = "1.14.4"
1313
logging = "7.0.7"
1414
jreleaser = "1.19.0"
15-
binaryCompatibilityValidatorPlugin = "0.18.0"
15+
binaryCompatibilityValidatorPlugin = "0.18.1"
1616
slf4j = "2.0.17"
1717
kotest = "5.9.1"
1818

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ public open class Server(
206206
* Registers a single tool. The client can then call this tool.
207207
*
208208
* @param name The name of the tool.
209+
* @param title An optional human-readable name of the tool for display purposes.
209210
* @param description A human-readable description of what the tool does.
210211
* @param inputSchema The expected input schema for the tool.
211212
* @param outputSchema The optional expected output schema for the tool.
@@ -217,11 +218,12 @@ public open class Server(
217218
name: String,
218219
description: String,
219220
inputSchema: Tool.Input = Tool.Input(),
221+
title: String? = null,
220222
outputSchema: Tool.Output? = null,
221223
toolAnnotations: ToolAnnotations? = null,
222224
handler: suspend (CallToolRequest) -> CallToolResult
223225
) {
224-
val tool = Tool(name, description, inputSchema, outputSchema, toolAnnotations)
226+
val tool = Tool(name, title, description, inputSchema, outputSchema, toolAnnotations)
225227
addTool(tool, handler)
226228
}
227229

@@ -556,7 +558,7 @@ public open class Server(
556558
* @param params The logging message notification parameters.
557559
*/
558560
public suspend fun sendLoggingMessage(params: LoggingMessageNotification) {
559-
logger.trace { "Sending logging message: ${params.data}" }
561+
logger.trace { "Sending logging message: ${params.params.data}" }
560562
notification(params)
561563
}
562564

@@ -566,7 +568,7 @@ public open class Server(
566568
* @param params Details of the updated resource.
567569
*/
568570
public suspend fun sendResourceUpdated(params: ResourceUpdatedNotification) {
569-
logger.debug { "Sending resource updated notification for: ${params.uri}" }
571+
logger.debug { "Sending resource updated notification for: ${params.params.uri}" }
570572
notification(params)
571573
}
572574

src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Protocol.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ public abstract class Protocol(
292292
}
293293

294294
private fun onProgress(notification: ProgressNotification) {
295-
LOGGER.trace { "Received progress notification: token=${notification.progressToken}, progress=${notification.progress}/${notification.total}" }
296-
val progress = notification.progress
297-
val total = notification.total
298-
val message = notification.message
299-
val progressToken = notification.progressToken
295+
LOGGER.trace { "Received progress notification: token=${notification.params.progressToken}, progress=${notification.params.progress}/${notification.params.total}" }
296+
val progress = notification.params.progress
297+
val total = notification.params.total
298+
val message = notification.params.message
299+
val progressToken = notification.params.progressToken
300300

301301
val handler = _progressHandlers.value[progressToken]
302302
if (handler == null) {
@@ -424,7 +424,12 @@ public abstract class Protocol(
424424
_responseHandlers.update { current -> current.remove(messageId) }
425425
_progressHandlers.update { current -> current.remove(messageId) }
426426

427-
val notification = CancelledNotification(requestId = messageId, reason = reason.message ?: "Unknown")
427+
val notification = CancelledNotification(
428+
params = CancelledNotification.Params(
429+
requestId = messageId,
430+
reason = reason.message ?: "Unknown"
431+
)
432+
)
428433

429434
val serialized = JSONRPCNotification(
430435
notification.method.value,

0 commit comments

Comments
 (0)