[Doc] Use registered callable names in examples/README.md
The `tools/call` cURL example in `examples/README.md` uses `"name": "ExampleTool"`, but a tool registered by class without an explicit `tool_name` gets a snake_case name derived from its class name (via `StringUtils.handle_from_class_name`), so the example fails with `Tool not found: ExampleTool`. The Tools/Prompts lists in the same file had the same mismatch (`ExampleTool`, `ExamplePrompt`, `NotificationTool`). All entries now use the registered callable names. 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).
This commit is contained in:
parent
b1a31ee143
commit
ac392cba55
1 changed files with 4 additions and 4 deletions
|
|
@ -55,9 +55,9 @@ $ ruby examples/http_server.rb
|
|||
The server will start on `http://localhost:9292` and provide:
|
||||
|
||||
- **Tools**:
|
||||
- `ExampleTool` - adds two numbers
|
||||
- `example_tool` - adds two numbers
|
||||
- `echo` - echoes back messages
|
||||
- **Prompts**: `ExamplePrompt` - echoes back arguments as a prompt
|
||||
- **Prompts**: `example_prompt` - echoes back arguments as a prompt
|
||||
- **Resources**: `test_resource` - returns example content
|
||||
|
||||
### 4. HTTP Client Example (`http_client.rb`)
|
||||
|
|
@ -98,7 +98,7 @@ A specialized HTTP server designed to test and demonstrate Server-Sent Events (S
|
|||
|
||||
**Available Tools:**
|
||||
|
||||
- `NotificationTool` - Send custom SSE notifications with optional delays
|
||||
- `notification_tool` - Send custom SSE notifications with optional delays
|
||||
- `echo` - Simple echo tool for basic testing
|
||||
|
||||
**Usage:**
|
||||
|
|
@ -237,5 +237,5 @@ Call a tool:
|
|||
```console
|
||||
curl -i http://localhost:9292 \
|
||||
-H "Mcp-Session-Id: YOUR_SESSION_ID" \
|
||||
--json '{"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"ExampleTool","arguments":{"a":5,"b":3}}}'
|
||||
--json '{"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"example_tool","arguments":{"a":5,"b":3}}}'
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in a new issue