Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 04710ac

Browse files
authoredJun 9, 2025··
Merge pull request #47 from koic/tweak_an_example_for_mcp_resource_in_readme
[Doc] Tweak an example for `MCP::Resource` in the README
2 parents 2ee3d39 + e9403c5 commit 04710ac

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,10 @@ The `MCP::Resource` class provides a way to register resources with the server.
460460

461461
```ruby
462462
resource = MCP::Resource.new(
463-
uri: "example.com/my_resource",
464-
mime_type: "text/plain",
465-
text: "Lorem ipsum dolor sit amet"
463+
uri: "https://example.com/my_resource",
464+
name: "My Resource",
465+
description: "Lorem ipsum dolor sit amet",
466+
mime_type: "text/html",
466467
)
467468

468469
server = MCP::Server.new(
@@ -478,13 +479,13 @@ server.resources_read_handler do |params|
478479
[{
479480
uri: params[:uri],
480481
mimeType: "text/plain",
481-
text: "Hello, world!",
482+
text: params[:uri],
482483
}]
483484
end
484485

485486
```
486487

487-
otherwise 'resources/read' requests will be a no-op.
488+
otherwise `resources/read` requests will be a no-op.
488489

489490
## Releases
490491

0 commit comments

Comments
 (0)
Please sign in to comment.