Skip to content

Commit 7dd12bb

Browse files
committed
docs(readme): Update examples and introduce new annotation for i18n
- Remove outdated i18n examples for McpResource, McpPrompt, and McpTool - Add information about new @McpI18nEnabled annotation - Simplify code examples in the README
1 parent 01c67cc commit 7dd12bb

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ Declarative [MCP Java SDK](https://github.com/modelcontextprotocol/java-sdk) Dev
2222
Just put this one line code in your `main` method:
2323

2424
```java
25-
import com.github.codeboyzhou.mcp.declarative.McpServers;
26-
2725
// You can use this annotation to specify the base package
2826
// to scan for MCP resources, prompts, tools, but it's optional.
2927
// If not specified, it will scan the package where the main method is located.
3028
@McpComponentScan(basePackage = "com.github.codeboyzhou.mcp.server.examples")
29+
// Use this annotation to enable multi-languages support for MCP server components.
30+
@McpI18nEnabled
3131
public class MyMcpServer {
3232

3333
public static void main(String[] args) {
@@ -77,8 +77,6 @@ public class MyMcpResources {
7777

7878
// This method defines a MCP resource to expose the OS env variables
7979
@McpResource(uri = "env://variables", description = "OS env variables")
80-
// or you can use it like this to support multi-languages
81-
@McpResource(uri = "env://variables", descriptionI18nKey = "your_i18n_key_in_properties_file")
8280
public String getSystemEnv() {
8381
// Just put your logic code here, forget about the MCP SDK details.
8482
return System.getenv().toString();
@@ -94,8 +92,6 @@ public class MyMcpPrompts {
9492

9593
// This method defines a MCP prompt to read a file
9694
@McpPrompt(description = "A simple prompt to read a file")
97-
// or you can use it like this to support multi-languages
98-
@McpPrompt(descriptionI18nKey = "your_i18n_key_in_properties_file")
9995
public String readFile(
10096
@McpPromptParam(name = "path", description = "filepath", required = true) String path) {
10197
// Just put your logic code here, forget about the MCP SDK details.
@@ -111,8 +107,6 @@ public class MyMcpTools {
111107

112108
// This method defines a MCP tool to read a file
113109
@McpTool(description = "Read complete file contents with UTF-8 encoding")
114-
// or you can use it like this to support multi-languages
115-
@McpTool(descriptionI18nKey = "your_i18n_key_in_properties_file")
116110
public String readFile(
117111
@McpToolParam(name = "path", description = "filepath", required = true) String path) {
118112
// Just put your logic code here, forget about the MCP SDK details.

0 commit comments

Comments
 (0)