Skip to content

feat(docs): public api kdocs#658

Draft
devcrocod wants to merge 2 commits intomainfrom
devcrocod/document-public-api
Draft

feat(docs): public api kdocs#658
devcrocod wants to merge 2 commits intomainfrom
devcrocod/document-public-api

Conversation

@devcrocod
Copy link
Copy Markdown
Contributor

  • enable rule for checking undocumented public api
  • add kdoc skill

How Has This Been Tested?

./gradlew detekt

Breaking Changes

none

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Copilot AI review requested due to automatic review settings March 30, 2026 20:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 UndocumentedPublicProperty rule.
  • Add/adjust KDoc across multiple public API types/transports (notably @property docs).
  • Add .claude/skills/kdoc guidance 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/**' ]
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
excludes: [ '**/test/**', '**/commonTest/**', '**/jvmTest/**', '**/generated-sources/**' ]
excludes: [ '**/test/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/generated-sources/**' ]

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@kpavlov kpavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good skill! Please consider my comments

@@ -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."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also trigger automatically when adding or updating public facing api. User will simply forget to ask about kdoc.

Comment on lines +14 to +17
- Functions, extension functions
- Properties
- Enum classes and entries
- Type aliases, annotation classes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/**' ]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider referring *testForders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants