Skip to content

[Doc] Use registered callable names in examples/README.md#7

Open
yuki3738 wants to merge 1 commit into
mainfrom
fix_tool_name_in_http_server_example
Open

[Doc] Use registered callable names in examples/README.md#7
yuki3738 wants to merge 1 commit into
mainfrom
fix_tool_name_in_http_server_example

Conversation

@yuki3738

@yuki3738 yuki3738 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Motivation and Context

examples/README.md referred to three example components by their Ruby class names, while the server examples register them via class registration without an explicit tool_name / prompt_name. Their callable names exposed over JSON-RPC are therefore derived to the snake_case form 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 Has This Been Tested?

Ran ruby examples/http_server.rb locally and exercised the cURL flow against it (SSE event payloads shown without the data: prefix):

## tools/list
{"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"example_tool",...},{"name":"echo",...}]}}

## tools/call with "name":"ExampleTool" (before)
{"jsonrpc":"2.0","id":3,"error":{"code":-32602,"message":"Invalid params","data":"Tool not found: ExampleTool"}}

## tools/call with "name":"example_tool" (after)
{"jsonrpc":"2.0","id":4,"result":{"content":[{"type":"text","text":"The sum of 5 and 3 is 8"}],"isError":false}}

## prompts/list
{"jsonrpc":"2.0","id":5,"result":{"prompts":[{"name":"example_prompt",...}]}}

Breaking Changes

None (documentation only).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • I have added or updated documentation as needed

@yuki3738 yuki3738 force-pushed the fix_tool_name_in_http_server_example branch from 530aae8 to e45962c Compare June 23, 2026 17:27
@yuki3738 yuki3738 changed the title [Doc] Fix tool name in HTTP server example [Doc] Use registered callable names in examples/README.md Jun 23, 2026
`examples/README.md` referred to three example components by their Ruby class names, while the server examples register them via class registration without an explicit `tool_name` / `prompt_name`. Their callable names exposed over JSON-RPC are therefore derived to the snake_case form 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`.

Breaking Changes: None (documentation only).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant