Skip to content

Commit 8ae789b

Browse files
committed
refactor(mcp-server-filesystem): Enhance comments in McpResources and McpTools
1 parent a681c96 commit 8ae789b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

mcp-server-filesystem/src/main/java/com/github/mcp/examples/server/filesystem/McpResources.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ public static McpServerFeatures.SyncResourceSpecification filesystem() {
2626
"file://system", "filesystem", "File system operations interface", "text/plain",
2727
new McpSchema.Annotations(List.of(McpSchema.Role.ASSISTANT, McpSchema.Role.USER), 1.0)
2828
);
29-
// Step 2: Create a handler that returns the contents of the resource.
29+
30+
// Step 2: Create a resource specification with the resource and a read handler.
3031
return new McpServerFeatures.SyncResourceSpecification(resource, (exchange, request) -> {
32+
// Step 3: Return the contents of the resource.
3133
McpSchema.ResourceContents contents = new McpSchema.TextResourceContents(
3234
resource.uri(), resource.mimeType(), "No specific resource contents, just use the tools."
3335
);

mcp-server-filesystem/src/main/java/com/github/mcp/examples/server/filesystem/McpTools.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ public final class McpTools {
3333
public static McpServerFeatures.SyncToolSpecification readFile() throws IOException {
3434
// Step 1: Load the JSON schema for the tool input arguments.
3535
final String schema = FileOperationHelper.readResourceAsString("schema/read-file-tool-input-json-schema.json");
36+
3637
// Step 2: Create a tool with name, description, and JSON schema.
3738
McpSchema.Tool tool = new McpSchema.Tool("read_file", "Read complete contents of a file.", schema);
39+
3840
// Step 3: Create a tool specification with the tool and the call function.
3941
return new McpServerFeatures.SyncToolSpecification(tool, (exchange, arguments) -> {
4042
// Step 4: Read the file and return the result.

0 commit comments

Comments
 (0)