Conversation
There was a problem hiding this comment.
Pull request overview
Adds KDoc coverage for Kotlin public API properties to satisfy a newly-enabled Detekt documentation rule, and introduces a Claude skill to standardize future KDoc generation across the repo.
Changes:
- Enable Detekt
UndocumentedPublicPropertyrule. - Add/adjust KDoc across multiple public API types/transports (notably
@propertydocs). - Add
.claude/skills/kdocguidance for generating KDoc consistently.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport.kt | Refines KDoc, adds missing public property documentation. |
| kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/SSEServerTransport.kt | Documents sessionId public property in class KDoc. |
| kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/ServerSession.kt | Documents sessionId public property in session API. |
| kotlin-sdk-core/src/jvmMain/kotlin/io/modelcontextprotocol/kotlin/sdk/internal/utils.jvm.kt | Adds KDoc for platform IODispatcher actual. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/utils/ResourceTemplateMatcher.kt | Documents matcher’s resourceTemplate property. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/tasks.kt | Adds KDoc for shared task fields and payload wrapper property. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/sampling.kt | Expands KDoc around StopReason and companion values. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/roots.kt | Documents request meta convenience property on ListRootsRequest. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/request.kt | Adds KDoc for RequestMeta, Request, and PaginatedResult properties. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/PingRequest.kt | Documents request meta convenience property. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/notification.kt | Documents Notification members and CustomNotification.meta. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/methods.kt | Documents Method.value semantics. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/jsonUtils.kt | Documents shared JSON helpers (EmptyJsonObject, McpJson). |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/jsonRpc.kt | Documents JSON-RPC constants and identifier value classes. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/content.kt | Documents ContentTypes.value and ContentBlock.type. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/completion.kt | Documents completion request meta convenience property. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/common.kt | Documents protocol version constants and discriminator enums. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/capabilities.kt | Adds KDoc for companion “convenience” capability values. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/WebSocketMcpTransport.kt | Documents MCP_SUBPROTOCOL constant. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Protocol.kt | Documents handshake constant and key public properties on Protocol. |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/internal/utils.kt | Adds KDoc for platform IODispatcher expect. |
| kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClientTransport.kt | Documents transport state properties and error status code. |
| config/detekt/detekt.yml | Enables UndocumentedPublicProperty rule. |
| .claude/skills/kdoc/SKILL.md | Adds a reusable skill spec for generating Kotlin KDoc. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| comments: | ||
| UndocumentedPublicProperty: | ||
| active: true | ||
| excludes: [ '**/test/**', '**/commonTest/**', '**/jvmTest/**', '**/generated-sources/**' ] |
There was a problem hiding this comment.
The comments.UndocumentedPublicProperty.excludes list duplicates the existing *testFolders anchor but omits patterns already covered there (e.g., **/jsTest/**, **/iosTest/**). To keep the config consistent and avoid the rule unexpectedly applying to some test source sets, consider reusing *testFolders and adding only the extra **/generated-sources/** exclusion.
| excludes: [ '**/test/**', '**/commonTest/**', '**/jvmTest/**', '**/generated-sources/**' ] | |
| excludes: [ '**/test/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/generated-sources/**' ] |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| @@ -0,0 +1,74 @@ | |||
| --- | |||
| name: kdoc | |||
| description: "Add KDoc documentation to Kotlin public API. Use whenever the user asks to document Kotlin code, add KDoc, generate API docs, mentions undocumented public declarations, or wants to improve existing documentation. Also trigger when the user says 'add docs', 'document this class/file/module', 'write KDoc', or asks about missing documentation in Kotlin code." | |||
There was a problem hiding this comment.
This should also trigger automatically when adding or updating public facing api. User will simply forget to ask about kdoc.
| - Functions, extension functions | ||
| - Properties | ||
| - Enum classes and entries | ||
| - Type aliases, annotation classes |
There was a problem hiding this comment.
It this looks like too obvious
| * Manages active client sessions and their lifecycle. | ||
| * | ||
| * Sessions are created on first connection and cleaned up | ||
| * when the transport closes. |
There was a problem hiding this comment.
Adding example for a class also make sense, e.g. how to construct the class
| - **Example block**: add for DSL builders, complex functions, extension functions with non-obvious usage. Skip for trivial one-liners and simple getters | ||
| - **DSL builders**: always include an Example showing full usage with the receiver scope — this is critical for discoverability | ||
| - KDoc links (`[ClassName]`, `[methodName]`): only where it adds clear navigational value | ||
| - No **@throws** — don't document exceptions |
There was a problem hiding this comment.
This is questionable. It is very helpful to keep exceptions documented, especially for non-trival use cases
| comments: | ||
| UndocumentedPublicClass: | ||
| active: true | ||
| excludes: [ '**/test/**', '**/commonTest/**', '**/jvmTest/**', '**/generated-sources/**' ] |
There was a problem hiding this comment.
Consider referring *testForders
How Has This Been Tested?
./gradlew detekt
Breaking Changes
none
Types of changes
Checklist