Skip to content

Commit c30ddfc

Browse files
authored
Merge branch 'main' into skarpov/integration-tests
2 parents 32df4dd + 641df74 commit c30ddfc

File tree

19 files changed

+1641
-220
lines changed

19 files changed

+1641
-220
lines changed

.github/workflows/codeql.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '0 4 * * 0'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze (${{ matrix.language }})
14+
runs-on: ubuntu-latest
15+
permissions:
16+
# required for all workflows
17+
security-events: write
18+
19+
# required to fetch internal or private CodeQL packs
20+
packages: read
21+
22+
# only required for workflows in private repositories
23+
actions: read
24+
contents: read
25+
26+
strategy:
27+
matrix:
28+
language: [ java-kotlin ]
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- uses: actions/setup-java@v4
35+
with:
36+
distribution: temurin
37+
java-version: '21'
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v3
42+
with:
43+
languages: ${{ matrix.language }}
44+
build-mode: manual
45+
46+
- uses: actions/cache@v4
47+
with:
48+
path: |
49+
~/.gradle/caches
50+
~/.gradle/wrapper
51+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
52+
53+
- name: Build Kotlin sources
54+
run: |
55+
./gradlew \
56+
:build -Pkotlin.incremental=false \
57+
--no-daemon --stacktrace --parallel
58+
59+
- name: Analyze
60+
uses: github/codeql-action/analyze@v3
61+
with:
62+
category: '/language:${{ matrix.language }}'

.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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ atomicfu = "0.29.0"
88
serialization = "1.9.0"
99
collections-immutable = "0.4.0"
1010
coroutines = "1.10.2"
11-
ktor = "3.2.1"
12-
mockk = "1.14.4"
11+
ktor = "3.2.2"
12+
mockk = "1.14.5"
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)