Skip to content

Commit e525b7b

Browse files
committed
[Doc] Use registered callable names in examples/README.md
`examples/README.md` referred to three example components by their Ruby class names, while the server examples register them by passing the class itself, without setting an explicit `tool_name` / `prompt_name`. Their callable names exposed over JSON-RPC are therefore the snake_case form of the class name, derived via `StringUtils.handle_from_class_name` (used by both `MCP::Tool#name_value` and `MCP::Prompt#name_value`). - The `tools/call` cURL example for the HTTP server used `"name": "ExampleTool"`, but the registered tool is `example_tool`, so it would fail with `Tool not found: ExampleTool` (-32602 Invalid params). - The HTTP Server "Tools" list and "Prompts" list referred to `ExampleTool` and `ExamplePrompt`. The sibling `echo` tool is already listed by its callable name. - The Streamable HTTP Server "Available Tools" list referred to `NotificationTool`, while the same section's cURL example already uses `notification_tool`. The list and cURL entries now consistently use the callable names (`example_tool`, `example_prompt`, `notification_tool`). How Tested: Ran `ruby examples/http_server.rb` and exercised the cURL flow. `tools/list` returned `example_tool` and `echo`; `tools/call` with `"name": "ExampleTool"` returned `Tool not found: ExampleTool`; with `"name": "example_tool"` returned `The sum of 5 and 3 is 8`. `prompts/list` returned `example_prompt`. The full unit suite and RuboCop pass locally. Breaking Changes: None (documentation only).
1 parent b1a31ee commit e525b7b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

examples/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ $ ruby examples/http_server.rb
5555
The server will start on `http://localhost:9292` and provide:
5656

5757
- **Tools**:
58-
- `ExampleTool` - adds two numbers
58+
- `example_tool` - adds two numbers
5959
- `echo` - echoes back messages
60-
- **Prompts**: `ExamplePrompt` - echoes back arguments as a prompt
60+
- **Prompts**: `example_prompt` - echoes back arguments as a prompt
6161
- **Resources**: `test_resource` - returns example content
6262

6363
### 4. HTTP Client Example (`http_client.rb`)
@@ -98,7 +98,7 @@ A specialized HTTP server designed to test and demonstrate Server-Sent Events (S
9898

9999
**Available Tools:**
100100

101-
- `NotificationTool` - Send custom SSE notifications with optional delays
101+
- `notification_tool` - Send custom SSE notifications with optional delays
102102
- `echo` - Simple echo tool for basic testing
103103

104104
**Usage:**
@@ -237,5 +237,5 @@ Call a tool:
237237
```console
238238
curl -i http://localhost:9292 \
239239
-H "Mcp-Session-Id: YOUR_SESSION_ID" \
240-
--json '{"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"ExampleTool","arguments":{"a":5,"b":3}}}'
240+
--json '{"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"example_tool","arguments":{"a":5,"b":3}}}'
241241
```

0 commit comments

Comments
 (0)