Skip to content

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

Closed
yuki3738 wants to merge 1 commit into
mainfrom
fix_tool_name_in_http_server_example
Closed

[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

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 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",...}]}}

The full unit suite and RuboCop pass locally.

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
  • New and existing tests pass locally
  • 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
@yuki3738 yuki3738 force-pushed the fix_tool_name_in_http_server_example branch from e45962c to 23350e2 Compare June 23, 2026 17:37
@yuki3738 yuki3738 force-pushed the fix_tool_name_in_http_server_example branch from 23350e2 to e525b7b Compare July 2, 2026 15:54
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).
@yuki3738 yuki3738 force-pushed the fix_tool_name_in_http_server_example branch from e525b7b to ac392cb Compare July 2, 2026 16:08
@yuki3738

yuki3738 commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

Merged upstream as modelcontextprotocol#437 (modelcontextprotocol#437). Closing this staging PR.

@yuki3738 yuki3738 closed this Jul 2, 2026
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