Skip to content

Commit 1c449ae

Browse files
committed
[Doc] Add tool_arguments to instrumentation callback documentation
Follow-up to #218, which added the `tool_arguments` feature to the instrumentation callback. This updates README.md to document the new `tool_arguments` key in both instrumentation callback sections, and removes redundant instrumentation documentation.
1 parent 3addc52 commit 1c449ae

1 file changed

Lines changed: 10 additions & 28 deletions

File tree

README.md

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,16 @@ The instrumentation callback receives a hash with the following possible keys:
320320

321321
- `method`: (String) The protocol method called (e.g., "ping", "tools/list")
322322
- `tool_name`: (String, optional) The name of the tool called
323+
- `tool_arguments`: (Hash, optional) The arguments passed to the tool
323324
- `prompt_name`: (String, optional) The name of the prompt called
324325
- `resource_uri`: (String, optional) The URI of the resource called
325326
- `error`: (String, optional) Error code if a lookup failed
326327
- `duration`: (Float) Duration of the call in seconds
327328

329+
> [!NOTE]
330+
> `tool_name`, `prompt_name` and `resource_uri` are only populated if a matching handler is registered.
331+
> This is to avoid potential issues with metric cardinality.
332+
328333
**Type:**
329334

330335
```ruby
@@ -335,9 +340,11 @@ instrumentation_callback = ->(data) { ... }
335340
**Example:**
336341

337342
```ruby
338-
config.instrumentation_callback = ->(data) {
339-
puts "Instrumentation: #{data.inspect}"
340-
}
343+
MCP.configure do |config|
344+
config.instrumentation_callback = ->(data) {
345+
puts "Instrumentation: #{data.inspect}"
346+
}
347+
end
341348
```
342349

343350
### Server Protocol Version
@@ -787,31 +794,6 @@ The server will handle prompt listing and execution through the MCP protocol met
787794
- `prompts/list` - Lists all registered prompts and their schemas
788795
- `prompts/get` - Retrieves and executes a specific prompt with arguments
789796

790-
### Instrumentation
791-
792-
The server allows registering a callback to receive information about instrumentation.
793-
To register a handler pass a proc/lambda to as `instrumentation_callback` into the server constructor.
794-
795-
```ruby
796-
MCP.configure do |config|
797-
config.instrumentation_callback = ->(data) {
798-
puts "Got instrumentation data #{data.inspect}"
799-
}
800-
end
801-
```
802-
803-
The data contains the following keys:
804-
805-
- `method`: the method called, e.g. `ping`, `tools/list`, `tools/call` etc
806-
- `tool_name`: the name of the tool called
807-
- `prompt_name`: the name of the prompt called
808-
- `resource_uri`: the uri of the resource called
809-
- `error`: if looking up tools/prompts etc failed, e.g. `tool_not_found`
810-
- `duration`: the duration of the call in seconds
811-
812-
`tool_name`, `prompt_name` and `resource_uri` are only populated if a matching handler is registered.
813-
This is to avoid potential issues with metric cardinality
814-
815797
### Resources
816798

817799
MCP spec includes [Resources](https://modelcontextprotocol.io/specification/latest/server/resources).

0 commit comments

Comments
 (0)