Skip to content

Commit bcff3ca

Browse files
committed
README
Signed-off-by: Bar Haim <barha@il.ibm.com>
1 parent cca9d69 commit bcff3ca

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Tools Telemetry Exporter Plugin
2+
3+
> Author: Bar Haim
4+
> Version: 0.1.0
5+
6+
Export comprehensive tool invocation telemetry to OpenTelemetry for observability and monitoring.
7+
8+
## Hooks
9+
- `tool_pre_invoke`
10+
- `tool_post_invoke`
11+
12+
## Config
13+
```yaml
14+
config:
15+
export_full_payload: true
16+
max_payload_bytes_size: 10000 # 10 KB default
17+
```
18+
19+
## Features
20+
21+
- **Pre-Invocation Telemetry**: Captures request context, tool metadata, target MCP server details, and tool arguments
22+
- **Post-Invocation Telemetry**: Captures request context, tool results (optional), and error status
23+
- **Automatic Payload Truncation**: Large results are truncated to respect size limits
24+
- **Graceful Degradation**: Automatically disables if OpenTelemetry is not available
25+
26+
## Exported Attributes
27+
28+
### Pre-Invocation (`tool.pre_invoke`)
29+
- Request metadata: `request_id`, `user`, `tenant_id`, `server_id`
30+
- Target server: `target_mcp_server.id`, `target_mcp_server.name`, `target_mcp_server.url`
31+
- Tool info: `tool.name`, `tool.target_tool_name`, `tool.description`
32+
- Invocation data: `tool.invocation.args`, `headers`
33+
34+
### Post-Invocation (`tool.post_invoke`)
35+
- Request metadata: `request_id`, `user`, `tenant_id`, `server_id`
36+
- Results: `tool.invocation.result` (if `export_full_payload` is enabled and no error)
37+
- Status: `tool.invocation.has_error`
38+
39+
## Configuration Options
40+
41+
| Option | Default | Description |
42+
|--------|---------|-------------|
43+
| `export_full_payload` | `true` | Export full tool results in post-invocation telemetry |
44+
| `max_payload_bytes_size` | `10000` | Maximum payload size in bytes before truncation |
45+
46+
## Requirements
47+
48+
OpenTelemetry enabled on MCP context forge (see [Observability Setup](../../docs/docs/manage/observability.md#opentelemetry-external)).
49+
50+
51+
## Usage
52+
53+
```yaml
54+
plugins:
55+
- name: "ToolsTelemetryExporter"
56+
kind: "plugins.tools_telemetry_exporter.telemetry_exporter.ToolsTelemetryExporterPlugin"
57+
hooks: ["tool_pre_invoke", "tool_post_invoke"]
58+
mode: "permissive"
59+
priority: 200 # Run late to capture all context
60+
config:
61+
export_full_payload: true
62+
max_payload_bytes_size: 10000
63+
```
64+
65+
## Limitations
66+
67+
- Requires active OpenTelemetry tracing to export telemetry
68+
- No local buffering; telemetry exported in real-time only
69+
70+
## Security Notes
71+
72+
- Tool arguments are always exported in pre-invocation telemetry
73+
- Consider running PII filter plugin before this plugin to sanitize data
74+
- Disable `export_full_payload` in production for sensitive workloads

0 commit comments

Comments
 (0)