Skip to content

Commit 4393ab7

Browse files
committed
docs(README): Add example for McpPrompts annotation
1 parent 3159389 commit 4393ab7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ public class MyMcpResources {
5757
}
5858
```
5959

60+
```java
61+
@McpPrompts
62+
public class MyMcpPrompts {
63+
64+
@McpPrompt(description = "A simple prompt to read a file")
65+
public String readFile(
66+
@McpPromptParam(name = "path", description = "filepath", required = true) String path) {
67+
// Just put your logic code here, forget about the MCP SDK details.
68+
return String.format("What is the complete contents of the file: %s", path);
69+
}
70+
71+
}
72+
```
73+
6074
```java
6175
@McpTools
6276
public class MyMcpTools {

0 commit comments

Comments
 (0)