Skip to content

Commit b13f33a

Browse files
docs: add missing Javadoc to clear verify warnings
Complete enum, method, and parameter documentation so javadoc:jar runs without warnings. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 03cd5f2 commit b13f33a

5 files changed

Lines changed: 62 additions & 2 deletions

File tree

src/main/java/com/github/thought2code/mcp/annotated/enums/McpServerError.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
11
package com.github.thought2code.mcp.annotated.enums;
22

3+
/**
4+
* Stable error codes and messages for MCP server failures.
5+
*
6+
* @author codeboyzhou
7+
*/
38
public enum McpServerError {
9+
10+
/** Configuration file was not found on the classpath. */
411
CONFIG_FILE_NOT_FOUND("MCP_CONFIG_FILE_NOT_FOUND", "Configuration file not found."),
12+
13+
/** Configuration file path or URI is invalid. */
514
INVALID_CONFIG_FILE("MCP_INVALID_CONFIG_FILE", "Invalid configuration file."),
15+
16+
/** YAML configuration file could not be read or parsed. */
617
YAML_READ_ERROR("MCP_YAML_READ_ERROR", "Error reading YAML configuration file."),
18+
19+
/** Object could not be serialized to JSON. */
720
JSON_SERIALIZE_ERROR("MCP_JSON_SERIALIZE_ERROR", "Error serializing object to JSON."),
21+
22+
/** JSON payload could not be deserialized. */
823
JSON_DESERIALIZE_ERROR("MCP_JSON_DESERIALIZE_ERROR", "Error deserializing JSON."),
24+
25+
/** Jetty HTTP server failed to start. */
926
JETTY_SERVER_START_ERROR(
1027
"MCP_JETTY_SERVER_START_ERROR", "Failed to start Jetty-based MCP server."),
28+
29+
/** MCP component instance could not be created. */
1130
COMPONENT_INSTANCE_CREATE_ERROR(
1231
"MCP_COMPONENT_INSTANCE_CREATE_ERROR", "Failed to create component instance."),
32+
33+
/** Annotated MCP method invocation failed unexpectedly. */
1334
METHOD_INVOCATION_ERROR(
1435
"MCP_METHOD_INVOCATION_ERROR", "Internal server error while executing MCP method.");
1536

@@ -21,14 +42,30 @@ public enum McpServerError {
2142
this.message = message;
2243
}
2344

45+
/**
46+
* Returns the stable machine-readable error code.
47+
*
48+
* @return the error code
49+
*/
2450
public String getCode() {
2551
return code;
2652
}
2753

54+
/**
55+
* Returns the human-readable error message.
56+
*
57+
* @return the error message
58+
*/
2859
public String getMessage() {
2960
return message;
3061
}
3162

63+
/**
64+
* Formats this error with an additional detail suffix.
65+
*
66+
* @param detail contextual detail appended to the message
67+
* @return formatted error text including code, message, and detail
68+
*/
3269
public String withDetail(String detail) {
3370
return String.format("[%s] %s Detail: %s", getCode(), getMessage(), detail);
3471
}

src/main/java/com/github/thought2code/mcp/annotated/enums/ServerMode.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ public enum ServerMode {
2929
this.description = description;
3030
}
3131

32+
/**
33+
* Returns a short human-readable label for this server mode.
34+
*
35+
* @return the mode description used in logs and diagnostics
36+
*/
3237
public String description() {
3338
return description;
3439
}

src/main/java/com/github/thought2code/mcp/annotated/enums/ServerType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public enum ServerType {
2121
this.description = description;
2222
}
2323

24+
/**
25+
* Returns a short human-readable label for this server type.
26+
*
27+
* @return the type description used in logs and diagnostics
28+
*/
2429
public String description() {
2530
return description;
2631
}

src/main/java/com/github/thought2code/mcp/annotated/reflect/Invocation.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ public static Builder builder() {
1717
return new Builder();
1818
}
1919

20-
/** Returns the invocation result as text. */
20+
/**
21+
* Returns the invocation result as text.
22+
*
23+
* @return the string representation of the invocation result
24+
*/
2125
public String asText() {
2226
return result.toString();
2327
}

src/main/java/com/github/thought2code/mcp/annotated/server/component/ResourceBundleProvider.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020
public final class ResourceBundleProvider {
2121

22+
/** Logger for resource bundle loading diagnostics. */
2223
public static final Logger log = LoggerFactory.getLogger(ResourceBundleProvider.class);
2324

2425
/** Immutable map of localized values resolved from a resource bundle. */
@@ -31,6 +32,8 @@ private ResourceBundleProvider(ResourceBundle bundle) {
3132
/**
3233
* Loads i18n values from the main class configuration.
3334
*
35+
* @param mainClass application entry class inspected for {@link McpI18nEnabled}
36+
* @return a provider with localized values, or an empty provider when i18n is disabled
3437
* @throws IllegalArgumentException if {@code resourceBundleBaseName} is blank
3538
* @throws MissingResourceException if the configured bundle cannot be found
3639
*/
@@ -52,7 +55,13 @@ public static ResourceBundleProvider loadResourceBundle(Class<?> mainClass) {
5255
return new ResourceBundleProvider(resourceBundle);
5356
}
5457

55-
/** Returns localized text by key, or falls back to the provided default. */
58+
/**
59+
* Returns localized text by key, or falls back to the provided default.
60+
*
61+
* @param i18nKey localization key to resolve
62+
* @param defaultValue value used when the key is missing or blank
63+
* @return localized text, or the default when no translation exists
64+
*/
5665
public String getString(String i18nKey, String defaultValue) {
5766
if (localizedValues.containsKey(i18nKey)) {
5867
return localizedValues.get(i18nKey);

0 commit comments

Comments
 (0)